summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf2
-rw-r--r--dist/changes-5.13.026
-rw-r--r--examples/qt3d/instanced-arrays-qml/instancebuffer.cpp2
-rw-r--r--src/animation/frontend/qabstractanimation.h2
-rw-r--r--src/animation/frontend/qabstractanimationclip.h2
-rw-r--r--src/animation/frontend/qabstractchannelmapping.h2
-rw-r--r--src/animation/frontend/qabstractclipanimator.h2
-rw-r--r--src/animation/frontend/qabstractclipblendnode.h2
-rw-r--r--src/animation/frontend/qadditiveclipblend.h2
-rw-r--r--src/animation/frontend/qanimationaspect.h2
-rw-r--r--src/animation/frontend/qanimationcallback.h2
-rw-r--r--src/animation/frontend/qanimationclip.h2
-rw-r--r--src/animation/frontend/qanimationclipdata.h2
-rw-r--r--src/animation/frontend/qanimationcliploader.h2
-rw-r--r--src/animation/frontend/qanimationcontroller.h2
-rw-r--r--src/animation/frontend/qanimationgroup.h2
-rw-r--r--src/animation/frontend/qblendedclipanimator.h2
-rw-r--r--src/animation/frontend/qcallbackmapping.h2
-rw-r--r--src/animation/frontend/qchannel.h2
-rw-r--r--src/animation/frontend/qchannelcomponent.h2
-rw-r--r--src/animation/frontend/qchannelmapper.h2
-rw-r--r--src/animation/frontend/qchannelmapping.h2
-rw-r--r--src/animation/frontend/qchannelmappingcreatedchange_p.h2
-rw-r--r--src/animation/frontend/qclipanimator.h2
-rw-r--r--src/animation/frontend/qclipblendnodecreatedchange.h2
-rw-r--r--src/animation/frontend/qclipblendvalue.h2
-rw-r--r--src/animation/frontend/qclock.h2
-rw-r--r--src/animation/frontend/qkeyframe.h2
-rw-r--r--src/animation/frontend/qkeyframeanimation.h2
-rw-r--r--src/animation/frontend/qlerpclipblend.h2
-rw-r--r--src/animation/frontend/qmorphinganimation.h2
-rw-r--r--src/animation/frontend/qmorphtarget.h2
-rw-r--r--src/animation/frontend/qskeletonmapping.h2
-rw-r--r--src/animation/frontend/qvertexblendanimation.h2
-rw-r--r--src/animation/qt3danimation_global.h6
-rw-r--r--src/animation/qt3danimation_global_p.h2
-rw-r--r--src/core/aspects/qabstractaspect.h6
-rw-r--r--src/core/aspects/qabstractaspect_p.h4
-rw-r--r--src/core/aspects/qaspectengine.h2
-rw-r--r--src/core/aspects/qaspectengine_p.h2
-rw-r--r--src/core/aspects/qaspectfactory.cpp4
-rw-r--r--src/core/aspects/qaspectfactory_p.h2
-rw-r--r--src/core/aspects/qaspectmanager_p.h2
-rw-r--r--src/core/changes/qcomponentaddedchange.h2
-rw-r--r--src/core/changes/qcomponentaddedchange_p.h2
-rw-r--r--src/core/changes/qcomponentremovedchange.h2
-rw-r--r--src/core/changes/qcomponentremovedchange_p.h2
-rw-r--r--src/core/changes/qdynamicpropertyupdatedchange.h2
-rw-r--r--src/core/changes/qdynamicpropertyupdatedchange_p.h2
-rw-r--r--src/core/changes/qnodecommand.h2
-rw-r--r--src/core/changes/qnodecommand_p.h2
-rw-r--r--src/core/changes/qnodecreatedchange.h2
-rw-r--r--src/core/changes/qnodecreatedchange_p.h2
-rw-r--r--src/core/changes/qnodedestroyedchange.h2
-rw-r--r--src/core/changes/qpropertynodeaddedchange.h2
-rw-r--r--src/core/changes/qpropertynoderemovedchange.h2
-rw-r--r--src/core/changes/qpropertyupdatedchange.h2
-rw-r--r--src/core/changes/qpropertyupdatedchangebase.h2
-rw-r--r--src/core/changes/qpropertyupdatedchangebase_p.h2
-rw-r--r--src/core/changes/qpropertyvalueaddedchange.h2
-rw-r--r--src/core/changes/qpropertyvalueaddedchange_p.h2
-rw-r--r--src/core/changes/qpropertyvalueaddedchangebase.h2
-rw-r--r--src/core/changes/qpropertyvalueaddedchangebase_p.h2
-rw-r--r--src/core/changes/qpropertyvalueremovedchange.h2
-rw-r--r--src/core/changes/qpropertyvalueremovedchange_p.h2
-rw-r--r--src/core/changes/qpropertyvalueremovedchangebase.h2
-rw-r--r--src/core/changes/qpropertyvalueremovedchangebase_p.h2
-rw-r--r--src/core/changes/qscenechange.h2
-rw-r--r--src/core/changes/qscenechange_p.h2
-rw-r--r--src/core/changes/qskeletoncreatedchange_p.h2
-rw-r--r--src/core/changes/qstaticpropertyupdatedchangebase.h2
-rw-r--r--src/core/changes/qstaticpropertyvalueaddedchangebase.h2
-rw-r--r--src/core/changes/qstaticpropertyvalueaddedchangebase_p.h2
-rw-r--r--src/core/changes/qstaticpropertyvalueremovedchangebase.h2
-rw-r--r--src/core/changes/qstaticpropertyvalueremovedchangebase_p.h2
-rw-r--r--src/core/jobs/qabstractaspectjobmanager_p.h2
-rw-r--r--src/core/jobs/qaspectjob.h2
-rw-r--r--src/core/jobs/qaspectjob_p.h2
-rw-r--r--src/core/jobs/qaspectjobmanager_p.h2
-rw-r--r--src/core/jobs/qthreadpooler_p.h2
-rw-r--r--src/core/nodes/propertychangehandler_p.h2
-rw-r--r--src/core/nodes/qabstractnodefactory_p.h2
-rw-r--r--src/core/nodes/qbackendnode.h4
-rw-r--r--src/core/nodes/qbackendnode_p.h2
-rw-r--r--src/core/nodes/qcomponent.h2
-rw-r--r--src/core/nodes/qcomponent_p.h2
-rw-r--r--src/core/nodes/qentity.cpp7
-rw-r--r--src/core/nodes/qentity.h15
-rw-r--r--src/core/nodes/qentity_p.h2
-rw-r--r--src/core/nodes/qnode.h2
-rw-r--r--src/core/nodes/qnode_p.h2
-rw-r--r--src/core/nodes/qnodecreatedchangegenerator_p.h2
-rw-r--r--src/core/nodes/qnodeid.h4
-rw-r--r--src/core/nodes/qnodevisitor_p.h2
-rw-r--r--src/core/qbackendnodefactory_p.h2
-rw-r--r--src/core/qchangearbiter_p.h4
-rw-r--r--src/core/qlockableobserverinterface_p.h2
-rw-r--r--src/core/qobservableinterface_p.h2
-rw-r--r--src/core/qobserverinterface_p.h2
-rw-r--r--src/core/qpostman_p.h2
-rw-r--r--src/core/qpostman_p_p.h2
-rw-r--r--src/core/qscene_p.h2
-rw-r--r--src/core/qsceneobserverinterface_p.h2
-rw-r--r--src/core/qt3dcore_global.h6
-rw-r--r--src/core/qt3dcore_global_p.h2
-rw-r--r--src/core/resources/qframeallocator_p.h2
-rw-r--r--src/core/resources/qresourcemanager_p.h2
-rw-r--r--src/core/services/qabstractframeadvanceservice_p.h2
-rw-r--r--src/core/services/qdownloadhelperservice_p.h4
-rw-r--r--src/core/services/qeventfilterservice_p.h2
-rw-r--r--src/core/services/qopenglinformationservice_p.h2
-rw-r--r--src/core/services/qservicelocator_p.h4
-rw-r--r--src/core/services/qsysteminformationservice_p.h2
-rw-r--r--src/core/transforms/matrix4x4_avx2_p.h6
-rw-r--r--src/core/transforms/matrix4x4_sse_p.h4
-rw-r--r--src/core/transforms/qabstractskeleton.h2
-rw-r--r--src/core/transforms/qarmature.h2
-rw-r--r--src/core/transforms/qjoint.h2
-rw-r--r--src/core/transforms/qskeleton.h2
-rw-r--r--src/core/transforms/qskeletonloader.h2
-rw-r--r--src/core/transforms/qtransform.h2
-rw-r--r--src/core/transforms/vector3d_sse_p.h20
-rw-r--r--src/core/transforms/vector4d_sse_p.h2
-rw-r--r--src/doc/qt3d.qdocconf20
-rw-r--r--src/extras/3dtext/qextrudedtextgeometry.h2
-rw-r--r--src/extras/3dtext/qextrudedtextmesh.h2
-rw-r--r--src/extras/defaults/qabstractcameracontroller.h2
-rw-r--r--src/extras/defaults/qabstractspritesheet.h2
-rw-r--r--src/extras/defaults/qdiffusemapmaterial.h2
-rw-r--r--src/extras/defaults/qdiffusespecularmapmaterial.h2
-rw-r--r--src/extras/defaults/qdiffusespecularmaterial.h2
-rw-r--r--src/extras/defaults/qfirstpersoncameracontroller.h2
-rw-r--r--src/extras/defaults/qforwardrenderer.h2
-rw-r--r--src/extras/defaults/qgoochmaterial.h2
-rw-r--r--src/extras/defaults/qmetalroughmaterial.h2
-rw-r--r--src/extras/defaults/qmorphphongmaterial.h2
-rw-r--r--src/extras/defaults/qnormaldiffusemapalphamaterial.h2
-rw-r--r--src/extras/defaults/qnormaldiffusemapmaterial.h2
-rw-r--r--src/extras/defaults/qnormaldiffusespecularmapmaterial.h2
-rw-r--r--src/extras/defaults/qorbitcameracontroller.h2
-rw-r--r--src/extras/defaults/qpervertexcolormaterial.h2
-rw-r--r--src/extras/defaults/qphongalphamaterial.h2
-rw-r--r--src/extras/defaults/qphongmaterial.h2
-rw-r--r--src/extras/defaults/qskyboxentity.h2
-rw-r--r--src/extras/defaults/qspritegrid.h2
-rw-r--r--src/extras/defaults/qspritesheet.h2
-rw-r--r--src/extras/defaults/qspritesheetitem.h2
-rw-r--r--src/extras/defaults/qt3dwindow.h2
-rw-r--r--src/extras/defaults/qtexturedmetalroughmaterial.h2
-rw-r--r--src/extras/defaults/qtexturematerial.h2
-rw-r--r--src/extras/geometries/qconegeometry.h2
-rw-r--r--src/extras/geometries/qconemesh.h2
-rw-r--r--src/extras/geometries/qcuboidgeometry.h2
-rw-r--r--src/extras/geometries/qcuboidmesh.h2
-rw-r--r--src/extras/geometries/qcylindergeometry.h2
-rw-r--r--src/extras/geometries/qcylindermesh.h2
-rw-r--r--src/extras/geometries/qplanegeometry.h2
-rw-r--r--src/extras/geometries/qplanemesh.h2
-rw-r--r--src/extras/geometries/qspheregeometry.h2
-rw-r--r--src/extras/geometries/qspheremesh.h2
-rw-r--r--src/extras/geometries/qtorusgeometry.h2
-rw-r--r--src/extras/geometries/qtorusmesh.h2
-rw-r--r--src/extras/qt3dextras_global.h6
-rw-r--r--src/extras/text/qtext2dentity.h2
-rw-r--r--src/input/backend/qabstractphysicaldevicebackendnode_p.h2
-rw-r--r--src/input/backend/qabstractphysicaldevicebackendnode_p_p.h2
-rw-r--r--src/input/frontend/qabstractactioninput.h2
-rw-r--r--src/input/frontend/qabstractaxisinput.h2
-rw-r--r--src/input/frontend/qabstractphysicaldevice.h2
-rw-r--r--src/input/frontend/qabstractphysicaldevice_p.h2
-rw-r--r--src/input/frontend/qabstractphysicaldeviceproxy_p.h2
-rw-r--r--src/input/frontend/qabstractphysicaldeviceproxy_p_p.h2
-rw-r--r--src/input/frontend/qaction.h2
-rw-r--r--src/input/frontend/qactioninput.h2
-rw-r--r--src/input/frontend/qanalogaxisinput.h2
-rw-r--r--src/input/frontend/qaxis.h2
-rw-r--r--src/input/frontend/qaxisaccumulator.h2
-rw-r--r--src/input/frontend/qaxissetting.h2
-rw-r--r--src/input/frontend/qbuttonaxisinput.h2
-rw-r--r--src/input/frontend/qgamepadinput_p.h2
-rw-r--r--src/input/frontend/qgenericinputdevice_p.h2
-rw-r--r--src/input/frontend/qinputaspect.cpp2
-rw-r--r--src/input/frontend/qinputaspect.h2
-rw-r--r--src/input/frontend/qinputchord.h2
-rw-r--r--src/input/frontend/qinputdeviceintegration_p.h2
-rw-r--r--src/input/frontend/qinputdeviceintegration_p_p.h2
-rw-r--r--src/input/frontend/qinputdeviceplugin_p.h2
-rw-r--r--src/input/frontend/qinputsequence.h2
-rw-r--r--src/input/frontend/qinputsettings.h2
-rw-r--r--src/input/frontend/qkeyboarddevice.h2
-rw-r--r--src/input/frontend/qkeyboardhandler.h2
-rw-r--r--src/input/frontend/qkeyevent.h2
-rw-r--r--src/input/frontend/qlogicaldevice.h2
-rw-r--r--src/input/frontend/qmousedevice.h2
-rw-r--r--src/input/frontend/qmouseevent.h4
-rw-r--r--src/input/frontend/qmousehandler.h2
-rw-r--r--src/input/frontend/qphysicaldevicecreatedchange.h2
-rw-r--r--src/input/qt3dinput_global.h6
-rw-r--r--src/input/qt3dinput_global_p.h2
-rw-r--r--src/logic/qframeaction.h2
-rw-r--r--src/logic/qlogicaspect.cpp2
-rw-r--r--src/logic/qlogicaspect.h2
-rw-r--r--src/logic/qt3dlogic_global.h6
-rw-r--r--src/plugins/geometryloaders/default/basegeometryloader.cpp2
-rw-r--r--src/plugins/geometryloaders/gltf/gltfgeometryloader.cpp16
-rw-r--r--src/plugins/sceneparsers/gltf/gltfimporter.cpp772
-rw-r--r--src/plugins/sceneparsers/gltf/gltfimporter.h15
-rw-r--r--src/quick3d/imports/animation/plugins.qmltypes2
-rw-r--r--src/quick3d/imports/core/plugins.qmltypes4
-rw-r--r--src/quick3d/imports/extras/plugins.qmltypes2
-rw-r--r--src/quick3d/imports/extras/qt3dquick3dextrasplugin.cpp3
-rw-r--r--src/quick3d/imports/input/plugins.qmltypes2
-rw-r--r--src/quick3d/imports/logic/plugins.qmltypes2
-rw-r--r--src/quick3d/imports/render/plugins.qmltypes233
-rw-r--r--src/quick3d/imports/render/qt3dquick3drenderplugin.cpp9
-rw-r--r--src/quick3d/imports/scene2d/plugins.qmltypes2
-rw-r--r--src/quick3d/imports/scene3d/plugins.qmltypes2
-rw-r--r--src/quick3d/quick3d/items/quick3dentity_p.h2
-rw-r--r--src/quick3d/quick3d/items/quick3dentityloader_p.h2
-rw-r--r--src/quick3d/quick3d/items/quick3djoint_p.h2
-rw-r--r--src/quick3d/quick3d/items/quick3dnode_p.h2
-rw-r--r--src/quick3d/quick3d/items/quick3dnodeinstantiator_p.h2
-rw-r--r--src/quick3d/quick3d/items/quick3dnodev9_p.h2
-rw-r--r--src/quick3d/quick3d/qqmlaspectengine.h2
-rw-r--r--src/quick3d/quick3d/qquaternionanimation.cpp3
-rw-r--r--src/quick3d/quick3d/qquaternionanimation_p.h4
-rw-r--r--src/quick3d/quick3d/qt3dquick_global.h6
-rw-r--r--src/quick3d/quick3d/qt3dquick_global_p.h8
-rw-r--r--src/quick3d/quick3d/qt3dquickvaluetypes_p.h14
-rw-r--r--src/quick3d/quick3danimation/items/quick3danimationcontroller_p.h2
-rw-r--r--src/quick3d/quick3danimation/items/quick3danimationgroup_p.h2
-rw-r--r--src/quick3d/quick3danimation/items/quick3dchannelmapper_p.h2
-rw-r--r--src/quick3d/quick3danimation/items/quick3dkeyframeanimation_p.h2
-rw-r--r--src/quick3d/quick3danimation/items/quick3dmorphinganimation_p.h2
-rw-r--r--src/quick3d/quick3danimation/items/quick3dmorphtarget_p.h2
-rw-r--r--src/quick3d/quick3danimation/items/quick3dvertexblendanimation_p.h2
-rw-r--r--src/quick3d/quick3danimation/qt3dquickanimation_global.h6
-rw-r--r--src/quick3d/quick3danimation/qt3dquickanimation_global_p.h6
-rw-r--r--src/quick3d/quick3dextras/items/quick3dlevelofdetailloader_p.h2
-rw-r--r--src/quick3d/quick3dextras/items/quick3dspritesheet_p.h2
-rw-r--r--src/quick3d/quick3dextras/qt3dquickextras_global.h6
-rw-r--r--src/quick3d/quick3dextras/qt3dquickextras_global_p.h6
-rw-r--r--src/quick3d/quick3dextras/qt3dquickwindow.h2
-rw-r--r--src/quick3d/quick3dinput/items/quick3daction_p.h2
-rw-r--r--src/quick3d/quick3dinput/items/quick3daxis_p.h2
-rw-r--r--src/quick3d/quick3dinput/items/quick3dinputchord_p.h2
-rw-r--r--src/quick3d/quick3dinput/items/quick3dinputsequence_p.h2
-rw-r--r--src/quick3d/quick3dinput/items/quick3dlogicaldevice_p.h2
-rw-r--r--src/quick3d/quick3dinput/items/quick3dphysicaldevice_p.h2
-rw-r--r--src/quick3d/quick3dinput/qt3dquickinput_global.h6
-rw-r--r--src/quick3d/quick3dinput/qt3dquickinput_global_p.h6
-rw-r--r--src/quick3d/quick3drender/items/quick3dbuffer_p.h2
-rw-r--r--src/quick3d/quick3drender/items/quick3deffect_p.h2
-rw-r--r--src/quick3d/quick3drender/items/quick3dgeometry_p.h2
-rw-r--r--src/quick3d/quick3drender/items/quick3dlayerfilter_p.h2
-rw-r--r--src/quick3d/quick3drender/items/quick3dmaterial_p.h2
-rw-r--r--src/quick3d/quick3drender/items/quick3dmemorybarrier_p.h2
-rw-r--r--src/quick3d/quick3drender/items/quick3dparameter_p.h2
-rw-r--r--src/quick3d/quick3drender/items/quick3draycaster_p.h2
-rw-r--r--src/quick3d/quick3drender/items/quick3draycaster_p_p.h2
-rw-r--r--src/quick3d/quick3drender/items/quick3drenderpass_p.h2
-rw-r--r--src/quick3d/quick3drender/items/quick3drenderpassfilter_p.h2
-rw-r--r--src/quick3d/quick3drender/items/quick3drendertargetoutput_p.h2
-rw-r--r--src/quick3d/quick3drender/items/quick3drendertargetselector_p.h2
-rw-r--r--src/quick3d/quick3drender/items/quick3dscene_p.h2
-rw-r--r--src/quick3d/quick3drender/items/quick3dscreenraycaster_p.h2
-rw-r--r--src/quick3d/quick3drender/items/quick3dscreenraycaster_p_p.h2
-rw-r--r--src/quick3d/quick3drender/items/quick3dshaderdata_p.h2
-rw-r--r--src/quick3d/quick3drender/items/quick3dshaderdataarray_p.h2
-rw-r--r--src/quick3d/quick3drender/items/quick3dstateset_p.h2
-rw-r--r--src/quick3d/quick3drender/items/quick3dtechnique_p.h2
-rw-r--r--src/quick3d/quick3drender/items/quick3dtechniquefilter_p.h2
-rw-r--r--src/quick3d/quick3drender/items/quick3dtexture_p.h2
-rw-r--r--src/quick3d/quick3drender/items/quick3dviewport_p.h2
-rw-r--r--src/quick3d/quick3drender/qt3dquickrender_global.h6
-rw-r--r--src/quick3d/quick3drender/qt3dquickrender_global_p.h6
-rw-r--r--src/quick3d/quick3dscene2d/items/qscene2d.h2
-rw-r--r--src/quick3d/quick3dscene2d/items/qt3dquick3dscene2d_p.h2
-rw-r--r--src/quick3d/quick3dscene2d/items/scene2d_p.h2
-rw-r--r--src/quick3d/quick3dscene2d/items/scene2dsharedobject_p.h2
-rw-r--r--src/quick3d/quick3dscene2d/qt3dquickscene2d_global.h6
-rw-r--r--src/quick3d/quick3dscene2d/qt3dquickscene2d_global_p.h6
-rw-r--r--src/render/backend/abstractrenderer_p.h3
-rw-r--r--src/render/backend/backendnode_p.h2
-rw-r--r--src/render/backend/cameralens.cpp1
-rw-r--r--src/render/backend/cameralens_p.h2
-rw-r--r--src/render/backend/computecommand.cpp30
-rw-r--r--src/render/backend/computecommand_p.h8
-rw-r--r--src/render/backend/entity.cpp20
-rw-r--r--src/render/backend/entity_p.h14
-rw-r--r--src/render/backend/entityaccumulator.cpp99
-rw-r--r--src/render/backend/entityaccumulator_p.h83
-rw-r--r--src/render/backend/entityvisitor.cpp113
-rw-r--r--src/render/backend/entityvisitor_p.h95
-rw-r--r--src/render/backend/managers_p.h5
-rw-r--r--src/render/backend/nodemanagers.cpp2
-rw-r--r--src/render/backend/nodemanagers_p.h77
-rw-r--r--src/render/backend/platformsurfacefilter_p.h2
-rw-r--r--src/render/backend/render-backend.pri4
-rw-r--r--src/render/backend/resourceaccessor_p.h2
-rw-r--r--src/render/backend/trianglesvisitor_p.h2
-rw-r--r--src/render/framegraph/blitframebuffer.cpp8
-rw-r--r--src/render/framegraph/cameraselectornode.cpp5
-rw-r--r--src/render/framegraph/clearbuffers.cpp6
-rw-r--r--src/render/framegraph/dispatchcompute.cpp11
-rw-r--r--src/render/framegraph/framegraph.pri14
-rw-r--r--src/render/framegraph/framegraphnode.cpp16
-rw-r--r--src/render/framegraph/framegraphnode_p.h4
-rw-r--r--src/render/framegraph/layerfilternode.cpp5
-rw-r--r--src/render/framegraph/memorybarrier.cpp2
-rw-r--r--src/render/framegraph/proximityfilter.cpp8
-rw-r--r--src/render/framegraph/qblitframebuffer.cpp54
-rw-r--r--src/render/framegraph/qblitframebuffer.h2
-rw-r--r--src/render/framegraph/qbuffercapture.h2
-rw-r--r--src/render/framegraph/qcameraselector.h2
-rw-r--r--src/render/framegraph/qclearbuffers.h2
-rw-r--r--src/render/framegraph/qdispatchcompute.h2
-rw-r--r--src/render/framegraph/qframegraphnode.h2
-rw-r--r--src/render/framegraph/qframegraphnodecreatedchange.h2
-rw-r--r--src/render/framegraph/qfrustumculling.h2
-rw-r--r--src/render/framegraph/qlayerfilter.h2
-rw-r--r--src/render/framegraph/qmemorybarrier.h2
-rw-r--r--src/render/framegraph/qnodraw.h2
-rw-r--r--src/render/framegraph/qproximityfilter.h2
-rw-r--r--src/render/framegraph/qrendercapture.h4
-rw-r--r--src/render/framegraph/qrenderpassfilter.h2
-rw-r--r--src/render/framegraph/qrenderstateset.h2
-rw-r--r--src/render/framegraph/qrendersurfaceselector.h2
-rw-r--r--src/render/framegraph/qrendersurfaceselector_p.h2
-rw-r--r--src/render/framegraph/qrendertargetselector.h2
-rw-r--r--src/render/framegraph/qsetfence.cpp174
-rw-r--r--src/render/framegraph/qsetfence.h86
-rw-r--r--src/render/framegraph/qsetfence_p.h82
-rw-r--r--src/render/framegraph/qsortpolicy.h2
-rw-r--r--src/render/framegraph/qtechniquefilter.h2
-rw-r--r--src/render/framegraph/qtechniquefilter_p.h2
-rw-r--r--src/render/framegraph/qviewport.h2
-rw-r--r--src/render/framegraph/qwaitfence.cpp219
-rw-r--r--src/render/framegraph/qwaitfence.h98
-rw-r--r--src/render/framegraph/qwaitfence_p.h85
-rw-r--r--src/render/framegraph/rendercapture.cpp1
-rw-r--r--src/render/framegraph/renderpassfilternode.cpp8
-rw-r--r--src/render/framegraph/rendersurfaceselector.cpp17
-rw-r--r--src/render/framegraph/rendertargetselectornode.cpp8
-rw-r--r--src/render/framegraph/setfence.cpp79
-rw-r--r--src/render/framegraph/setfence_p.h80
-rw-r--r--src/render/framegraph/sortpolicy.cpp2
-rw-r--r--src/render/framegraph/statesetnode.cpp4
-rw-r--r--src/render/framegraph/techniquefilternode.cpp8
-rw-r--r--src/render/framegraph/viewportnode.cpp3
-rw-r--r--src/render/framegraph/waitfence.cpp107
-rw-r--r--src/render/framegraph/waitfence_p.h85
-rw-r--r--src/render/frontend/qabstractfunctor.cpp7
-rw-r--r--src/render/frontend/qabstractfunctor.h2
-rw-r--r--src/render/frontend/qcamera.h2
-rw-r--r--src/render/frontend/qcamera_p.h2
-rw-r--r--src/render/frontend/qcameralens.h2
-rw-r--r--src/render/frontend/qcameralens_p.h2
-rw-r--r--src/render/frontend/qcomputecommand.cpp102
-rw-r--r--src/render/frontend/qcomputecommand.h15
-rw-r--r--src/render/frontend/qcomputecommand_p.h9
-rw-r--r--src/render/frontend/qlayer.h2
-rw-r--r--src/render/frontend/qlayer_p.h2
-rw-r--r--src/render/frontend/qlevelofdetail.h2
-rw-r--r--src/render/frontend/qlevelofdetail_p.h2
-rw-r--r--src/render/frontend/qlevelofdetailboundingsphere.h2
-rw-r--r--src/render/frontend/qlevelofdetailswitch.h2
-rw-r--r--src/render/frontend/qpickingsettings.cpp8
-rw-r--r--src/render/frontend/qpickingsettings.h5
-rw-r--r--src/render/frontend/qpickingsettings_p.h2
-rw-r--r--src/render/frontend/qrenderaspect.cpp15
-rw-r--r--src/render/frontend/qrenderaspect.h2
-rw-r--r--src/render/frontend/qrenderaspect_p.h2
-rw-r--r--src/render/frontend/qrenderplugin_p.h2
-rw-r--r--src/render/frontend/qrenderpluginfactory_p.h2
-rw-r--r--src/render/frontend/qrenderpluginfactoryif_p.h2
-rw-r--r--src/render/frontend/qrendersettings.h2
-rw-r--r--src/render/frontend/qrendersettings_p.h2
-rw-r--r--src/render/frontend/qrendertarget.h2
-rw-r--r--src/render/frontend/qrendertarget_p.h2
-rw-r--r--src/render/frontend/qrendertargetoutput.h2
-rw-r--r--src/render/frontend/qrendertargetoutput_p.h2
-rw-r--r--src/render/frontend/sphere_p.h4
-rw-r--r--src/render/geometry/attribute.cpp11
-rw-r--r--src/render/geometry/geometry.cpp39
-rw-r--r--src/render/geometry/geometry_p.h10
-rw-r--r--src/render/geometry/qattribute.h2
-rw-r--r--src/render/geometry/qattribute_p.h2
-rw-r--r--src/render/geometry/qbuffer.h2
-rw-r--r--src/render/geometry/qbuffer_p.h2
-rw-r--r--src/render/geometry/qbufferdatagenerator.h2
-rw-r--r--src/render/geometry/qgeometry.cpp56
-rw-r--r--src/render/geometry/qgeometry.h10
-rw-r--r--src/render/geometry/qgeometry_p.h5
-rw-r--r--src/render/geometry/qgeometryfactory.h2
-rw-r--r--src/render/geometry/qgeometryrenderer.h2
-rw-r--r--src/render/geometry/qgeometryrenderer_p.h2
-rw-r--r--src/render/geometry/qmesh.h2
-rw-r--r--src/render/geometry/qmesh_p.h2
-rw-r--r--src/render/io/qaxisalignedboundingbox_p.h2
-rw-r--r--src/render/io/qgeometryloaderfactory_p.h2
-rw-r--r--src/render/io/qgeometryloaderinterface_p.h2
-rw-r--r--src/render/io/qsceneexporter_p.h2
-rw-r--r--src/render/io/qsceneexportfactory_p.h2
-rw-r--r--src/render/io/qsceneexportplugin_p.h2
-rw-r--r--src/render/io/qsceneimporter_p.h2
-rw-r--r--src/render/io/qsceneimportfactory_p.h2
-rw-r--r--src/render/io/qsceneimportplugin_p.h2
-rw-r--r--src/render/io/qsceneloader.h2
-rw-r--r--src/render/io/qsceneloader_p.h2
-rw-r--r--src/render/io/qurlhelper_p.h2
-rw-r--r--src/render/jobs/calcboundingvolumejob.cpp96
-rw-r--r--src/render/jobs/calcboundingvolumejob_p.h2
-rw-r--r--src/render/jobs/computefilteredboundingvolumejob.cpp22
-rw-r--r--src/render/jobs/computefilteredboundingvolumejob_p.h5
-rw-r--r--src/render/jobs/expandboundingvolumejob.cpp30
-rw-r--r--src/render/jobs/expandboundingvolumejob_p.h5
-rw-r--r--src/render/jobs/filterlayerentityjob_p.h2
-rw-r--r--src/render/jobs/framecleanupjob.cpp26
-rw-r--r--src/render/jobs/framecleanupjob_p.h2
-rw-r--r--src/render/jobs/frustumcullingjob.cpp43
-rw-r--r--src/render/jobs/frustumcullingjob_p.h3
-rw-r--r--src/render/jobs/job_common_p.h3
-rw-r--r--src/render/jobs/pickboundingvolumejob.cpp16
-rw-r--r--src/render/jobs/pickboundingvolumeutils.cpp165
-rw-r--r--src/render/jobs/pickboundingvolumeutils_p.h27
-rw-r--r--src/render/jobs/raycastingjob.cpp50
-rw-r--r--src/render/jobs/sendbuffercapturejob.cpp6
-rw-r--r--src/render/jobs/sendbuffercapturejob_p.h3
-rw-r--r--src/render/jobs/sendrendercapturejob_p.h2
-rw-r--r--src/render/jobs/updateentityhierarchyjob_p.h2
-rw-r--r--src/render/jobs/updateentitylayersjob.cpp17
-rw-r--r--src/render/jobs/updateentitylayersjob_p.h2
-rw-r--r--src/render/jobs/updatelevelofdetailjob.cpp255
-rw-r--r--src/render/jobs/updatelevelofdetailjob_p.h8
-rw-r--r--src/render/jobs/updatemeshtrianglelistjob_p.h2
-rw-r--r--src/render/jobs/updateshaderdatatransformjob_p.h2
-rw-r--r--src/render/jobs/updateskinningpalettejob.cpp22
-rw-r--r--src/render/jobs/updateskinningpalettejob_p.h1
-rw-r--r--src/render/jobs/updatetreeenabledjob.cpp22
-rw-r--r--src/render/jobs/updatetreeenabledjob_p.h5
-rw-r--r--src/render/jobs/updateworldboundingvolumejob_p.h2
-rw-r--r--src/render/jobs/updateworldtransformjob.cpp21
-rw-r--r--src/render/jobs/updateworldtransformjob_p.h6
-rw-r--r--src/render/lights/qabstractlight.h2
-rw-r--r--src/render/lights/qabstractlight_p.h2
-rw-r--r--src/render/lights/qdirectionallight.h2
-rw-r--r--src/render/lights/qdirectionallight_p.h2
-rw-r--r--src/render/lights/qenvironmentlight.h2
-rw-r--r--src/render/lights/qenvironmentlight_p.h2
-rw-r--r--src/render/lights/qpointlight.h2
-rw-r--r--src/render/lights/qpointlight_p.h2
-rw-r--r--src/render/lights/qspotlight.h2
-rw-r--r--src/render/lights/qspotlight_p.h2
-rw-r--r--src/render/materialsystem/qeffect.h2
-rw-r--r--src/render/materialsystem/qeffect_p.h2
-rw-r--r--src/render/materialsystem/qfilterkey.h2
-rw-r--r--src/render/materialsystem/qfilterkey_p.h2
-rw-r--r--src/render/materialsystem/qgraphicsapifilter.h2
-rw-r--r--src/render/materialsystem/qgraphicsapifilter_p.h4
-rw-r--r--src/render/materialsystem/qmaterial.h2
-rw-r--r--src/render/materialsystem/qmaterial_p.h2
-rw-r--r--src/render/materialsystem/qparameter.h2
-rw-r--r--src/render/materialsystem/qparameter_p.h2
-rw-r--r--src/render/materialsystem/qrenderpass.h2
-rw-r--r--src/render/materialsystem/qshaderdata.h4
-rw-r--r--src/render/materialsystem/qshaderdata_p.h2
-rw-r--r--src/render/materialsystem/qshaderprogram.h2
-rw-r--r--src/render/materialsystem/qshaderprogrambuilder.cpp155
-rw-r--r--src/render/materialsystem/qshaderprogrambuilder.h21
-rw-r--r--src/render/materialsystem/qshaderprogrambuilder_p.h6
-rw-r--r--src/render/materialsystem/qtechnique.h2
-rw-r--r--src/render/materialsystem/shaderbuilder.cpp33
-rw-r--r--src/render/materialsystem/shaderbuilder_p.h2
-rw-r--r--src/render/materialsystem/shadercache_p.h2
-rw-r--r--src/render/materialsystem/technique_p.h2
-rw-r--r--src/render/picking/objectpicker.cpp15
-rw-r--r--src/render/picking/objectpicker_p.h5
-rw-r--r--src/render/picking/qabstractraycaster.cpp4
-rw-r--r--src/render/picking/qabstractraycaster.h2
-rw-r--r--src/render/picking/qabstractraycaster_p.h2
-rw-r--r--src/render/picking/qobjectpicker.cpp37
-rw-r--r--src/render/picking/qobjectpicker.h7
-rw-r--r--src/render/picking/qobjectpicker_p.h5
-rw-r--r--src/render/picking/qpickevent.h2
-rw-r--r--src/render/picking/qpickevent_p.h2
-rw-r--r--src/render/picking/qpicklineevent.h2
-rw-r--r--src/render/picking/qpickpointevent.h2
-rw-r--r--src/render/picking/qpicktriangleevent.h2
-rw-r--r--src/render/picking/qraycaster.h2
-rw-r--r--src/render/picking/qraycasterhit.h2
-rw-r--r--src/render/picking/qscreenraycaster.h2
-rw-r--r--src/render/qt3drender_global.h6
-rw-r--r--src/render/qt3drender_global_p.h2
-rw-r--r--src/render/raycasting/boundingsphere_p.h2
-rw-r--r--src/render/raycasting/qabstractcollisionqueryservice_p.h2
-rw-r--r--src/render/raycasting/qboundingvolume_p.h2
-rw-r--r--src/render/raycasting/qboundingvolumeprovider_p.h2
-rw-r--r--src/render/raycasting/qcollisionqueryresult_p.h2
-rw-r--r--src/render/raycasting/qray3d_p.h8
-rw-r--r--src/render/raycasting/qraycastingservice_p.h2
-rw-r--r--src/render/renderers/opengl/graphicshelpers/glfence_p.h73
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicshelperes2.cpp27
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicshelperes2_p.h6
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicshelperes3.cpp52
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicshelperes3_p.h6
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp28
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h6
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp32
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h6
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp32
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h6
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp35
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicshelpergl4_p.h6
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicshelperinterface_p.h9
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicshelpers.pri1
-rw-r--r--src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp29
-rw-r--r--src/render/renderers/opengl/graphicshelpers/submissioncontext_p.h9
-rw-r--r--src/render/renderers/opengl/graphicshelpers/texturesubmissioncontext.cpp23
-rw-r--r--src/render/renderers/opengl/graphicshelpers/texturesubmissioncontext_p.h4
-rw-r--r--src/render/renderers/opengl/jobs/filtercompatibletechniquejob_p.h2
-rw-r--r--src/render/renderers/opengl/jobs/materialparametergathererjob_p.h2
-rw-r--r--src/render/renderers/opengl/jobs/renderviewjobutils.cpp12
-rw-r--r--src/render/renderers/opengl/renderer/renderer.cpp162
-rw-r--r--src/render/renderers/opengl/renderer/renderer_p.h17
-rw-r--r--src/render/renderers/opengl/renderer/renderview.cpp5
-rw-r--r--src/render/renderers/opengl/renderer/renderview_p.h10
-rw-r--r--src/render/renderers/opengl/textures/gltexture.cpp260
-rw-r--r--src/render/renderers/opengl/textures/gltexture_p.h8
-rw-r--r--src/render/renderstates/qalphacoverage.h2
-rw-r--r--src/render/renderstates/qalphatest.h2
-rw-r--r--src/render/renderstates/qblendequation.h2
-rw-r--r--src/render/renderstates/qblendequation_p.h2
-rw-r--r--src/render/renderstates/qblendequationarguments.h2
-rw-r--r--src/render/renderstates/qblendequationarguments_p.h2
-rw-r--r--src/render/renderstates/qclipplane.h2
-rw-r--r--src/render/renderstates/qclipplane_p.h2
-rw-r--r--src/render/renderstates/qcolormask.h2
-rw-r--r--src/render/renderstates/qcolormask_p.h2
-rw-r--r--src/render/renderstates/qcullface.h2
-rw-r--r--src/render/renderstates/qcullface_p.h2
-rw-r--r--src/render/renderstates/qdepthtest.h2
-rw-r--r--src/render/renderstates/qdepthtest_p.h2
-rw-r--r--src/render/renderstates/qdithering.h2
-rw-r--r--src/render/renderstates/qfrontface.h2
-rw-r--r--src/render/renderstates/qfrontface_p.h2
-rw-r--r--src/render/renderstates/qlinewidth.h2
-rw-r--r--src/render/renderstates/qmultisampleantialiasing.h2
-rw-r--r--src/render/renderstates/qnodepthmask.h2
-rw-r--r--src/render/renderstates/qpointsize.h2
-rw-r--r--src/render/renderstates/qpointsize_p.h2
-rw-r--r--src/render/renderstates/qpolygonoffset.h2
-rw-r--r--src/render/renderstates/qpolygonoffset_p.h2
-rw-r--r--src/render/renderstates/qrenderstate.h2
-rw-r--r--src/render/renderstates/qrenderstate_p.h2
-rw-r--r--src/render/renderstates/qscissortest.h2
-rw-r--r--src/render/renderstates/qscissortest_p.h2
-rw-r--r--src/render/renderstates/qseamlesscubemap.h2
-rw-r--r--src/render/renderstates/qstencilmask.h2
-rw-r--r--src/render/renderstates/qstencilmask_p.h2
-rw-r--r--src/render/renderstates/qstenciloperation.h2
-rw-r--r--src/render/renderstates/qstenciloperation_p.h2
-rw-r--r--src/render/renderstates/qstenciloperationarguments.h2
-rw-r--r--src/render/renderstates/qstenciloperationarguments_p.h2
-rw-r--r--src/render/renderstates/qstenciltest.h2
-rw-r--r--src/render/renderstates/qstenciltest_p.h2
-rw-r--r--src/render/renderstates/qstenciltestarguments.h2
-rw-r--r--src/render/renderstates/qstenciltestarguments_p.h2
-rw-r--r--src/render/texture/apitexturemanager_p.h14
-rw-r--r--src/render/texture/qabstracttexture.cpp114
-rw-r--r--src/render/texture/qabstracttexture.h16
-rw-r--r--src/render/texture/qabstracttexture_p.h8
-rw-r--r--src/render/texture/qabstracttextureimage.h2
-rw-r--r--src/render/texture/qabstracttextureimage_p.h2
-rw-r--r--src/render/texture/qpaintedtextureimage.h2
-rw-r--r--src/render/texture/qpaintedtextureimage_p.h2
-rw-r--r--src/render/texture/qtexture.cpp63
-rw-r--r--src/render/texture/qtexture.h41
-rw-r--r--src/render/texture/qtexture_p.h2
-rw-r--r--src/render/texture/qtexturedata.h2
-rw-r--r--src/render/texture/qtexturegenerator.h2
-rw-r--r--src/render/texture/qtextureimage.h2
-rw-r--r--src/render/texture/qtextureimage_p.h2
-rw-r--r--src/render/texture/qtextureimagedata.h2
-rw-r--r--src/render/texture/qtextureimagedatagenerator.h2
-rw-r--r--src/render/texture/qtexturewrapmode.h2
-rw-r--r--src/render/texture/texture.cpp61
-rw-r--r--src/render/texture/texture_p.h14
-rw-r--r--tests/auto/core/qentity/tst_qentity.cpp33
-rw-r--r--tests/auto/core/threadpooler/tst_threadpooler.cpp6
-rw-r--r--tests/auto/quick3d/3drender/3drender.qml4
-rw-r--r--tests/auto/render/attribute/tst_attribute.cpp4
-rw-r--r--tests/auto/render/blitframebuffer/tst_blitframebuffer.cpp14
-rw-r--r--tests/auto/render/boundingsphere/tst_boundingsphere.cpp2
-rw-r--r--tests/auto/render/buffer/tst_buffer.cpp6
-rw-r--r--tests/auto/render/commons/testrenderer.h1
-rw-r--r--tests/auto/render/computecommand/tst_computecommand.cpp75
-rw-r--r--tests/auto/render/entity/tst_entity.cpp186
-rw-r--r--tests/auto/render/geometry/tst_geometry.cpp28
-rw-r--r--tests/auto/render/gltfplugins/tst_gltfplugins.cpp24
-rw-r--r--tests/auto/render/graphicshelpergl2/tst_graphicshelpergl2.cpp39
-rw-r--r--tests/auto/render/graphicshelpergl3_2/tst_graphicshelpergl3_2.cpp104
-rw-r--r--tests/auto/render/graphicshelpergl3_3/tst_graphicshelpergl3_3.cpp104
-rw-r--r--tests/auto/render/graphicshelpergl4/tst_graphicshelpergl4.cpp106
-rw-r--r--tests/auto/render/layerfiltering/tst_layerfiltering.cpp1
-rw-r--r--tests/auto/render/memorybarrier/tst_memorybarrier.cpp4
-rw-r--r--tests/auto/render/objectpicker/tst_objectpicker.cpp36
-rw-r--r--tests/auto/render/pickboundingvolumejob/pickboundingvolumejob.qrc1
-rw-r--r--tests/auto/render/pickboundingvolumejob/testscene_priorityoverlapping.qml135
-rw-r--r--tests/auto/render/pickboundingvolumejob/tst_pickboundingvolumejob.cpp141
-rw-r--r--tests/auto/render/proximityfilter/tst_proximityfilter.cpp6
-rw-r--r--tests/auto/render/proximityfiltering/tst_proximityfiltering.cpp3
-rw-r--r--tests/auto/render/qabstracttexture/tst_qabstracttexture.cpp249
-rw-r--r--tests/auto/render/qbuffer/tst_qbuffer.cpp20
-rw-r--r--tests/auto/render/qcamera/tst_qcamera.cpp1
-rw-r--r--tests/auto/render/qcomputecommand/tst_qcomputecommand.cpp163
-rw-r--r--tests/auto/render/qgeometry/tst_qgeometry.cpp55
-rw-r--r--tests/auto/render/qobjectpicker/tst_qobjectpicker.cpp160
-rw-r--r--tests/auto/render/qsetfence/qsetfence.pro12
-rw-r--r--tests/auto/render/qsetfence/tst_qsetfence.cpp190
-rw-r--r--tests/auto/render/qshaderprogrambuilder/tst_qshaderprogrambuilder.cpp92
-rw-r--r--tests/auto/render/qsharedgltexture/qsharedgltexture.pro12
-rw-r--r--tests/auto/render/qsharedgltexture/tst_qsharedgltexture.cpp171
-rw-r--r--tests/auto/render/qwaitfence/qwaitfence.pro12
-rw-r--r--tests/auto/render/qwaitfence/tst_qwaitfence.cpp349
-rw-r--r--tests/auto/render/raycastingjob/tst_raycastingjob.cpp2
-rw-r--r--tests/auto/render/render.pro9
-rw-r--r--tests/auto/render/renderer/tst_renderer.cpp109
-rw-r--r--tests/auto/render/setfence/setfence.pro12
-rw-r--r--tests/auto/render/setfence/tst_setfence.cpp163
-rw-r--r--tests/auto/render/shaderbuilder/tst_shaderbuilder.cpp79
-rw-r--r--tests/auto/render/texture/tst_texture.cpp13
-rw-r--r--tests/auto/render/textures/tst_textures.cpp94
-rw-r--r--tests/auto/render/trianglesextractor/tst_trianglesextractor.cpp6
-rw-r--r--tests/auto/render/updateshaderdatatransformjob/tst_updateshaderdatatransformjob.cpp1
-rw-r--r--tests/auto/render/waitfence/tst_waitfence.cpp186
-rw-r--r--tests/auto/render/waitfence/waitfence.pro12
-rw-r--r--tests/manual/manual.pro6
-rw-r--r--tests/manual/sharedtexture/main.cpp159
-rw-r--r--tests/manual/sharedtexture/sharedtexture.pro12
-rw-r--r--tests/manual/sharedtexture/videoplayer.cpp233
-rw-r--r--tests/manual/sharedtexture/videoplayer.h122
-rw-r--r--tests/manual/sharedtextureqml/main.cpp131
-rw-r--r--tests/manual/sharedtextureqml/main.qml144
-rw-r--r--tests/manual/sharedtextureqml/qml.qrc5
-rw-r--r--tests/manual/sharedtextureqml/sharedtextureqml.pro17
-rw-r--r--tests/manual/texture_property_updates/main.cpp2
-rw-r--r--tests/manual/texture_property_updates/main.qml4
648 files changed, 9263 insertions, 1445 deletions
diff --git a/.qmake.conf b/.qmake.conf
index dbe097680..b1f6099df 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -3,4 +3,4 @@ QT3D_BUILD_ROOT = $$shadowed($$PWD)
load(qt_build_config)
-MODULE_VERSION = 5.12.5
+MODULE_VERSION = 5.13.1
diff --git a/dist/changes-5.13.0 b/dist/changes-5.13.0
new file mode 100644
index 000000000..2051540a8
--- /dev/null
+++ b/dist/changes-5.13.0
@@ -0,0 +1,26 @@
+Qt 5.13 introduces many new features and improvements as well as bugfixes
+over the 5.12.x series. For more details, refer to the online documentation
+included in this distribution. The documentation is also available online:
+
+https://doc.qt.io/qt-5/index.html
+
+The Qt version 5.13 series is binary compatible with the 5.12.x series.
+Applications compiled for 5.12 will continue to run with 5.13.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Qt3DRender *
+****************************************************************************
+
+ - [QTBUG-69918] Add QSharedGLTexture to allow creating a Qt3D from an
+ OpenGL texture id.
+ - [QTBUG-70055] QAbstractTexture: Expose raw texture handle and handleType
+ to share with 3rdparty engines.
+ - QObjectPicker: add a priority based result selection
diff --git a/examples/qt3d/instanced-arrays-qml/instancebuffer.cpp b/examples/qt3d/instanced-arrays-qml/instancebuffer.cpp
index bfe7fa951..770d1b425 100644
--- a/examples/qt3d/instanced-arrays-qml/instancebuffer.cpp
+++ b/examples/qt3d/instanced-arrays-qml/instancebuffer.cpp
@@ -57,7 +57,7 @@ static const int colCount = 20;
static const int maxInstanceCount = rowCount * colCount;
InstanceBuffer::InstanceBuffer(Qt3DCore::QNode *parent)
- : Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer, parent)
+ : Qt3DRender::QBuffer(parent)
, m_instanceCount(maxInstanceCount)
{
// Create some per instance data - position of each instance
diff --git a/src/animation/frontend/qabstractanimation.h b/src/animation/frontend/qabstractanimation.h
index 951e2dd2d..1d7459217 100644
--- a/src/animation/frontend/qabstractanimation.h
+++ b/src/animation/frontend/qabstractanimation.h
@@ -48,7 +48,7 @@ namespace Qt3DAnimation {
class QAbstractAnimationPrivate;
-class QT3DANIMATIONSHARED_EXPORT QAbstractAnimation : public QObject
+class Q_3DANIMATIONSHARED_EXPORT QAbstractAnimation : public QObject
{
Q_OBJECT
Q_PROPERTY(QString animationName READ animationName WRITE setAnimationName NOTIFY animationNameChanged)
diff --git a/src/animation/frontend/qabstractanimationclip.h b/src/animation/frontend/qabstractanimationclip.h
index 6190550e6..79464b13d 100644
--- a/src/animation/frontend/qabstractanimationclip.h
+++ b/src/animation/frontend/qabstractanimationclip.h
@@ -47,7 +47,7 @@ namespace Qt3DAnimation {
class QAbstractAnimationClipPrivate;
-class QT3DANIMATIONSHARED_EXPORT QAbstractAnimationClip : public Qt3DCore::QNode
+class Q_3DANIMATIONSHARED_EXPORT QAbstractAnimationClip : public Qt3DCore::QNode
{
Q_OBJECT
Q_PROPERTY(float duration READ duration NOTIFY durationChanged)
diff --git a/src/animation/frontend/qabstractchannelmapping.h b/src/animation/frontend/qabstractchannelmapping.h
index 564f51191..1fd451a2a 100644
--- a/src/animation/frontend/qabstractchannelmapping.h
+++ b/src/animation/frontend/qabstractchannelmapping.h
@@ -49,7 +49,7 @@ namespace Qt3DAnimation {
class QAbstractChannelMappingPrivate;
-class QT3DANIMATIONSHARED_EXPORT QAbstractChannelMapping : public Qt3DCore::QNode
+class Q_3DANIMATIONSHARED_EXPORT QAbstractChannelMapping : public Qt3DCore::QNode
{
Q_OBJECT
diff --git a/src/animation/frontend/qabstractclipanimator.h b/src/animation/frontend/qabstractclipanimator.h
index 08bf1f5dc..a3bce0600 100644
--- a/src/animation/frontend/qabstractclipanimator.h
+++ b/src/animation/frontend/qabstractclipanimator.h
@@ -52,7 +52,7 @@ class QChannelMapper;
class QClock;
class QAbstractClipAnimatorPrivate;
-class QT3DANIMATIONSHARED_EXPORT QAbstractClipAnimator : public Qt3DCore::QComponent
+class Q_3DANIMATIONSHARED_EXPORT QAbstractClipAnimator : public Qt3DCore::QComponent
{
Q_OBJECT
Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged)
diff --git a/src/animation/frontend/qabstractclipblendnode.h b/src/animation/frontend/qabstractclipblendnode.h
index d981bd7a5..3bc6d37d0 100644
--- a/src/animation/frontend/qabstractclipblendnode.h
+++ b/src/animation/frontend/qabstractclipblendnode.h
@@ -47,7 +47,7 @@ namespace Qt3DAnimation {
class QAbstractAnimationClip;
class QAbstractClipBlendNodePrivate;
-class QT3DANIMATIONSHARED_EXPORT QAbstractClipBlendNode : public Qt3DCore::QNode
+class Q_3DANIMATIONSHARED_EXPORT QAbstractClipBlendNode : public Qt3DCore::QNode
{
Q_OBJECT
public:
diff --git a/src/animation/frontend/qadditiveclipblend.h b/src/animation/frontend/qadditiveclipblend.h
index 0771bd032..70c5b3cea 100644
--- a/src/animation/frontend/qadditiveclipblend.h
+++ b/src/animation/frontend/qadditiveclipblend.h
@@ -45,7 +45,7 @@ namespace Qt3DAnimation {
class QAdditiveClipBlendPrivate;
-class QT3DANIMATIONSHARED_EXPORT QAdditiveClipBlend : public QAbstractClipBlendNode
+class Q_3DANIMATIONSHARED_EXPORT QAdditiveClipBlend : public QAbstractClipBlendNode
{
Q_OBJECT
Q_PROPERTY(Qt3DAnimation::QAbstractClipBlendNode *baseClip READ baseClip WRITE setBaseClip NOTIFY baseClipChanged)
diff --git a/src/animation/frontend/qanimationaspect.h b/src/animation/frontend/qanimationaspect.h
index bd3745fec..280c643e6 100644
--- a/src/animation/frontend/qanimationaspect.h
+++ b/src/animation/frontend/qanimationaspect.h
@@ -49,7 +49,7 @@ namespace Qt3DAnimation {
class QAnimationAspectPrivate;
-class QT3DANIMATIONSHARED_EXPORT QAnimationAspect : public Qt3DCore::QAbstractAspect
+class Q_3DANIMATIONSHARED_EXPORT QAnimationAspect : public Qt3DCore::QAbstractAspect
{
Q_OBJECT
public:
diff --git a/src/animation/frontend/qanimationcallback.h b/src/animation/frontend/qanimationcallback.h
index 1fcbd657c..f7abb4a29 100644
--- a/src/animation/frontend/qanimationcallback.h
+++ b/src/animation/frontend/qanimationcallback.h
@@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DAnimation {
-class QT3DANIMATIONSHARED_EXPORT QAnimationCallback
+class Q_3DANIMATIONSHARED_EXPORT QAnimationCallback
{
public:
enum Flag {
diff --git a/src/animation/frontend/qanimationclip.h b/src/animation/frontend/qanimationclip.h
index 4781641e0..cec758704 100644
--- a/src/animation/frontend/qanimationclip.h
+++ b/src/animation/frontend/qanimationclip.h
@@ -50,7 +50,7 @@ namespace Qt3DAnimation {
class QAnimationClipPrivate;
-class QT3DANIMATIONSHARED_EXPORT QAnimationClip : public QAbstractAnimationClip
+class Q_3DANIMATIONSHARED_EXPORT QAnimationClip : public QAbstractAnimationClip
{
Q_OBJECT
Q_PROPERTY(Qt3DAnimation::QAnimationClipData clipData READ clipData WRITE setClipData NOTIFY clipDataChanged)
diff --git a/src/animation/frontend/qanimationclipdata.h b/src/animation/frontend/qanimationclipdata.h
index 605b17208..d0e35527e 100644
--- a/src/animation/frontend/qanimationclipdata.h
+++ b/src/animation/frontend/qanimationclipdata.h
@@ -51,7 +51,7 @@ namespace Qt3DAnimation {
class QAnimationClipDataPrivate;
-class QT3DANIMATIONSHARED_EXPORT QAnimationClipData
+class Q_3DANIMATIONSHARED_EXPORT QAnimationClipData
{
public:
QAnimationClipData();
diff --git a/src/animation/frontend/qanimationcliploader.h b/src/animation/frontend/qanimationcliploader.h
index 2106d0f31..bf82f742e 100644
--- a/src/animation/frontend/qanimationcliploader.h
+++ b/src/animation/frontend/qanimationcliploader.h
@@ -47,7 +47,7 @@ namespace Qt3DAnimation {
class QAnimationClipLoaderPrivate;
-class QT3DANIMATIONSHARED_EXPORT QAnimationClipLoader : public QAbstractAnimationClip
+class Q_3DANIMATIONSHARED_EXPORT QAnimationClipLoader : public QAbstractAnimationClip
{
Q_OBJECT
Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
diff --git a/src/animation/frontend/qanimationcontroller.h b/src/animation/frontend/qanimationcontroller.h
index ae3272517..47f2e0edd 100644
--- a/src/animation/frontend/qanimationcontroller.h
+++ b/src/animation/frontend/qanimationcontroller.h
@@ -49,7 +49,7 @@ namespace Qt3DAnimation {
class QAnimationControllerPrivate;
-class QT3DANIMATIONSHARED_EXPORT QAnimationController : public QObject
+class Q_3DANIMATIONSHARED_EXPORT QAnimationController : public QObject
{
Q_OBJECT
Q_PROPERTY(int activeAnimationGroup READ activeAnimationGroup WRITE setActiveAnimationGroup NOTIFY activeAnimationGroupChanged)
diff --git a/src/animation/frontend/qanimationgroup.h b/src/animation/frontend/qanimationgroup.h
index a4f34c815..dd18edafc 100644
--- a/src/animation/frontend/qanimationgroup.h
+++ b/src/animation/frontend/qanimationgroup.h
@@ -49,7 +49,7 @@ namespace Qt3DAnimation {
class QAnimationGroupPrivate;
-class QT3DANIMATIONSHARED_EXPORT QAnimationGroup : public QObject
+class Q_3DANIMATIONSHARED_EXPORT QAnimationGroup : public QObject
{
Q_OBJECT
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
diff --git a/src/animation/frontend/qblendedclipanimator.h b/src/animation/frontend/qblendedclipanimator.h
index 064a83dc7..f4463802f 100644
--- a/src/animation/frontend/qblendedclipanimator.h
+++ b/src/animation/frontend/qblendedclipanimator.h
@@ -50,7 +50,7 @@ namespace Qt3DAnimation {
class QAbstractClipBlendNode;
class QBlendedClipAnimatorPrivate;
-class QT3DANIMATIONSHARED_EXPORT QBlendedClipAnimator : public Qt3DAnimation::QAbstractClipAnimator
+class Q_3DANIMATIONSHARED_EXPORT QBlendedClipAnimator : public Qt3DAnimation::QAbstractClipAnimator
{
Q_OBJECT
Q_PROPERTY(Qt3DAnimation::QAbstractClipBlendNode *blendTree READ blendTree WRITE setBlendTree NOTIFY blendTreeChanged)
diff --git a/src/animation/frontend/qcallbackmapping.h b/src/animation/frontend/qcallbackmapping.h
index c52e284ff..b98a3b430 100644
--- a/src/animation/frontend/qcallbackmapping.h
+++ b/src/animation/frontend/qcallbackmapping.h
@@ -47,7 +47,7 @@ namespace Qt3DAnimation {
class QCallbackMappingPrivate;
-class QT3DANIMATIONSHARED_EXPORT QCallbackMapping : public QAbstractChannelMapping
+class Q_3DANIMATIONSHARED_EXPORT QCallbackMapping : public QAbstractChannelMapping
{
Q_OBJECT
Q_PROPERTY(QString channelName READ channelName WRITE setChannelName NOTIFY channelNameChanged)
diff --git a/src/animation/frontend/qchannel.h b/src/animation/frontend/qchannel.h
index 50e574756..4c856dba5 100644
--- a/src/animation/frontend/qchannel.h
+++ b/src/animation/frontend/qchannel.h
@@ -51,7 +51,7 @@ namespace Qt3DAnimation {
class QChannelPrivate;
-class QT3DANIMATIONSHARED_EXPORT QChannel
+class Q_3DANIMATIONSHARED_EXPORT QChannel
{
public:
QChannel();
diff --git a/src/animation/frontend/qchannelcomponent.h b/src/animation/frontend/qchannelcomponent.h
index 922073a85..aa29d7fd5 100644
--- a/src/animation/frontend/qchannelcomponent.h
+++ b/src/animation/frontend/qchannelcomponent.h
@@ -51,7 +51,7 @@ namespace Qt3DAnimation {
class QChannelComponentPrivate;
-class QT3DANIMATIONSHARED_EXPORT QChannelComponent
+class Q_3DANIMATIONSHARED_EXPORT QChannelComponent
{
public:
QChannelComponent();
diff --git a/src/animation/frontend/qchannelmapper.h b/src/animation/frontend/qchannelmapper.h
index a14fbcdd4..cb5532265 100644
--- a/src/animation/frontend/qchannelmapper.h
+++ b/src/animation/frontend/qchannelmapper.h
@@ -47,7 +47,7 @@ namespace Qt3DAnimation {
class QChannelMapperPrivate;
class QAbstractChannelMapping;
-class QT3DANIMATIONSHARED_EXPORT QChannelMapper : public Qt3DCore::QNode
+class Q_3DANIMATIONSHARED_EXPORT QChannelMapper : public Qt3DCore::QNode
{
Q_OBJECT
diff --git a/src/animation/frontend/qchannelmapping.h b/src/animation/frontend/qchannelmapping.h
index 776a2f846..e88e6daa9 100644
--- a/src/animation/frontend/qchannelmapping.h
+++ b/src/animation/frontend/qchannelmapping.h
@@ -47,7 +47,7 @@ namespace Qt3DAnimation {
class QChannelMappingPrivate;
-class QT3DANIMATIONSHARED_EXPORT QChannelMapping : public QAbstractChannelMapping
+class Q_3DANIMATIONSHARED_EXPORT QChannelMapping : public QAbstractChannelMapping
{
Q_OBJECT
Q_PROPERTY(QString channelName READ channelName WRITE setChannelName NOTIFY channelNameChanged)
diff --git a/src/animation/frontend/qchannelmappingcreatedchange_p.h b/src/animation/frontend/qchannelmappingcreatedchange_p.h
index b01a97acc..527ab524a 100644
--- a/src/animation/frontend/qchannelmappingcreatedchange_p.h
+++ b/src/animation/frontend/qchannelmappingcreatedchange_p.h
@@ -58,7 +58,7 @@ namespace Qt3DAnimation {
class QChannelMappingCreatedChangeBasePrivate;
-class QT3DANIMATIONSHARED_PRIVATE_EXPORT QChannelMappingCreatedChangeBase : public Qt3DCore::QNodeCreatedChangeBase
+class Q_3DANIMATIONSHARED_PRIVATE_EXPORT QChannelMappingCreatedChangeBase : public Qt3DCore::QNodeCreatedChangeBase
{
public:
explicit QChannelMappingCreatedChangeBase(const QAbstractChannelMapping *mapping);
diff --git a/src/animation/frontend/qclipanimator.h b/src/animation/frontend/qclipanimator.h
index 72f1ba95f..bc77b20ff 100644
--- a/src/animation/frontend/qclipanimator.h
+++ b/src/animation/frontend/qclipanimator.h
@@ -51,7 +51,7 @@ class QAbstractAnimationClip;
class QChannelMapper;
class QClipAnimatorPrivate;
-class QT3DANIMATIONSHARED_EXPORT QClipAnimator : public Qt3DAnimation::QAbstractClipAnimator
+class Q_3DANIMATIONSHARED_EXPORT QClipAnimator : public Qt3DAnimation::QAbstractClipAnimator
{
Q_OBJECT
Q_PROPERTY(Qt3DAnimation::QAbstractAnimationClip *clip READ clip WRITE setClip NOTIFY clipChanged)
diff --git a/src/animation/frontend/qclipblendnodecreatedchange.h b/src/animation/frontend/qclipblendnodecreatedchange.h
index 01f17d7ca..094e8128e 100644
--- a/src/animation/frontend/qclipblendnodecreatedchange.h
+++ b/src/animation/frontend/qclipblendnodecreatedchange.h
@@ -47,7 +47,7 @@ namespace Qt3DAnimation {
class QAbstractClipBlendNode;
class QClipBlendNodeCreatedChangeBasePrivate;
-class QT3DANIMATIONSHARED_EXPORT QClipBlendNodeCreatedChangeBase : public Qt3DCore::QNodeCreatedChangeBase
+class Q_3DANIMATIONSHARED_EXPORT QClipBlendNodeCreatedChangeBase : public Qt3DCore::QNodeCreatedChangeBase
{
public:
explicit QClipBlendNodeCreatedChangeBase(const QAbstractClipBlendNode *node);
diff --git a/src/animation/frontend/qclipblendvalue.h b/src/animation/frontend/qclipblendvalue.h
index 65ac0eb6c..b97fc6e58 100644
--- a/src/animation/frontend/qclipblendvalue.h
+++ b/src/animation/frontend/qclipblendvalue.h
@@ -49,7 +49,7 @@ namespace Qt3DAnimation {
class QClipBlendValuePrivate;
-class QT3DANIMATIONSHARED_EXPORT QClipBlendValue : public Qt3DAnimation::QAbstractClipBlendNode
+class Q_3DANIMATIONSHARED_EXPORT QClipBlendValue : public Qt3DAnimation::QAbstractClipBlendNode
{
Q_OBJECT
Q_PROPERTY(Qt3DAnimation::QAbstractAnimationClip *clip READ clip WRITE setClip NOTIFY clipChanged)
diff --git a/src/animation/frontend/qclock.h b/src/animation/frontend/qclock.h
index ea0f294d2..8475f2831 100644
--- a/src/animation/frontend/qclock.h
+++ b/src/animation/frontend/qclock.h
@@ -46,7 +46,7 @@ namespace Qt3DAnimation {
class QClockPrivate;
-class QT3DANIMATIONSHARED_EXPORT QClock : public Qt3DCore::QNode
+class Q_3DANIMATIONSHARED_EXPORT QClock : public Qt3DCore::QNode
{
Q_OBJECT
Q_PROPERTY(double playbackRate READ playbackRate WRITE setPlaybackRate NOTIFY playbackRateChanged)
diff --git a/src/animation/frontend/qkeyframe.h b/src/animation/frontend/qkeyframe.h
index 7eabbeb17..87e2812b2 100644
--- a/src/animation/frontend/qkeyframe.h
+++ b/src/animation/frontend/qkeyframe.h
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DAnimation {
-class QT3DANIMATIONSHARED_EXPORT QKeyFrame
+class Q_3DANIMATIONSHARED_EXPORT QKeyFrame
{
public:
enum InterpolationType : quint8 {
diff --git a/src/animation/frontend/qkeyframeanimation.h b/src/animation/frontend/qkeyframeanimation.h
index efc132cdd..0aed76cfb 100644
--- a/src/animation/frontend/qkeyframeanimation.h
+++ b/src/animation/frontend/qkeyframeanimation.h
@@ -50,7 +50,7 @@ namespace Qt3DAnimation {
class QKeyframeAnimationPrivate;
-class QT3DANIMATIONSHARED_EXPORT QKeyframeAnimation : public QAbstractAnimation
+class Q_3DANIMATIONSHARED_EXPORT QKeyframeAnimation : public QAbstractAnimation
{
Q_OBJECT
Q_PROPERTY(QVector<float> framePositions READ framePositions WRITE setFramePositions NOTIFY framePositionsChanged)
diff --git a/src/animation/frontend/qlerpclipblend.h b/src/animation/frontend/qlerpclipblend.h
index 225b52e53..6511d1c37 100644
--- a/src/animation/frontend/qlerpclipblend.h
+++ b/src/animation/frontend/qlerpclipblend.h
@@ -45,7 +45,7 @@ namespace Qt3DAnimation {
class QLerpClipBlendPrivate;
-class QT3DANIMATIONSHARED_EXPORT QLerpClipBlend : public QAbstractClipBlendNode
+class Q_3DANIMATIONSHARED_EXPORT QLerpClipBlend : public QAbstractClipBlendNode
{
Q_OBJECT
Q_PROPERTY(Qt3DAnimation::QAbstractClipBlendNode *startClip READ startClip WRITE setStartClip NOTIFY startClipChanged)
diff --git a/src/animation/frontend/qmorphinganimation.h b/src/animation/frontend/qmorphinganimation.h
index 09d0054c8..1a9a60695 100644
--- a/src/animation/frontend/qmorphinganimation.h
+++ b/src/animation/frontend/qmorphinganimation.h
@@ -51,7 +51,7 @@ namespace Qt3DAnimation {
class QMorphingAnimationPrivate;
-class QT3DANIMATIONSHARED_EXPORT QMorphingAnimation : public QAbstractAnimation
+class Q_3DANIMATIONSHARED_EXPORT QMorphingAnimation : public QAbstractAnimation
{
Q_OBJECT
Q_PROPERTY(QVector<float> targetPositions READ targetPositions WRITE setTargetPositions NOTIFY targetPositionsChanged)
diff --git a/src/animation/frontend/qmorphtarget.h b/src/animation/frontend/qmorphtarget.h
index 0435924e1..ec9761c64 100644
--- a/src/animation/frontend/qmorphtarget.h
+++ b/src/animation/frontend/qmorphtarget.h
@@ -50,7 +50,7 @@ namespace Qt3DAnimation {
class QMorphTargetPrivate;
-class QT3DANIMATIONSHARED_EXPORT QMorphTarget : public QObject
+class Q_3DANIMATIONSHARED_EXPORT QMorphTarget : public QObject
{
Q_OBJECT
Q_PROPERTY(QStringList attributeNames READ attributeNames NOTIFY attributeNamesChanged)
diff --git a/src/animation/frontend/qskeletonmapping.h b/src/animation/frontend/qskeletonmapping.h
index 2c698da8e..275fce818 100644
--- a/src/animation/frontend/qskeletonmapping.h
+++ b/src/animation/frontend/qskeletonmapping.h
@@ -53,7 +53,7 @@ namespace Qt3DAnimation {
class QSkeletonMappingPrivate;
-class QT3DANIMATIONSHARED_EXPORT QSkeletonMapping : public QAbstractChannelMapping
+class Q_3DANIMATIONSHARED_EXPORT QSkeletonMapping : public QAbstractChannelMapping
{
Q_OBJECT
Q_PROPERTY(Qt3DCore::QAbstractSkeleton* skeleton READ skeleton WRITE setSkeleton NOTIFY skeletonChanged)
diff --git a/src/animation/frontend/qvertexblendanimation.h b/src/animation/frontend/qvertexblendanimation.h
index a7da2bcda..1be721ce4 100644
--- a/src/animation/frontend/qvertexblendanimation.h
+++ b/src/animation/frontend/qvertexblendanimation.h
@@ -49,7 +49,7 @@ namespace Qt3DAnimation {
class QVertexBlendAnimationPrivate;
-class QT3DANIMATIONSHARED_EXPORT QVertexBlendAnimation : public QAbstractAnimation
+class Q_3DANIMATIONSHARED_EXPORT QVertexBlendAnimation : public QAbstractAnimation
{
Q_OBJECT
Q_PROPERTY(QVector<float> targetPositions READ targetPositions WRITE setTargetPositions NOTIFY targetPositionsChanged)
diff --git a/src/animation/qt3danimation_global.h b/src/animation/qt3danimation_global.h
index 6b66e7ec9..b6dd15161 100644
--- a/src/animation/qt3danimation_global.h
+++ b/src/animation/qt3danimation_global.h
@@ -46,12 +46,12 @@ QT_BEGIN_NAMESPACE
#if defined(QT_SHARED) || !defined(QT_STATIC)
# if defined(QT_BUILD_3DANIMATION_LIB)
-# define QT3DANIMATIONSHARED_EXPORT Q_DECL_EXPORT
+# define Q_3DANIMATIONSHARED_EXPORT Q_DECL_EXPORT
# else
-# define QT3DANIMATIONSHARED_EXPORT Q_DECL_IMPORT
+# define Q_3DANIMATIONSHARED_EXPORT Q_DECL_IMPORT
# endif
#else
-# define QT3DANIMATIONSHARED_EXPORT
+# define Q_3DANIMATIONSHARED_EXPORT
#endif
QT_END_NAMESPACE
diff --git a/src/animation/qt3danimation_global_p.h b/src/animation/qt3danimation_global_p.h
index e184222b5..ce1b99b9c 100644
--- a/src/animation/qt3danimation_global_p.h
+++ b/src/animation/qt3danimation_global_p.h
@@ -53,7 +53,7 @@
#include "qt3danimation_global.h"
-#define QT3DANIMATIONSHARED_PRIVATE_EXPORT QT3DANIMATIONSHARED_EXPORT
+#define Q_3DANIMATIONSHARED_PRIVATE_EXPORT Q_3DANIMATIONSHARED_EXPORT
#endif // QT3DANIMATION_GLOBAL_P_H
diff --git a/src/core/aspects/qabstractaspect.h b/src/core/aspects/qabstractaspect.h
index 8ac1b251f..1ae85e4e6 100644
--- a/src/core/aspects/qabstractaspect.h
+++ b/src/core/aspects/qabstractaspect.h
@@ -60,7 +60,7 @@ class QBackendNodeMapper;
typedef QSharedPointer<QAspectJob> QAspectJobPtr;
typedef QSharedPointer<QBackendNodeMapper> QBackendNodeMapperPtr;
-class QT3DCORESHARED_EXPORT QAbstractAspect : public QObject
+class Q_3DCORESHARED_EXPORT QAbstractAspect : public QObject
{
Q_OBJECT
@@ -118,8 +118,8 @@ QT_END_NAMESPACE
QT_BEGIN_NAMESPACE \
namespace Qt3DCore { \
typedef QAbstractAspect *(*AspectCreateFunction)(QObject *); \
- QT_DEPRECATED QT3DCORESHARED_EXPORT void qt3d_QAspectFactory_addDefaultFactory(const QString &, const QMetaObject *, AspectCreateFunction); \
- QT3DCORESHARED_EXPORT void qt3d_QAspectFactory_addDefaultFactory(const QLatin1String &, const QMetaObject *, AspectCreateFunction); \
+ QT_DEPRECATED Q_3DCORESHARED_EXPORT void qt3d_QAspectFactory_addDefaultFactory(const QString &, const QMetaObject *, AspectCreateFunction); \
+ Q_3DCORESHARED_EXPORT void qt3d_QAspectFactory_addDefaultFactory(const QLatin1String &, const QMetaObject *, AspectCreateFunction); \
} \
QT_END_NAMESPACE \
namespace { \
diff --git a/src/core/aspects/qabstractaspect_p.h b/src/core/aspects/qabstractaspect_p.h
index 6b0490d91..e743dc63a 100644
--- a/src/core/aspects/qabstractaspect_p.h
+++ b/src/core/aspects/qabstractaspect_p.h
@@ -78,7 +78,7 @@ class QServiceLocator;
namespace Debug {
-class QT3DCORE_PRIVATE_EXPORT AsynchronousCommandReply : public QObject
+class Q_3DCORE_PRIVATE_EXPORT AsynchronousCommandReply : public QObject
{
Q_OBJECT
public:
@@ -102,7 +102,7 @@ private:
} // Debug
-class QT3DCORE_PRIVATE_EXPORT QAbstractAspectPrivate
+class Q_3DCORE_PRIVATE_EXPORT QAbstractAspectPrivate
: public QObjectPrivate
, public QBackendNodeFactory
, public QSceneObserverInterface
diff --git a/src/core/aspects/qaspectengine.h b/src/core/aspects/qaspectengine.h
index 28b15046b..7f900ad52 100644
--- a/src/core/aspects/qaspectengine.h
+++ b/src/core/aspects/qaspectengine.h
@@ -56,7 +56,7 @@ class QNode;
typedef QSharedPointer<QEntity> QEntityPtr;
-class QT3DCORESHARED_EXPORT QAspectEngine : public QObject
+class Q_3DCORESHARED_EXPORT QAspectEngine : public QObject
{
Q_OBJECT
public:
diff --git a/src/core/aspects/qaspectengine_p.h b/src/core/aspects/qaspectengine_p.h
index 6b0aae9cb..2d7d0fe93 100644
--- a/src/core/aspects/qaspectengine_p.h
+++ b/src/core/aspects/qaspectengine_p.h
@@ -75,7 +75,7 @@ class AspectCommandDebugger;
} // Debug
#endif
-class QT3DCORE_PRIVATE_EXPORT QAspectEnginePrivate : public QObjectPrivate
+class Q_3DCORE_PRIVATE_EXPORT QAspectEnginePrivate : public QObjectPrivate
{
public:
QAspectEnginePrivate();
diff --git a/src/core/aspects/qaspectfactory.cpp b/src/core/aspects/qaspectfactory.cpp
index 94e04b34d..2f1530257 100644
--- a/src/core/aspects/qaspectfactory.cpp
+++ b/src/core/aspects/qaspectfactory.cpp
@@ -52,7 +52,7 @@ Q_GLOBAL_STATIC(defaultFactories_t, defaultFactories)
typedef QHash<const QMetaObject*, QLatin1String> defaultAspectNames_t;
Q_GLOBAL_STATIC(defaultAspectNames_t, defaultAspectNames)
-QT3DCORESHARED_EXPORT void qt3d_QAspectFactory_addDefaultFactory(const QLatin1String &name,
+Q_3DCORESHARED_EXPORT void qt3d_QAspectFactory_addDefaultFactory(const QLatin1String &name,
const QMetaObject *metaObject,
QAspectFactory::CreateFunction factory)
{
@@ -60,7 +60,7 @@ QT3DCORESHARED_EXPORT void qt3d_QAspectFactory_addDefaultFactory(const QLatin1St
defaultAspectNames->insert(metaObject, name);
}
-QT3DCORESHARED_EXPORT void qt3d_QAspectFactory_addDefaultFactory(const QString &name,
+Q_3DCORESHARED_EXPORT void qt3d_QAspectFactory_addDefaultFactory(const QString &name,
const QMetaObject *metaObject,
QAspectFactory::CreateFunction factory)
{
diff --git a/src/core/aspects/qaspectfactory_p.h b/src/core/aspects/qaspectfactory_p.h
index 67b5e0b9d..41a063900 100644
--- a/src/core/aspects/qaspectfactory_p.h
+++ b/src/core/aspects/qaspectfactory_p.h
@@ -65,7 +65,7 @@ namespace Qt3DCore {
class QAbstractAspect;
-class QT3DCORE_PRIVATE_EXPORT QAspectFactory
+class Q_3DCORE_PRIVATE_EXPORT QAspectFactory
{
public:
typedef QAbstractAspect *(*CreateFunction)(QObject *);
diff --git a/src/core/aspects/qaspectmanager_p.h b/src/core/aspects/qaspectmanager_p.h
index 0a703a776..de978b8e9 100644
--- a/src/core/aspects/qaspectmanager_p.h
+++ b/src/core/aspects/qaspectmanager_p.h
@@ -75,7 +75,7 @@ class QAbstractAspectJobManager;
class QSceneObserverInterface;
class QServiceLocator;
-class QT3DCORE_PRIVATE_EXPORT QAspectManager : public QObject
+class Q_3DCORE_PRIVATE_EXPORT QAspectManager : public QObject
{
Q_OBJECT
public:
diff --git a/src/core/changes/qcomponentaddedchange.h b/src/core/changes/qcomponentaddedchange.h
index e7676a026..ef2f6a227 100644
--- a/src/core/changes/qcomponentaddedchange.h
+++ b/src/core/changes/qcomponentaddedchange.h
@@ -50,7 +50,7 @@ class QComponent;
class QEntity;
class QComponentAddedChangePrivate;
-class QT3DCORESHARED_EXPORT QComponentAddedChange : public QSceneChange
+class Q_3DCORESHARED_EXPORT QComponentAddedChange : public QSceneChange
{
public:
explicit QComponentAddedChange(const QEntity *entity,
diff --git a/src/core/changes/qcomponentaddedchange_p.h b/src/core/changes/qcomponentaddedchange_p.h
index 5eb453363..2a600288d 100644
--- a/src/core/changes/qcomponentaddedchange_p.h
+++ b/src/core/changes/qcomponentaddedchange_p.h
@@ -65,7 +65,7 @@ namespace Qt3DCore {
class QComponent;
class QEntity;
-class QT3DCORE_PRIVATE_EXPORT QComponentAddedChangePrivate : public QSceneChangePrivate
+class Q_3DCORE_PRIVATE_EXPORT QComponentAddedChangePrivate : public QSceneChangePrivate
{
public:
QComponentAddedChangePrivate(const QEntity *entity, const QComponent *component);
diff --git a/src/core/changes/qcomponentremovedchange.h b/src/core/changes/qcomponentremovedchange.h
index 66743b1ae..8108b33d5 100644
--- a/src/core/changes/qcomponentremovedchange.h
+++ b/src/core/changes/qcomponentremovedchange.h
@@ -50,7 +50,7 @@ class QComponent;
class QEntity;
class QComponentRemovedChangePrivate;
-class QT3DCORESHARED_EXPORT QComponentRemovedChange : public QSceneChange
+class Q_3DCORESHARED_EXPORT QComponentRemovedChange : public QSceneChange
{
public:
explicit QComponentRemovedChange(const QEntity *entity,
diff --git a/src/core/changes/qcomponentremovedchange_p.h b/src/core/changes/qcomponentremovedchange_p.h
index 5284c7bbd..fe84da252 100644
--- a/src/core/changes/qcomponentremovedchange_p.h
+++ b/src/core/changes/qcomponentremovedchange_p.h
@@ -65,7 +65,7 @@ namespace Qt3DCore {
class QComponent;
class QEntity;
-class QT3DCORE_PRIVATE_EXPORT QComponentRemovedChangePrivate : public QSceneChangePrivate
+class Q_3DCORE_PRIVATE_EXPORT QComponentRemovedChangePrivate : public QSceneChangePrivate
{
public:
QComponentRemovedChangePrivate(const QEntity *entity, const QComponent *component);
diff --git a/src/core/changes/qdynamicpropertyupdatedchange.h b/src/core/changes/qdynamicpropertyupdatedchange.h
index 2eee6d6d6..0509582b0 100644
--- a/src/core/changes/qdynamicpropertyupdatedchange.h
+++ b/src/core/changes/qdynamicpropertyupdatedchange.h
@@ -48,7 +48,7 @@ namespace Qt3DCore {
class QDynamicPropertyUpdatedChangePrivate;
-class QT3DCORESHARED_EXPORT QDynamicPropertyUpdatedChange : public QPropertyUpdatedChangeBase
+class Q_3DCORESHARED_EXPORT QDynamicPropertyUpdatedChange : public QPropertyUpdatedChangeBase
{
public:
explicit QDynamicPropertyUpdatedChange(QNodeId subjectId);
diff --git a/src/core/changes/qdynamicpropertyupdatedchange_p.h b/src/core/changes/qdynamicpropertyupdatedchange_p.h
index c71c2a71a..233d55c8e 100644
--- a/src/core/changes/qdynamicpropertyupdatedchange_p.h
+++ b/src/core/changes/qdynamicpropertyupdatedchange_p.h
@@ -63,7 +63,7 @@ namespace Qt3DCore {
class QPropertyUpdatedChange;
class QFrameAllocator;
-class QT3DCORE_PRIVATE_EXPORT QDynamicPropertyUpdatedChangePrivate : public QPropertyUpdatedChangeBasePrivate
+class Q_3DCORE_PRIVATE_EXPORT QDynamicPropertyUpdatedChangePrivate : public QPropertyUpdatedChangeBasePrivate
{
public:
QDynamicPropertyUpdatedChangePrivate();
diff --git a/src/core/changes/qnodecommand.h b/src/core/changes/qnodecommand.h
index f4371b03c..3622f7421 100644
--- a/src/core/changes/qnodecommand.h
+++ b/src/core/changes/qnodecommand.h
@@ -48,7 +48,7 @@ namespace Qt3DCore {
class QNodeCommandPrivate;
-class QT3DCORESHARED_EXPORT QNodeCommand : public QSceneChange
+class Q_3DCORESHARED_EXPORT QNodeCommand : public QSceneChange
{
public:
#if defined(Q_ATOMIC_INT64_IS_SUPPORTED)
diff --git a/src/core/changes/qnodecommand_p.h b/src/core/changes/qnodecommand_p.h
index dd4259b20..e89dbe1a9 100644
--- a/src/core/changes/qnodecommand_p.h
+++ b/src/core/changes/qnodecommand_p.h
@@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DCore {
-class QT3DCORE_PRIVATE_EXPORT QNodeCommandPrivate : public QSceneChangePrivate
+class Q_3DCORE_PRIVATE_EXPORT QNodeCommandPrivate : public QSceneChangePrivate
{
public:
QNodeCommandPrivate();
diff --git a/src/core/changes/qnodecreatedchange.h b/src/core/changes/qnodecreatedchange.h
index 85444e00c..f46e8abee 100644
--- a/src/core/changes/qnodecreatedchange.h
+++ b/src/core/changes/qnodecreatedchange.h
@@ -48,7 +48,7 @@ namespace Qt3DCore {
class QNode;
class QNodeCreatedChangeBasePrivate;
-class QT3DCORESHARED_EXPORT QNodeCreatedChangeBase : public QSceneChange
+class Q_3DCORESHARED_EXPORT QNodeCreatedChangeBase : public QSceneChange
{
public:
explicit QNodeCreatedChangeBase(const QNode *node);
diff --git a/src/core/changes/qnodecreatedchange_p.h b/src/core/changes/qnodecreatedchange_p.h
index 5e4c5b91d..153ccc0e8 100644
--- a/src/core/changes/qnodecreatedchange_p.h
+++ b/src/core/changes/qnodecreatedchange_p.h
@@ -61,7 +61,7 @@ namespace Qt3DCore {
class QNode;
-class QT3DCORE_PRIVATE_EXPORT QNodeCreatedChangeBasePrivate : public QSceneChangePrivate
+class Q_3DCORE_PRIVATE_EXPORT QNodeCreatedChangeBasePrivate : public QSceneChangePrivate
{
public:
QNodeCreatedChangeBasePrivate(const QNode *node);
diff --git a/src/core/changes/qnodedestroyedchange.h b/src/core/changes/qnodedestroyedchange.h
index 11a54f8e2..c072dd412 100644
--- a/src/core/changes/qnodedestroyedchange.h
+++ b/src/core/changes/qnodedestroyedchange.h
@@ -47,7 +47,7 @@ namespace Qt3DCore {
class QNodeDestroyedChangePrivate;
-class QT3DCORESHARED_EXPORT QNodeDestroyedChange : public QSceneChange
+class Q_3DCORESHARED_EXPORT QNodeDestroyedChange : public QSceneChange
{
public:
explicit QNodeDestroyedChange(const QNode *node, const QVector<QNodeIdTypePair> &subtreeIdsAndTypes);
diff --git a/src/core/changes/qpropertynodeaddedchange.h b/src/core/changes/qpropertynodeaddedchange.h
index a816f711c..ce3288a65 100644
--- a/src/core/changes/qpropertynodeaddedchange.h
+++ b/src/core/changes/qpropertynodeaddedchange.h
@@ -50,7 +50,7 @@ namespace Qt3DCore {
class QPropertyNodeAddedChangePrivate;
-class QT3DCORESHARED_EXPORT QPropertyNodeAddedChange : public QStaticPropertyValueAddedChangeBase
+class Q_3DCORESHARED_EXPORT QPropertyNodeAddedChange : public QStaticPropertyValueAddedChangeBase
{
public:
explicit QPropertyNodeAddedChange(QNodeId subjectId, QNode *node);
diff --git a/src/core/changes/qpropertynoderemovedchange.h b/src/core/changes/qpropertynoderemovedchange.h
index d97bec6e6..1a4db8f1c 100644
--- a/src/core/changes/qpropertynoderemovedchange.h
+++ b/src/core/changes/qpropertynoderemovedchange.h
@@ -50,7 +50,7 @@ namespace Qt3DCore {
class QPropertyNodeRemovedChangePrivate;
-class QT3DCORESHARED_EXPORT QPropertyNodeRemovedChange : public QStaticPropertyValueRemovedChangeBase
+class Q_3DCORESHARED_EXPORT QPropertyNodeRemovedChange : public QStaticPropertyValueRemovedChangeBase
{
public:
explicit QPropertyNodeRemovedChange(QNodeId subjectId, QNode *node);
diff --git a/src/core/changes/qpropertyupdatedchange.h b/src/core/changes/qpropertyupdatedchange.h
index acec44694..e0c12f13d 100644
--- a/src/core/changes/qpropertyupdatedchange.h
+++ b/src/core/changes/qpropertyupdatedchange.h
@@ -48,7 +48,7 @@ namespace Qt3DCore {
class QPropertyUpdatedChangePrivate;
-class QT3DCORESHARED_EXPORT QPropertyUpdatedChange : public QStaticPropertyUpdatedChangeBase
+class Q_3DCORESHARED_EXPORT QPropertyUpdatedChange : public QStaticPropertyUpdatedChangeBase
{
public:
explicit QPropertyUpdatedChange(QNodeId subjectId);
diff --git a/src/core/changes/qpropertyupdatedchangebase.h b/src/core/changes/qpropertyupdatedchangebase.h
index 1abbd899a..800abb477 100644
--- a/src/core/changes/qpropertyupdatedchangebase.h
+++ b/src/core/changes/qpropertyupdatedchangebase.h
@@ -50,7 +50,7 @@ namespace Qt3DCore {
class QPropertyUpdatedChangeBasePrivate;
-class QT3DCORESHARED_EXPORT QPropertyUpdatedChangeBase : public QSceneChange
+class Q_3DCORESHARED_EXPORT QPropertyUpdatedChangeBase : public QSceneChange
{
public:
~QPropertyUpdatedChangeBase();
diff --git a/src/core/changes/qpropertyupdatedchangebase_p.h b/src/core/changes/qpropertyupdatedchangebase_p.h
index 7c66812a1..6dd7186f2 100644
--- a/src/core/changes/qpropertyupdatedchangebase_p.h
+++ b/src/core/changes/qpropertyupdatedchangebase_p.h
@@ -60,7 +60,7 @@ namespace Qt3DCore {
class QPropertyUpdatedChangeBase;
-class QT3DCORE_PRIVATE_EXPORT QPropertyUpdatedChangeBasePrivate : public QSceneChangePrivate
+class Q_3DCORE_PRIVATE_EXPORT QPropertyUpdatedChangeBasePrivate : public QSceneChangePrivate
{
public:
QPropertyUpdatedChangeBasePrivate();
diff --git a/src/core/changes/qpropertyvalueaddedchange.h b/src/core/changes/qpropertyvalueaddedchange.h
index 80b41c9f8..d85720246 100644
--- a/src/core/changes/qpropertyvalueaddedchange.h
+++ b/src/core/changes/qpropertyvalueaddedchange.h
@@ -50,7 +50,7 @@ namespace Qt3DCore {
class QPropertyValueAddedChangePrivate;
-class QT3DCORESHARED_EXPORT QPropertyValueAddedChange : public QStaticPropertyValueAddedChangeBase
+class Q_3DCORESHARED_EXPORT QPropertyValueAddedChange : public QStaticPropertyValueAddedChangeBase
{
public:
explicit QPropertyValueAddedChange(QNodeId subjectId);
diff --git a/src/core/changes/qpropertyvalueaddedchange_p.h b/src/core/changes/qpropertyvalueaddedchange_p.h
index edd59489f..3f7ea33fe 100644
--- a/src/core/changes/qpropertyvalueaddedchange_p.h
+++ b/src/core/changes/qpropertyvalueaddedchange_p.h
@@ -62,7 +62,7 @@ namespace Qt3DCore {
class QPropertyValueAddedChange;
-class QT3DCORE_PRIVATE_EXPORT QPropertyValueAddedChangePrivate : public QStaticPropertyValueAddedChangeBasePrivate
+class Q_3DCORE_PRIVATE_EXPORT QPropertyValueAddedChangePrivate : public QStaticPropertyValueAddedChangeBasePrivate
{
public:
QPropertyValueAddedChangePrivate();
diff --git a/src/core/changes/qpropertyvalueaddedchangebase.h b/src/core/changes/qpropertyvalueaddedchangebase.h
index 2ac449667..2be39ad47 100644
--- a/src/core/changes/qpropertyvalueaddedchangebase.h
+++ b/src/core/changes/qpropertyvalueaddedchangebase.h
@@ -50,7 +50,7 @@ namespace Qt3DCore {
class QPropertyValueAddedChangeBasePrivate;
-class QT3DCORESHARED_EXPORT QPropertyValueAddedChangeBase : public QSceneChange
+class Q_3DCORESHARED_EXPORT QPropertyValueAddedChangeBase : public QSceneChange
{
public:
~QPropertyValueAddedChangeBase();
diff --git a/src/core/changes/qpropertyvalueaddedchangebase_p.h b/src/core/changes/qpropertyvalueaddedchangebase_p.h
index be92e2d5b..57d97e4c0 100644
--- a/src/core/changes/qpropertyvalueaddedchangebase_p.h
+++ b/src/core/changes/qpropertyvalueaddedchangebase_p.h
@@ -60,7 +60,7 @@ namespace Qt3DCore {
class QPropertyValueAddedChangeBase;
-class QT3DCORE_PRIVATE_EXPORT QPropertyValueAddedChangeBasePrivate : public QSceneChangePrivate
+class Q_3DCORE_PRIVATE_EXPORT QPropertyValueAddedChangeBasePrivate : public QSceneChangePrivate
{
public:
QPropertyValueAddedChangeBasePrivate();
diff --git a/src/core/changes/qpropertyvalueremovedchange.h b/src/core/changes/qpropertyvalueremovedchange.h
index 06bb1dd39..2bd781ed5 100644
--- a/src/core/changes/qpropertyvalueremovedchange.h
+++ b/src/core/changes/qpropertyvalueremovedchange.h
@@ -50,7 +50,7 @@ namespace Qt3DCore {
class QPropertyValueRemovedChangePrivate;
-class QT3DCORESHARED_EXPORT QPropertyValueRemovedChange : public QStaticPropertyValueRemovedChangeBase
+class Q_3DCORESHARED_EXPORT QPropertyValueRemovedChange : public QStaticPropertyValueRemovedChangeBase
{
public:
explicit QPropertyValueRemovedChange(QNodeId subjectId);
diff --git a/src/core/changes/qpropertyvalueremovedchange_p.h b/src/core/changes/qpropertyvalueremovedchange_p.h
index b4e86bc9e..119dabefc 100644
--- a/src/core/changes/qpropertyvalueremovedchange_p.h
+++ b/src/core/changes/qpropertyvalueremovedchange_p.h
@@ -62,7 +62,7 @@ namespace Qt3DCore {
class QPropertyValueRemovedChange;
-class QT3DCORE_PRIVATE_EXPORT QPropertyValueRemovedChangePrivate : public QStaticPropertyValueRemovedChangeBasePrivate
+class Q_3DCORE_PRIVATE_EXPORT QPropertyValueRemovedChangePrivate : public QStaticPropertyValueRemovedChangeBasePrivate
{
public:
QPropertyValueRemovedChangePrivate();
diff --git a/src/core/changes/qpropertyvalueremovedchangebase.h b/src/core/changes/qpropertyvalueremovedchangebase.h
index 44bc57726..233354078 100644
--- a/src/core/changes/qpropertyvalueremovedchangebase.h
+++ b/src/core/changes/qpropertyvalueremovedchangebase.h
@@ -50,7 +50,7 @@ namespace Qt3DCore {
class QPropertyValueRemovedChangeBasePrivate;
-class QT3DCORESHARED_EXPORT QPropertyValueRemovedChangeBase : public QSceneChange
+class Q_3DCORESHARED_EXPORT QPropertyValueRemovedChangeBase : public QSceneChange
{
public:
~QPropertyValueRemovedChangeBase();
diff --git a/src/core/changes/qpropertyvalueremovedchangebase_p.h b/src/core/changes/qpropertyvalueremovedchangebase_p.h
index f9c1b4009..f62f7f24d 100644
--- a/src/core/changes/qpropertyvalueremovedchangebase_p.h
+++ b/src/core/changes/qpropertyvalueremovedchangebase_p.h
@@ -60,7 +60,7 @@ namespace Qt3DCore {
class QPropertyValueRemovedChangeBase;
-class QT3DCORE_PRIVATE_EXPORT QPropertyValueRemovedChangeBasePrivate : public QSceneChangePrivate
+class Q_3DCORE_PRIVATE_EXPORT QPropertyValueRemovedChangeBasePrivate : public QSceneChangePrivate
{
public:
QPropertyValueRemovedChangeBasePrivate();
diff --git a/src/core/changes/qscenechange.h b/src/core/changes/qscenechange.h
index 7679fb030..7d88d334f 100644
--- a/src/core/changes/qscenechange.h
+++ b/src/core/changes/qscenechange.h
@@ -65,7 +65,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(ChangeFlags)
class QSceneChangePrivate;
-class QT3DCORESHARED_EXPORT QSceneChange
+class Q_3DCORESHARED_EXPORT QSceneChange
{
public:
enum DeliveryFlag {
diff --git a/src/core/changes/qscenechange_p.h b/src/core/changes/qscenechange_p.h
index cd0194b01..d32f6eec3 100644
--- a/src/core/changes/qscenechange_p.h
+++ b/src/core/changes/qscenechange_p.h
@@ -63,7 +63,7 @@ namespace Qt3DCore {
class QSceneChange;
class QNodeId;
-class QT3DCORE_PRIVATE_EXPORT QSceneChangePrivate
+class Q_3DCORE_PRIVATE_EXPORT QSceneChangePrivate
{
public :
QSceneChangePrivate();
diff --git a/src/core/changes/qskeletoncreatedchange_p.h b/src/core/changes/qskeletoncreatedchange_p.h
index 337a4bf26..09b37d545 100644
--- a/src/core/changes/qskeletoncreatedchange_p.h
+++ b/src/core/changes/qskeletoncreatedchange_p.h
@@ -57,7 +57,7 @@ namespace Qt3DCore {
class QSkeletonCreatedChangeBasePrivate;
-class QT3DCORESHARED_EXPORT QSkeletonCreatedChangeBase : public QNodeCreatedChangeBase
+class Q_3DCORESHARED_EXPORT QSkeletonCreatedChangeBase : public QNodeCreatedChangeBase
{
public:
explicit QSkeletonCreatedChangeBase(const QAbstractSkeleton *skeleton);
diff --git a/src/core/changes/qstaticpropertyupdatedchangebase.h b/src/core/changes/qstaticpropertyupdatedchangebase.h
index ca145e975..b698d1f06 100644
--- a/src/core/changes/qstaticpropertyupdatedchangebase.h
+++ b/src/core/changes/qstaticpropertyupdatedchangebase.h
@@ -48,7 +48,7 @@ namespace Qt3DCore {
class QStaticPropertyUpdatedChangeBasePrivate;
-class QT3DCORESHARED_EXPORT QStaticPropertyUpdatedChangeBase : public QPropertyUpdatedChangeBase
+class Q_3DCORESHARED_EXPORT QStaticPropertyUpdatedChangeBase : public QPropertyUpdatedChangeBase
{
public:
~QStaticPropertyUpdatedChangeBase();
diff --git a/src/core/changes/qstaticpropertyvalueaddedchangebase.h b/src/core/changes/qstaticpropertyvalueaddedchangebase.h
index bf55ac31c..e56e8f18a 100644
--- a/src/core/changes/qstaticpropertyvalueaddedchangebase.h
+++ b/src/core/changes/qstaticpropertyvalueaddedchangebase.h
@@ -49,7 +49,7 @@ namespace Qt3DCore {
class QStaticPropertyValueAddedChangeBasePrivate;
-class QT3DCORESHARED_EXPORT QStaticPropertyValueAddedChangeBase : public QPropertyValueAddedChangeBase
+class Q_3DCORESHARED_EXPORT QStaticPropertyValueAddedChangeBase : public QPropertyValueAddedChangeBase
{
public:
~QStaticPropertyValueAddedChangeBase();
diff --git a/src/core/changes/qstaticpropertyvalueaddedchangebase_p.h b/src/core/changes/qstaticpropertyvalueaddedchangebase_p.h
index cd995d739..3c7d62840 100644
--- a/src/core/changes/qstaticpropertyvalueaddedchangebase_p.h
+++ b/src/core/changes/qstaticpropertyvalueaddedchangebase_p.h
@@ -60,7 +60,7 @@ namespace Qt3DCore {
class QStaticPropertyValueAddedChangeBase;
-class QT3DCORE_PRIVATE_EXPORT QStaticPropertyValueAddedChangeBasePrivate : public QPropertyValueAddedChangeBasePrivate
+class Q_3DCORE_PRIVATE_EXPORT QStaticPropertyValueAddedChangeBasePrivate : public QPropertyValueAddedChangeBasePrivate
{
public:
QStaticPropertyValueAddedChangeBasePrivate();
diff --git a/src/core/changes/qstaticpropertyvalueremovedchangebase.h b/src/core/changes/qstaticpropertyvalueremovedchangebase.h
index f6f554397..e9f53fb12 100644
--- a/src/core/changes/qstaticpropertyvalueremovedchangebase.h
+++ b/src/core/changes/qstaticpropertyvalueremovedchangebase.h
@@ -49,7 +49,7 @@ namespace Qt3DCore {
class QStaticPropertyValueRemovedChangeBasePrivate;
-class QT3DCORESHARED_EXPORT QStaticPropertyValueRemovedChangeBase : public QPropertyValueRemovedChangeBase
+class Q_3DCORESHARED_EXPORT QStaticPropertyValueRemovedChangeBase : public QPropertyValueRemovedChangeBase
{
public:
~QStaticPropertyValueRemovedChangeBase();
diff --git a/src/core/changes/qstaticpropertyvalueremovedchangebase_p.h b/src/core/changes/qstaticpropertyvalueremovedchangebase_p.h
index ac4e1d875..1c26efa6c 100644
--- a/src/core/changes/qstaticpropertyvalueremovedchangebase_p.h
+++ b/src/core/changes/qstaticpropertyvalueremovedchangebase_p.h
@@ -60,7 +60,7 @@ namespace Qt3DCore {
class QStaticPropertyValueRemovedChangeBase;
-class QT3DCORE_PRIVATE_EXPORT QStaticPropertyValueRemovedChangeBasePrivate : public QPropertyValueRemovedChangeBasePrivate
+class Q_3DCORE_PRIVATE_EXPORT QStaticPropertyValueRemovedChangeBasePrivate : public QPropertyValueRemovedChangeBasePrivate
{
public:
QStaticPropertyValueRemovedChangeBasePrivate();
diff --git a/src/core/jobs/qabstractaspectjobmanager_p.h b/src/core/jobs/qabstractaspectjobmanager_p.h
index 5c4e9f699..b3e76b86d 100644
--- a/src/core/jobs/qabstractaspectjobmanager_p.h
+++ b/src/core/jobs/qabstractaspectjobmanager_p.h
@@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DCore {
-class QT3DCORESHARED_EXPORT QAbstractAspectJobManager : public QObject
+class Q_3DCORESHARED_EXPORT QAbstractAspectJobManager : public QObject
{
Q_OBJECT
public:
diff --git a/src/core/jobs/qaspectjob.h b/src/core/jobs/qaspectjob.h
index 398cd88d1..5c088fd1a 100644
--- a/src/core/jobs/qaspectjob.h
+++ b/src/core/jobs/qaspectjob.h
@@ -50,7 +50,7 @@ namespace Qt3DCore {
class QAspectJobPrivate;
-class QT3DCORESHARED_EXPORT QAspectJob
+class Q_3DCORESHARED_EXPORT QAspectJob
{
public:
QAspectJob();
diff --git a/src/core/jobs/qaspectjob_p.h b/src/core/jobs/qaspectjob_p.h
index ff708443e..7aa3151a0 100644
--- a/src/core/jobs/qaspectjob_p.h
+++ b/src/core/jobs/qaspectjob_p.h
@@ -103,7 +103,7 @@ struct JobRunStats
};
#endif
-class QT3DCORE_PRIVATE_EXPORT QAspectJobPrivate
+class Q_3DCORE_PRIVATE_EXPORT QAspectJobPrivate
{
public:
QAspectJobPrivate();
diff --git a/src/core/jobs/qaspectjobmanager_p.h b/src/core/jobs/qaspectjobmanager_p.h
index d59860039..77e535491 100644
--- a/src/core/jobs/qaspectjobmanager_p.h
+++ b/src/core/jobs/qaspectjobmanager_p.h
@@ -64,7 +64,7 @@ namespace Qt3DCore {
class QThreadPooler;
class DependencyHandler;
-class QT3DCORE_PRIVATE_EXPORT QAspectJobManager : public QAbstractAspectJobManager
+class Q_3DCORE_PRIVATE_EXPORT QAspectJobManager : public QAbstractAspectJobManager
{
Q_OBJECT
public:
diff --git a/src/core/jobs/qthreadpooler_p.h b/src/core/jobs/qthreadpooler_p.h
index 00742f8fc..65459efba 100644
--- a/src/core/jobs/qthreadpooler_p.h
+++ b/src/core/jobs/qthreadpooler_p.h
@@ -68,7 +68,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DCore {
-class QT3DCORE_PRIVATE_EXPORT QThreadPooler : public QObject
+class Q_3DCORE_PRIVATE_EXPORT QThreadPooler : public QObject
{
Q_OBJECT
diff --git a/src/core/nodes/propertychangehandler_p.h b/src/core/nodes/propertychangehandler_p.h
index ff8d6d5c2..6a3911dbd 100644
--- a/src/core/nodes/propertychangehandler_p.h
+++ b/src/core/nodes/propertychangehandler_p.h
@@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DCore {
-class QT3DCORESHARED_EXPORT PropertyChangeHandlerBase : public QObject
+class Q_3DCORESHARED_EXPORT PropertyChangeHandlerBase : public QObject
{
Q_OBJECT
public:
diff --git a/src/core/nodes/qabstractnodefactory_p.h b/src/core/nodes/qabstractnodefactory_p.h
index dbe0adffe..de1b758a9 100644
--- a/src/core/nodes/qabstractnodefactory_p.h
+++ b/src/core/nodes/qabstractnodefactory_p.h
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DCore {
-class QT3DCORE_PRIVATE_EXPORT QAbstractNodeFactory
+class Q_3DCORE_PRIVATE_EXPORT QAbstractNodeFactory
{
public:
virtual ~QAbstractNodeFactory();
diff --git a/src/core/nodes/qbackendnode.h b/src/core/nodes/qbackendnode.h
index 99e483cff..21485cd5f 100644
--- a/src/core/nodes/qbackendnode.h
+++ b/src/core/nodes/qbackendnode.h
@@ -58,7 +58,7 @@ class QAspectEngine;
class QBackendNodeTester;
#endif
-class QT3DCORESHARED_EXPORT QBackendNodeMapper
+class Q_3DCORESHARED_EXPORT QBackendNodeMapper
{
public:
virtual ~QBackendNodeMapper();
@@ -69,7 +69,7 @@ public:
typedef QSharedPointer<QBackendNodeMapper> QBackendNodeMapperPtr;
-class QT3DCORESHARED_EXPORT QBackendNode
+class Q_3DCORESHARED_EXPORT QBackendNode
{
public:
enum Mode {
diff --git a/src/core/nodes/qbackendnode_p.h b/src/core/nodes/qbackendnode_p.h
index 358b3ab8e..dde86fa48 100644
--- a/src/core/nodes/qbackendnode_p.h
+++ b/src/core/nodes/qbackendnode_p.h
@@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DCore {
-class QT3DCORE_PRIVATE_EXPORT QBackendNodePrivate
+class Q_3DCORE_PRIVATE_EXPORT QBackendNodePrivate
: public QObserverInterface
, public QObservableInterface
{
diff --git a/src/core/nodes/qcomponent.h b/src/core/nodes/qcomponent.h
index 639f9446c..182a21e50 100644
--- a/src/core/nodes/qcomponent.h
+++ b/src/core/nodes/qcomponent.h
@@ -49,7 +49,7 @@ namespace Qt3DCore {
class QComponentPrivate;
-class QT3DCORESHARED_EXPORT QComponent : public QNode
+class Q_3DCORESHARED_EXPORT QComponent : public QNode
{
Q_OBJECT
Q_PROPERTY(bool isShareable READ isShareable WRITE setShareable NOTIFY shareableChanged)
diff --git a/src/core/nodes/qcomponent_p.h b/src/core/nodes/qcomponent_p.h
index 0b3a961ab..d28433d23 100644
--- a/src/core/nodes/qcomponent_p.h
+++ b/src/core/nodes/qcomponent_p.h
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DCore {
-class QT3DCORE_PRIVATE_EXPORT QComponentPrivate : public QNodePrivate
+class Q_3DCORE_PRIVATE_EXPORT QComponentPrivate : public QNodePrivate
{
public:
QComponentPrivate();
diff --git a/src/core/nodes/qentity.cpp b/src/core/nodes/qentity.cpp
index 4c2081680..1d16e828e 100644
--- a/src/core/nodes/qentity.cpp
+++ b/src/core/nodes/qentity.cpp
@@ -77,6 +77,13 @@ namespace Qt3DCore {
\sa Qt3DCore::QComponent, Qt3DCore::QTransform
*/
+/*!
+ \fn template<typename T> QVector<T *> QEntity::componentsOfType() const
+
+ Returns all the components added to this entity that can be cast to
+ type T or an empty vector if there are no such components.
+*/
+
/*! \internal */
QEntityPrivate::QEntityPrivate()
: QNodePrivate()
diff --git a/src/core/nodes/qentity.h b/src/core/nodes/qentity.h
index f6044ce5e..f1a369c48 100644
--- a/src/core/nodes/qentity.h
+++ b/src/core/nodes/qentity.h
@@ -53,7 +53,7 @@ class QEntityPrivate;
typedef QVector<QComponent*> QComponentVector;
-class QT3DCORESHARED_EXPORT QEntity : public QNode
+class Q_3DCORESHARED_EXPORT QEntity : public QNode
{
Q_OBJECT
public:
@@ -62,6 +62,19 @@ public:
QComponentVector components() const;
+ template<class T>
+ QVector<T *> componentsOfType() const
+ {
+ QVector<T*> matchComponents;
+ const QComponentVector components = this->components();
+ for (QComponent *component : components) {
+ T *typedComponent = qobject_cast<T*>(component);
+ if (typedComponent != nullptr)
+ matchComponents.append(typedComponent);
+ }
+ return matchComponents;
+ }
+
void addComponent(QComponent *comp);
void removeComponent(QComponent *comp);
diff --git a/src/core/nodes/qentity_p.h b/src/core/nodes/qentity_p.h
index 65c9278da..803754c87 100644
--- a/src/core/nodes/qentity_p.h
+++ b/src/core/nodes/qentity_p.h
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DCore {
-class QT3DCORE_PRIVATE_EXPORT QEntityPrivate : public QNodePrivate
+class Q_3DCORE_PRIVATE_EXPORT QEntityPrivate : public QNodePrivate
{
public :
QEntityPrivate();
diff --git a/src/core/nodes/qnode.h b/src/core/nodes/qnode.h
index 1fe03f5e0..d4e4ff088 100644
--- a/src/core/nodes/qnode.h
+++ b/src/core/nodes/qnode.h
@@ -65,7 +65,7 @@ class QBackendNodeTester;
typedef QVector<QNode *> QNodeVector;
typedef QSharedPointer<QNode> QNodePtr;
-class QT3DCORESHARED_EXPORT QNode : public QObject
+class Q_3DCORESHARED_EXPORT QNode : public QObject
{
Q_OBJECT
Q_PROPERTY(Qt3DCore::QNode *parent READ parentNode WRITE setParent NOTIFY parentChanged)
diff --git a/src/core/nodes/qnode_p.h b/src/core/nodes/qnode_p.h
index 361a3b75b..511a0e562 100644
--- a/src/core/nodes/qnode_p.h
+++ b/src/core/nodes/qnode_p.h
@@ -69,7 +69,7 @@ namespace Qt3DCore {
class QNode;
class QAspectEngine;
-class QT3DCORE_PRIVATE_EXPORT QNodePrivate : public QObjectPrivate, public QObservableInterface
+class Q_3DCORE_PRIVATE_EXPORT QNodePrivate : public QObjectPrivate, public QObservableInterface
{
public:
QNodePrivate();
diff --git a/src/core/nodes/qnodecreatedchangegenerator_p.h b/src/core/nodes/qnodecreatedchangegenerator_p.h
index 42c2847cc..b2e8fa08b 100644
--- a/src/core/nodes/qnodecreatedchangegenerator_p.h
+++ b/src/core/nodes/qnodecreatedchangegenerator_p.h
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DCore {
-class QT3DCORE_PRIVATE_EXPORT QNodeCreatedChangeGenerator
+class Q_3DCORE_PRIVATE_EXPORT QNodeCreatedChangeGenerator
{
public:
QNodeCreatedChangeGenerator(QNode *rootNode);
diff --git a/src/core/nodes/qnodeid.h b/src/core/nodes/qnodeid.h
index a00559df3..0fd81e790 100644
--- a/src/core/nodes/qnodeid.h
+++ b/src/core/nodes/qnodeid.h
@@ -58,7 +58,7 @@ public:
: m_id(0)
{}
- QT3DCORESHARED_EXPORT static QNodeId createId() Q_DECL_NOTHROW;
+ Q_3DCORESHARED_EXPORT static QNodeId createId() Q_DECL_NOTHROW;
Q_DECL_CONSTEXPR bool isNull() const Q_DECL_NOTHROW
{
@@ -103,7 +103,7 @@ QT3D_DECLARE_TYPEINFO(Qt3DCore, QNodeId, Q_PRIMITIVE_TYPE)
typedef QVector<QNodeId> QNodeIdVector;
#ifndef QT_NO_DEBUG_STREAM
-QT3DCORESHARED_EXPORT QDebug operator<<(QDebug d, QNodeId id);
+Q_3DCORESHARED_EXPORT QDebug operator<<(QDebug d, QNodeId id);
#endif
inline Q_DECL_CONSTEXPR uint qHash(QNodeId id, uint seed = 0) Q_DECL_NOTHROW
diff --git a/src/core/nodes/qnodevisitor_p.h b/src/core/nodes/qnodevisitor_p.h
index 15bfa90db..c7c75710a 100644
--- a/src/core/nodes/qnodevisitor_p.h
+++ b/src/core/nodes/qnodevisitor_p.h
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DCore
{
-class QT3DCORESHARED_EXPORT QNodeVisitor
+class Q_3DCORESHARED_EXPORT QNodeVisitor
{
public:
QNodeVisitor();
diff --git a/src/core/qbackendnodefactory_p.h b/src/core/qbackendnodefactory_p.h
index 46e68266f..5752205c0 100644
--- a/src/core/qbackendnodefactory_p.h
+++ b/src/core/qbackendnodefactory_p.h
@@ -61,7 +61,7 @@ namespace Qt3DCore {
class QBackendNode;
-class QT3DCORE_PRIVATE_EXPORT QBackendNodeFactory
+class Q_3DCORE_PRIVATE_EXPORT QBackendNodeFactory
{
public:
virtual ~QBackendNodeFactory();
diff --git a/src/core/qchangearbiter_p.h b/src/core/qchangearbiter_p.h
index ef2c07dc0..4a82061ed 100644
--- a/src/core/qchangearbiter_p.h
+++ b/src/core/qchangearbiter_p.h
@@ -77,13 +77,13 @@ class QAbstractPostman;
class QScene;
-class QT3DCORE_PRIVATE_EXPORT QAbstractArbiter : public QLockableObserverInterface
+class Q_3DCORE_PRIVATE_EXPORT QAbstractArbiter : public QLockableObserverInterface
{
public:
virtual QAbstractPostman *postman() const = 0;
};
-class QT3DCORE_PRIVATE_EXPORT QChangeArbiter final
+class Q_3DCORE_PRIVATE_EXPORT QChangeArbiter final
: public QObject
, public QAbstractArbiter
{
diff --git a/src/core/qlockableobserverinterface_p.h b/src/core/qlockableobserverinterface_p.h
index b33a84ec4..57650aba2 100644
--- a/src/core/qlockableobserverinterface_p.h
+++ b/src/core/qlockableobserverinterface_p.h
@@ -60,7 +60,7 @@ namespace Qt3DCore {
typedef std::vector<QSceneChangePtr> QSceneChangeList;
-class QT3DCORE_PRIVATE_EXPORT QLockableObserverInterface : public QObserverInterface
+class Q_3DCORE_PRIVATE_EXPORT QLockableObserverInterface : public QObserverInterface
{
public:
virtual ~QLockableObserverInterface();
diff --git a/src/core/qobservableinterface_p.h b/src/core/qobservableinterface_p.h
index 8b92168ff..e4d343d63 100644
--- a/src/core/qobservableinterface_p.h
+++ b/src/core/qobservableinterface_p.h
@@ -61,7 +61,7 @@ namespace Qt3DCore {
class QLockableObserverInterface;
-class QT3DCORE_PRIVATE_EXPORT QObservableInterface
+class Q_3DCORE_PRIVATE_EXPORT QObservableInterface
{
public:
virtual ~QObservableInterface();
diff --git a/src/core/qobserverinterface_p.h b/src/core/qobserverinterface_p.h
index f2ed52aab..d19905dd2 100644
--- a/src/core/qobserverinterface_p.h
+++ b/src/core/qobserverinterface_p.h
@@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DCore {
-class QT3DCORESHARED_EXPORT QObserverInterface
+class Q_3DCORESHARED_EXPORT QObserverInterface
{
public:
virtual ~QObserverInterface();
diff --git a/src/core/qpostman_p.h b/src/core/qpostman_p.h
index ec00c50ae..23c638239 100644
--- a/src/core/qpostman_p.h
+++ b/src/core/qpostman_p.h
@@ -61,7 +61,7 @@ namespace Qt3DCore {
class QScene;
class QPostmanPrivate;
-class QT3DCORE_PRIVATE_EXPORT QAbstractPostman : public QObserverInterface
+class Q_3DCORE_PRIVATE_EXPORT QAbstractPostman : public QObserverInterface
{
public:
virtual void setScene(QScene *sceneLookup) = 0;
diff --git a/src/core/qpostman_p_p.h b/src/core/qpostman_p_p.h
index 1b5cca3c9..0a34c2e02 100644
--- a/src/core/qpostman_p_p.h
+++ b/src/core/qpostman_p_p.h
@@ -62,7 +62,7 @@ namespace Qt3DCore {
class QScene;
class QPostman;
-class QT3DCORE_PRIVATE_EXPORT QPostmanPrivate : public QObjectPrivate
+class Q_3DCORE_PRIVATE_EXPORT QPostmanPrivate : public QObjectPrivate
{
public:
QPostmanPrivate()
diff --git a/src/core/qscene_p.h b/src/core/qscene_p.h
index 1de7e3d4d..afcfb9b40 100644
--- a/src/core/qscene_p.h
+++ b/src/core/qscene_p.h
@@ -68,7 +68,7 @@ class NodePostConstructorInit;
typedef QList<QObservableInterface *> QObservableList;
-class QT3DCORE_PRIVATE_EXPORT QScene
+class Q_3DCORE_PRIVATE_EXPORT QScene
{
public:
QScene(QAspectEngine *engine = nullptr);
diff --git a/src/core/qsceneobserverinterface_p.h b/src/core/qsceneobserverinterface_p.h
index f183ab571..7ffc20742 100644
--- a/src/core/qsceneobserverinterface_p.h
+++ b/src/core/qsceneobserverinterface_p.h
@@ -61,7 +61,7 @@ namespace Qt3DCore {
class QChangeArbiter;
-class QT3DCORE_PRIVATE_EXPORT QSceneObserverInterface
+class Q_3DCORE_PRIVATE_EXPORT QSceneObserverInterface
{
public:
virtual ~QSceneObserverInterface();
diff --git a/src/core/qt3dcore_global.h b/src/core/qt3dcore_global.h
index a449a2e52..b2ad787c0 100644
--- a/src/core/qt3dcore_global.h
+++ b/src/core/qt3dcore_global.h
@@ -47,12 +47,12 @@ QT_BEGIN_NAMESPACE
#if defined(QT_SHARED) || !defined(QT_STATIC)
# if defined(QT_BUILD_3DCORE_LIB)
-# define QT3DCORESHARED_EXPORT Q_DECL_EXPORT
+# define Q_3DCORESHARED_EXPORT Q_DECL_EXPORT
# else
-# define QT3DCORESHARED_EXPORT Q_DECL_IMPORT
+# define Q_3DCORESHARED_EXPORT Q_DECL_IMPORT
# endif
#else
-# define QT3DCORESHARED_EXPORT
+# define Q_3DCORESHARED_EXPORT
#endif
#define QT3D_DECLARE_TYPEINFO(NS, Class, Flags) \
diff --git a/src/core/qt3dcore_global_p.h b/src/core/qt3dcore_global_p.h
index 2d6793744..fd4e9c31d 100644
--- a/src/core/qt3dcore_global_p.h
+++ b/src/core/qt3dcore_global_p.h
@@ -54,6 +54,6 @@
#include <Qt3DCore/qt3dcore_global.h>
#include <Qt3DCore/private/qt3dcore-config_p.h>
-#define QT3DCORE_PRIVATE_EXPORT QT3DCORESHARED_EXPORT
+#define Q_3DCORE_PRIVATE_EXPORT Q_3DCORESHARED_EXPORT
#endif // QT3DCORE_GLOBAL_P_H
diff --git a/src/core/resources/qframeallocator_p.h b/src/core/resources/qframeallocator_p.h
index b3ded0760..4c2b5a961 100644
--- a/src/core/resources/qframeallocator_p.h
+++ b/src/core/resources/qframeallocator_p.h
@@ -68,7 +68,7 @@ namespace Qt3DCore {
class QFrameAllocatorPrivate;
-class QT3DCORE_PRIVATE_EXPORT QFrameAllocator
+class Q_3DCORE_PRIVATE_EXPORT QFrameAllocator
{
public:
explicit QFrameAllocator(uint maxObjectSize, uint alignment = 16, uint pageSize = 128);
diff --git a/src/core/resources/qresourcemanager_p.h b/src/core/resources/qresourcemanager_p.h
index d944c16c7..b3837fb1f 100644
--- a/src/core/resources/qresourcemanager_p.h
+++ b/src/core/resources/qresourcemanager_p.h
@@ -233,7 +233,7 @@ template<typename T>
inline T *QHandle<T>::data() const { return (d && counter == d->counter) ? &static_cast<QHandleData<T> *>(d)->data : nullptr; }
-class QT3DCORE_PRIVATE_EXPORT AlignedAllocator
+class Q_3DCORE_PRIVATE_EXPORT AlignedAllocator
{
public:
static void *allocate(uint size);
diff --git a/src/core/services/qabstractframeadvanceservice_p.h b/src/core/services/qabstractframeadvanceservice_p.h
index dac72a98d..73907c779 100644
--- a/src/core/services/qabstractframeadvanceservice_p.h
+++ b/src/core/services/qabstractframeadvanceservice_p.h
@@ -62,7 +62,7 @@ namespace Qt3DCore {
class QAbstractFrameAdvanceServicePrivate;
-class QT3DCORESHARED_EXPORT QAbstractFrameAdvanceService : public QAbstractServiceProvider
+class Q_3DCORESHARED_EXPORT QAbstractFrameAdvanceService : public QAbstractServiceProvider
{
Q_OBJECT
public:
diff --git a/src/core/services/qdownloadhelperservice_p.h b/src/core/services/qdownloadhelperservice_p.h
index b74bcbaa1..507563ead 100644
--- a/src/core/services/qdownloadhelperservice_p.h
+++ b/src/core/services/qdownloadhelperservice_p.h
@@ -72,7 +72,7 @@ class QDownloadNetworkWorker;
class QDownloadHelperService;
class QDownloadHelperServicePrivate;
-class QT3DCORESHARED_EXPORT QDownloadRequest
+class Q_3DCORESHARED_EXPORT QDownloadRequest
{
public:
QDownloadRequest(const QUrl &url);
@@ -99,7 +99,7 @@ private:
typedef QSharedPointer<QDownloadRequest> QDownloadRequestPtr;
-class QT3DCORESHARED_EXPORT QDownloadHelperService : public QAbstractServiceProvider
+class Q_3DCORESHARED_EXPORT QDownloadHelperService : public QAbstractServiceProvider
{
Q_OBJECT
public:
diff --git a/src/core/services/qeventfilterservice_p.h b/src/core/services/qeventfilterservice_p.h
index 58b87d9cc..7efe51df4 100644
--- a/src/core/services/qeventfilterservice_p.h
+++ b/src/core/services/qeventfilterservice_p.h
@@ -61,7 +61,7 @@ namespace Qt3DCore {
class QEventFilterServicePrivate;
-class QT3DCORESHARED_EXPORT QEventFilterService : public QAbstractServiceProvider
+class Q_3DCORESHARED_EXPORT QEventFilterService : public QAbstractServiceProvider
{
Q_OBJECT
public:
diff --git a/src/core/services/qopenglinformationservice_p.h b/src/core/services/qopenglinformationservice_p.h
index 2adf73307..dcba480b6 100644
--- a/src/core/services/qopenglinformationservice_p.h
+++ b/src/core/services/qopenglinformationservice_p.h
@@ -63,7 +63,7 @@ namespace Qt3DCore {
class QOpenGLInformationServicePrivate;
-class QT3DCORESHARED_EXPORT QOpenGLInformationService : public QAbstractServiceProvider
+class Q_3DCORESHARED_EXPORT QOpenGLInformationService : public QAbstractServiceProvider
{
Q_OBJECT
public:
diff --git a/src/core/services/qservicelocator_p.h b/src/core/services/qservicelocator_p.h
index 9534b33ce..9111a14ab 100644
--- a/src/core/services/qservicelocator_p.h
+++ b/src/core/services/qservicelocator_p.h
@@ -61,7 +61,7 @@ namespace Qt3DCore {
class QAbstractServiceProviderPrivate;
-class QT3DCORESHARED_EXPORT QAbstractServiceProvider : public QObject
+class Q_3DCORESHARED_EXPORT QAbstractServiceProvider : public QObject
{
Q_OBJECT
public:
@@ -86,7 +86,7 @@ class QServiceLocatorPrivate;
class QEventFilterService;
class QDownloadHelperService;
-class QT3DCORESHARED_EXPORT QServiceLocator
+class Q_3DCORESHARED_EXPORT QServiceLocator
{
public:
QServiceLocator();
diff --git a/src/core/services/qsysteminformationservice_p.h b/src/core/services/qsysteminformationservice_p.h
index 01e976b77..a8a83701b 100644
--- a/src/core/services/qsysteminformationservice_p.h
+++ b/src/core/services/qsysteminformationservice_p.h
@@ -62,7 +62,7 @@ namespace Qt3DCore {
class QSystemInformationServicePrivate;
-class QT3DCORESHARED_EXPORT QSystemInformationService : public QAbstractServiceProvider
+class Q_3DCORESHARED_EXPORT QSystemInformationService : public QAbstractServiceProvider
{
Q_OBJECT
public:
diff --git a/src/core/transforms/matrix4x4_avx2_p.h b/src/core/transforms/matrix4x4_avx2_p.h
index 363aaa6e9..74e7c911c 100644
--- a/src/core/transforms/matrix4x4_avx2_p.h
+++ b/src/core/transforms/matrix4x4_avx2_p.h
@@ -487,10 +487,10 @@ public:
friend Vector4D operator*(const Vector4D &vector, const Matrix4x4_AVX2 &matrix);
friend Vector4D operator*(const Matrix4x4_AVX2 &matrix, const Vector4D &vector);
- friend QT3DCORE_PRIVATE_EXPORT Vector3D operator*(const Vector3D &vector, const Matrix4x4_AVX2 &matrix);
- friend QT3DCORE_PRIVATE_EXPORT Vector3D operator*(const Matrix4x4_AVX2 &matrix, const Vector3D &vector);
+ friend Q_3DCORE_PRIVATE_EXPORT Vector3D operator*(const Vector3D &vector, const Matrix4x4_AVX2 &matrix);
+ friend Q_3DCORE_PRIVATE_EXPORT Vector3D operator*(const Matrix4x4_AVX2 &matrix, const Vector3D &vector);
- friend QT3DCORE_PRIVATE_EXPORT QDebug operator<<(QDebug dbg, const Matrix4x4_AVX2 &m);
+ friend Q_3DCORE_PRIVATE_EXPORT QDebug operator<<(QDebug dbg, const Matrix4x4_AVX2 &m);
private:
// column major order
// aligned on 32 bytes boundaries for AVX, compatible with 16 bytes boundary for SSE
diff --git a/src/core/transforms/matrix4x4_sse_p.h b/src/core/transforms/matrix4x4_sse_p.h
index be314ca4d..287094be5 100644
--- a/src/core/transforms/matrix4x4_sse_p.h
+++ b/src/core/transforms/matrix4x4_sse_p.h
@@ -373,7 +373,7 @@ public:
friend Q_ALWAYS_INLINE Vector3D operator*(const Vector3D &vector, const Matrix4x4_SSE &matrix);
friend Q_ALWAYS_INLINE Vector3D operator*(const Matrix4x4_SSE &matrix, const Vector3D &vector);
- friend QT3DCORE_PRIVATE_EXPORT QDebug operator<<(QDebug dbg, const Matrix4x4_SSE &m);
+ friend Q_3DCORE_PRIVATE_EXPORT QDebug operator<<(QDebug dbg, const Matrix4x4_SSE &m);
private:
// Internally we will store the matrix as indicated below
// Q_DECL_ALIGN(16) // aligned on 16 bytes boundary for SSE (column major)
@@ -484,7 +484,7 @@ Q_ALWAYS_INLINE Vector3D operator*(const Vector3D &vector, const Matrix4x4_SSE &
return v;
}
-QT3DCORE_PRIVATE_EXPORT Q_ALWAYS_INLINE Vector3D operator*(const Matrix4x4_SSE &matrix, const Vector3D &vector)
+Q_3DCORE_PRIVATE_EXPORT Q_ALWAYS_INLINE Vector3D operator*(const Matrix4x4_SSE &matrix, const Vector3D &vector)
{
const Matrix4x4_SSE transposed = matrix.transposed();
return vector * transposed;
diff --git a/src/core/transforms/qabstractskeleton.h b/src/core/transforms/qabstractskeleton.h
index 3fc13fb70..902def9f8 100644
--- a/src/core/transforms/qabstractskeleton.h
+++ b/src/core/transforms/qabstractskeleton.h
@@ -49,7 +49,7 @@ namespace Qt3DCore {
class QAbstractSkeletonPrivate;
-class QT3DCORESHARED_EXPORT QAbstractSkeleton : public Qt3DCore::QNode
+class Q_3DCORESHARED_EXPORT QAbstractSkeleton : public Qt3DCore::QNode
{
Q_OBJECT
Q_PROPERTY(int jointCount READ jointCount NOTIFY jointCountChanged)
diff --git a/src/core/transforms/qarmature.h b/src/core/transforms/qarmature.h
index a5ccc9d28..e3beffa01 100644
--- a/src/core/transforms/qarmature.h
+++ b/src/core/transforms/qarmature.h
@@ -50,7 +50,7 @@ namespace Qt3DCore {
class QArmaturePrivate;
class QAbstractSkeleton;
-class QT3DCORESHARED_EXPORT QArmature : public Qt3DCore::QComponent
+class Q_3DCORESHARED_EXPORT QArmature : public Qt3DCore::QComponent
{
Q_OBJECT
Q_PROPERTY(Qt3DCore::QAbstractSkeleton* skeleton READ skeleton WRITE setSkeleton NOTIFY skeletonChanged)
diff --git a/src/core/transforms/qjoint.h b/src/core/transforms/qjoint.h
index fdc3d51a3..d3672e99f 100644
--- a/src/core/transforms/qjoint.h
+++ b/src/core/transforms/qjoint.h
@@ -53,7 +53,7 @@ namespace Qt3DCore {
class QJointPrivate;
-class QT3DCORESHARED_EXPORT QJoint : public QNode
+class Q_3DCORESHARED_EXPORT QJoint : public QNode
{
Q_OBJECT
Q_PROPERTY(QVector3D scale READ scale WRITE setScale NOTIFY scaleChanged)
diff --git a/src/core/transforms/qskeleton.h b/src/core/transforms/qskeleton.h
index e3c0c9194..ecffe1aa9 100644
--- a/src/core/transforms/qskeleton.h
+++ b/src/core/transforms/qskeleton.h
@@ -50,7 +50,7 @@ namespace Qt3DCore {
class QJoint;
class QSkeletonPrivate;
-class QT3DCORESHARED_EXPORT QSkeleton : public QAbstractSkeleton
+class Q_3DCORESHARED_EXPORT QSkeleton : public QAbstractSkeleton
{
Q_OBJECT
Q_PROPERTY(Qt3DCore::QJoint* rootJoint READ rootJoint WRITE setRootJoint NOTIFY rootJointChanged)
diff --git a/src/core/transforms/qskeletonloader.h b/src/core/transforms/qskeletonloader.h
index 1185ba6c7..516a84b0a 100644
--- a/src/core/transforms/qskeletonloader.h
+++ b/src/core/transforms/qskeletonloader.h
@@ -51,7 +51,7 @@ namespace Qt3DCore {
class QJoint;
class QSkeletonLoaderPrivate;
-class QT3DCORESHARED_EXPORT QSkeletonLoader : public QAbstractSkeleton
+class Q_3DCORESHARED_EXPORT QSkeletonLoader : public QAbstractSkeleton
{
Q_OBJECT
Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
diff --git a/src/core/transforms/qtransform.h b/src/core/transforms/qtransform.h
index 0a88cb49c..a80385a1b 100644
--- a/src/core/transforms/qtransform.h
+++ b/src/core/transforms/qtransform.h
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DCore {
class QTransformPrivate;
-class QT3DCORESHARED_EXPORT QTransform : public QComponent
+class Q_3DCORESHARED_EXPORT QTransform : public QComponent
{
Q_OBJECT
Q_PROPERTY(QMatrix4x4 matrix READ matrix WRITE setMatrix NOTIFY matrixChanged)
diff --git a/src/core/transforms/vector3d_sse_p.h b/src/core/transforms/vector3d_sse_p.h
index c7f9a403c..bc25cd705 100644
--- a/src/core/transforms/vector3d_sse_p.h
+++ b/src/core/transforms/vector3d_sse_p.h
@@ -89,7 +89,7 @@ public:
{
}
- explicit QT3DCORE_PRIVATE_EXPORT Vector3D_SSE(const Vector4D_SSE &v);
+ explicit Q_3DCORE_PRIVATE_EXPORT Vector3D_SSE(const Vector4D_SSE &v);
Q_ALWAYS_INLINE Vector3D_SSE &operator+=(Vector3D_SSE vector)
{
@@ -179,11 +179,11 @@ public:
}
#ifdef __AVX2__
- QT3DCORE_PRIVATE_EXPORT Vector3D_SSE unproject(const Matrix4x4_AVX2 &modelView, const Matrix4x4_AVX2 &projection, const QRect &viewport) const;
- QT3DCORE_PRIVATE_EXPORT Vector3D_SSE project(const Matrix4x4_AVX2 &modelView, const Matrix4x4_AVX2 &projection, const QRect &viewport) const;
+ Q_3DCORE_PRIVATE_EXPORT Vector3D_SSE unproject(const Matrix4x4_AVX2 &modelView, const Matrix4x4_AVX2 &projection, const QRect &viewport) const;
+ Q_3DCORE_PRIVATE_EXPORT Vector3D_SSE project(const Matrix4x4_AVX2 &modelView, const Matrix4x4_AVX2 &projection, const QRect &viewport) const;
#else
- QT3DCORE_PRIVATE_EXPORT Vector3D_SSE unproject(const Matrix4x4_SSE &modelView, const Matrix4x4_SSE &projection, const QRect &viewport) const;
- QT3DCORE_PRIVATE_EXPORT Vector3D_SSE project(const Matrix4x4_SSE &modelView, const Matrix4x4_SSE &projection, const QRect &viewport) const;
+ Q_3DCORE_PRIVATE_EXPORT Vector3D_SSE unproject(const Matrix4x4_SSE &modelView, const Matrix4x4_SSE &projection, const QRect &viewport) const;
+ Q_3DCORE_PRIVATE_EXPORT Vector3D_SSE project(const Matrix4x4_SSE &modelView, const Matrix4x4_SSE &projection, const QRect &viewport) const;
#endif
Q_ALWAYS_INLINE float x() const { return _mm_cvtss_f32(m_xyzw); }
@@ -350,13 +350,13 @@ public:
#ifdef __AVX2__
friend class Matrix4x4_AVX2;
- friend QT3DCORE_PRIVATE_EXPORT Vector3D_SSE operator*(const Vector3D_SSE &vector, const Matrix4x4_AVX2 &matrix);
- friend QT3DCORE_PRIVATE_EXPORT Vector3D_SSE operator*(const Matrix4x4_AVX2 &matrix, const Vector3D_SSE &vector);
+ friend Q_3DCORE_PRIVATE_EXPORT Vector3D_SSE operator*(const Vector3D_SSE &vector, const Matrix4x4_AVX2 &matrix);
+ friend Q_3DCORE_PRIVATE_EXPORT Vector3D_SSE operator*(const Matrix4x4_AVX2 &matrix, const Vector3D_SSE &vector);
#endif
friend class Matrix4x4_SSE;
- friend QT3DCORE_PRIVATE_EXPORT Vector3D_SSE operator*(const Vector3D_SSE &vector, const Matrix4x4_SSE &matrix);
- friend QT3DCORE_PRIVATE_EXPORT Vector3D_SSE operator*(const Matrix4x4_SSE &matrix, const Vector3D_SSE &vector);
+ friend Q_3DCORE_PRIVATE_EXPORT Vector3D_SSE operator*(const Vector3D_SSE &vector, const Matrix4x4_SSE &matrix);
+ friend Q_3DCORE_PRIVATE_EXPORT Vector3D_SSE operator*(const Matrix4x4_SSE &matrix, const Vector3D_SSE &vector);
friend Q_ALWAYS_INLINE const Vector3D_SSE operator+(Vector3D_SSE v1, Vector3D_SSE v2) { return v1 += v2; }
friend Q_ALWAYS_INLINE const Vector3D_SSE operator-(Vector3D_SSE v1, Vector3D_SSE v2) { return v1 -= v2; }
@@ -375,7 +375,7 @@ public:
friend Q_ALWAYS_INLINE const Vector3D_SSE operator/(Vector3D_SSE vector, float divisor) { return vector /= divisor; }
friend Q_ALWAYS_INLINE const Vector3D_SSE operator/(Vector3D_SSE vector, Vector3D_SSE divisor) { return vector /= divisor; }
- friend QT3DCORE_PRIVATE_EXPORT QDebug operator<<(QDebug dbg, const Vector3D_SSE &v);
+ friend Q_3DCORE_PRIVATE_EXPORT QDebug operator<<(QDebug dbg, const Vector3D_SSE &v);
friend Q_ALWAYS_INLINE bool qFuzzyCompare(const Vector3D_SSE& v1, const Vector3D_SSE& v2)
{
return ::qFuzzyCompare(v1.x(), v2.x()) &&
diff --git a/src/core/transforms/vector4d_sse_p.h b/src/core/transforms/vector4d_sse_p.h
index 0be5e3787..50e5c6836 100644
--- a/src/core/transforms/vector4d_sse_p.h
+++ b/src/core/transforms/vector4d_sse_p.h
@@ -371,7 +371,7 @@ public:
friend Q_ALWAYS_INLINE const Vector4D_SSE operator/(Vector4D_SSE vector, float divisor) { return vector /= divisor; }
friend Q_ALWAYS_INLINE const Vector4D_SSE operator/(Vector4D_SSE vector, Vector4D_SSE divisor) { return vector /= divisor; }
- friend QT3DCORE_PRIVATE_EXPORT QDebug operator<<(QDebug dbg, const Vector4D_SSE &v);
+ friend Q_3DCORE_PRIVATE_EXPORT QDebug operator<<(QDebug dbg, const Vector4D_SSE &v);
friend Q_ALWAYS_INLINE bool qFuzzyCompare(const Vector4D_SSE& v1, const Vector4D_SSE& v2)
{
return ::qFuzzyCompare(v1.x(), v2.x()) &&
diff --git a/src/doc/qt3d.qdocconf b/src/doc/qt3d.qdocconf
index 798dcbfd7..ded8fea7a 100644
--- a/src/doc/qt3d.qdocconf
+++ b/src/doc/qt3d.qdocconf
@@ -1,4 +1,5 @@
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
+include($QT_INSTALL_DOCS/config/exampleurl-qt3d.qdocconf)
project = Qt3D
description = Qt 3D Reference Documentation
@@ -100,16 +101,15 @@ imagedirs += images \
../../examples/qt3d/scene2d/doc/images \
../../examples/qt3d/advancedcustommaterial/doc/images
-Cpp.ignoretokens += QT3DINPUTSHARED_EXPORT \
- QT3DCORESHARED_EXPORT \
- QT3DLOGIC_PRIVATE_EXPORT \
- QT3DLOGICSHARED_EXPORT \
- QT3DRENDERSHARED_EXPORT \
- QT3DRENDERSHARED_PRIVATE_EXPORT \
- QT3DQUICKSHARED_PRIVATE_EXPORT \
- QT3DEXTRASSHARED_EXPORT \
- QT3DANIMATIONSHARED_EXPORT \
- QT3DQUICKSCENE2DSHARED_EXPORT
+Cpp.ignoretokens += Q_3DINPUTSHARED_EXPORT \
+ Q_3DCORESHARED_EXPORT \
+ Q_3DLOGICSHARED_EXPORT \
+ Q_3DRENDERSHARED_EXPORT \
+ Q_3DRENDERSHARED_PRIVATE_EXPORT \
+ Q_3DQUICKSHARED_PRIVATE_EXPORT \
+ Q_3DEXTRASSHARED_EXPORT \
+ Q_3DANIMATIONSHARED_EXPORT \
+ Q_3DQUICKSCENE2DSHARED_EXPORT
Cpp.ignoredirectives += Q_DECLARE_LOGGING_CATEGORY
diff --git a/src/extras/3dtext/qextrudedtextgeometry.h b/src/extras/3dtext/qextrudedtextgeometry.h
index d6e682dbd..d40797c6f 100644
--- a/src/extras/3dtext/qextrudedtextgeometry.h
+++ b/src/extras/3dtext/qextrudedtextgeometry.h
@@ -68,7 +68,7 @@ namespace Qt3DExtras {
class QExtrudedTextGeometryPrivate;
-class QT3DEXTRASSHARED_EXPORT QExtrudedTextGeometry : public Qt3DRender::QGeometry
+class Q_3DEXTRASSHARED_EXPORT QExtrudedTextGeometry : public Qt3DRender::QGeometry
{
Q_OBJECT
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
diff --git a/src/extras/3dtext/qextrudedtextmesh.h b/src/extras/3dtext/qextrudedtextmesh.h
index ea3054003..8cbfb6cfd 100644
--- a/src/extras/3dtext/qextrudedtextmesh.h
+++ b/src/extras/3dtext/qextrudedtextmesh.h
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DExtras {
-class QT3DEXTRASSHARED_EXPORT QExtrudedTextMesh : public Qt3DRender::QGeometryRenderer
+class Q_3DEXTRASSHARED_EXPORT QExtrudedTextMesh : public Qt3DRender::QGeometryRenderer
{
Q_OBJECT
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
diff --git a/src/extras/defaults/qabstractcameracontroller.h b/src/extras/defaults/qabstractcameracontroller.h
index e5d14745a..4cc71258d 100644
--- a/src/extras/defaults/qabstractcameracontroller.h
+++ b/src/extras/defaults/qabstractcameracontroller.h
@@ -55,7 +55,7 @@ namespace Qt3DExtras {
class QAbstractCameraControllerPrivate;
-class QT3DEXTRASSHARED_EXPORT QAbstractCameraController : public Qt3DCore::QEntity
+class Q_3DEXTRASSHARED_EXPORT QAbstractCameraController : public Qt3DCore::QEntity
{
Q_OBJECT
Q_PROPERTY(Qt3DRender::QCamera *camera READ camera WRITE setCamera NOTIFY cameraChanged)
diff --git a/src/extras/defaults/qabstractspritesheet.h b/src/extras/defaults/qabstractspritesheet.h
index bbef65798..ec72473f9 100644
--- a/src/extras/defaults/qabstractspritesheet.h
+++ b/src/extras/defaults/qabstractspritesheet.h
@@ -57,7 +57,7 @@ namespace Qt3DExtras {
class QAbstractSpriteSheetPrivate;
-class QT3DEXTRASSHARED_EXPORT QAbstractSpriteSheet : public Qt3DCore::QNode
+class Q_3DEXTRASSHARED_EXPORT QAbstractSpriteSheet : public Qt3DCore::QNode
{
Q_OBJECT
Q_PROPERTY(Qt3DRender::QAbstractTexture *texture READ texture WRITE setTexture NOTIFY textureChanged)
diff --git a/src/extras/defaults/qdiffusemapmaterial.h b/src/extras/defaults/qdiffusemapmaterial.h
index e6c632ed2..221e82859 100644
--- a/src/extras/defaults/qdiffusemapmaterial.h
+++ b/src/extras/defaults/qdiffusemapmaterial.h
@@ -56,7 +56,7 @@ namespace Qt3DExtras {
class QDiffuseMapMaterialPrivate;
-class QT3DEXTRASSHARED_EXPORT QDiffuseMapMaterial : public Qt3DRender::QMaterial
+class Q_3DEXTRASSHARED_EXPORT QDiffuseMapMaterial : public Qt3DRender::QMaterial
{
Q_OBJECT
Q_PROPERTY(QColor ambient READ ambient WRITE setAmbient NOTIFY ambientChanged)
diff --git a/src/extras/defaults/qdiffusespecularmapmaterial.h b/src/extras/defaults/qdiffusespecularmapmaterial.h
index d86948673..bbf060397 100644
--- a/src/extras/defaults/qdiffusespecularmapmaterial.h
+++ b/src/extras/defaults/qdiffusespecularmapmaterial.h
@@ -55,7 +55,7 @@ namespace Qt3DExtras {
class QDiffuseSpecularMapMaterialPrivate;
-class QT3DEXTRASSHARED_EXPORT QDiffuseSpecularMapMaterial : public Qt3DRender::QMaterial
+class Q_3DEXTRASSHARED_EXPORT QDiffuseSpecularMapMaterial : public Qt3DRender::QMaterial
{
Q_OBJECT
Q_PROPERTY(QColor ambient READ ambient WRITE setAmbient NOTIFY ambientChanged)
diff --git a/src/extras/defaults/qdiffusespecularmaterial.h b/src/extras/defaults/qdiffusespecularmaterial.h
index 5f21da093..7ce1e65ba 100644
--- a/src/extras/defaults/qdiffusespecularmaterial.h
+++ b/src/extras/defaults/qdiffusespecularmaterial.h
@@ -50,7 +50,7 @@ namespace Qt3DExtras {
class QDiffuseSpecularMaterialPrivate;
-class QT3DEXTRASSHARED_EXPORT QDiffuseSpecularMaterial : public Qt3DRender::QMaterial
+class Q_3DEXTRASSHARED_EXPORT QDiffuseSpecularMaterial : public Qt3DRender::QMaterial
{
Q_OBJECT
Q_PROPERTY(QColor ambient READ ambient WRITE setAmbient NOTIFY ambientChanged)
diff --git a/src/extras/defaults/qfirstpersoncameracontroller.h b/src/extras/defaults/qfirstpersoncameracontroller.h
index 60edf7cb8..4656d8827 100644
--- a/src/extras/defaults/qfirstpersoncameracontroller.h
+++ b/src/extras/defaults/qfirstpersoncameracontroller.h
@@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DExtras {
-class QT3DEXTRASSHARED_EXPORT QFirstPersonCameraController : public QAbstractCameraController
+class Q_3DEXTRASSHARED_EXPORT QFirstPersonCameraController : public QAbstractCameraController
{
Q_OBJECT
diff --git a/src/extras/defaults/qforwardrenderer.h b/src/extras/defaults/qforwardrenderer.h
index 7b6078169..e41cbd3df 100644
--- a/src/extras/defaults/qforwardrenderer.h
+++ b/src/extras/defaults/qforwardrenderer.h
@@ -54,7 +54,7 @@ namespace Qt3DExtras {
class QForwardRendererPrivate;
-class QT3DEXTRASSHARED_EXPORT QForwardRenderer : public Qt3DRender::QTechniqueFilter
+class Q_3DEXTRASSHARED_EXPORT QForwardRenderer : public Qt3DRender::QTechniqueFilter
{
Q_OBJECT
Q_PROPERTY(QObject *surface READ surface WRITE setSurface NOTIFY surfaceChanged)
diff --git a/src/extras/defaults/qgoochmaterial.h b/src/extras/defaults/qgoochmaterial.h
index 6afddfe8b..293ce0dbe 100644
--- a/src/extras/defaults/qgoochmaterial.h
+++ b/src/extras/defaults/qgoochmaterial.h
@@ -50,7 +50,7 @@ namespace Qt3DExtras {
class QGoochMaterialPrivate;
-class QT3DEXTRASSHARED_EXPORT QGoochMaterial : public Qt3DRender::QMaterial
+class Q_3DEXTRASSHARED_EXPORT QGoochMaterial : public Qt3DRender::QMaterial
{
Q_OBJECT
Q_PROPERTY(QColor diffuse READ diffuse WRITE setDiffuse NOTIFY diffuseChanged)
diff --git a/src/extras/defaults/qmetalroughmaterial.h b/src/extras/defaults/qmetalroughmaterial.h
index 400437338..c3c3d6da9 100644
--- a/src/extras/defaults/qmetalroughmaterial.h
+++ b/src/extras/defaults/qmetalroughmaterial.h
@@ -54,7 +54,7 @@ namespace Qt3DExtras {
class QMetalRoughMaterialPrivate;
-class QT3DEXTRASSHARED_EXPORT QMetalRoughMaterial : public Qt3DRender::QMaterial
+class Q_3DEXTRASSHARED_EXPORT QMetalRoughMaterial : public Qt3DRender::QMaterial
{
Q_OBJECT
Q_PROPERTY(QVariant baseColor READ baseColor WRITE setBaseColor NOTIFY baseColorChanged)
diff --git a/src/extras/defaults/qmorphphongmaterial.h b/src/extras/defaults/qmorphphongmaterial.h
index 235426f1c..77529692d 100644
--- a/src/extras/defaults/qmorphphongmaterial.h
+++ b/src/extras/defaults/qmorphphongmaterial.h
@@ -47,7 +47,7 @@ namespace Qt3DExtras {
class QMorphPhongMaterialPrivate;
-class QT3DEXTRASSHARED_EXPORT QMorphPhongMaterial : public Qt3DRender::QMaterial
+class Q_3DEXTRASSHARED_EXPORT QMorphPhongMaterial : public Qt3DRender::QMaterial
{
Q_OBJECT
Q_PROPERTY(QColor ambient READ ambient WRITE setAmbient NOTIFY ambientChanged)
diff --git a/src/extras/defaults/qnormaldiffusemapalphamaterial.h b/src/extras/defaults/qnormaldiffusemapalphamaterial.h
index 040199b26..735430b37 100644
--- a/src/extras/defaults/qnormaldiffusemapalphamaterial.h
+++ b/src/extras/defaults/qnormaldiffusemapalphamaterial.h
@@ -49,7 +49,7 @@ namespace Qt3DExtras {
class QNormalDiffuseMapAlphaMaterialPrivate;
-class QT3DEXTRASSHARED_EXPORT QNormalDiffuseMapAlphaMaterial : public QNormalDiffuseMapMaterial
+class Q_3DEXTRASSHARED_EXPORT QNormalDiffuseMapAlphaMaterial : public QNormalDiffuseMapMaterial
{
Q_OBJECT
public:
diff --git a/src/extras/defaults/qnormaldiffusemapmaterial.h b/src/extras/defaults/qnormaldiffusemapmaterial.h
index c38d53352..a2db0d7f5 100644
--- a/src/extras/defaults/qnormaldiffusemapmaterial.h
+++ b/src/extras/defaults/qnormaldiffusemapmaterial.h
@@ -56,7 +56,7 @@ namespace Qt3DExtras {
class QNormalDiffuseMapMaterialPrivate;
-class QT3DEXTRASSHARED_EXPORT QNormalDiffuseMapMaterial : public Qt3DRender::QMaterial
+class Q_3DEXTRASSHARED_EXPORT QNormalDiffuseMapMaterial : public Qt3DRender::QMaterial
{
Q_OBJECT
Q_PROPERTY(QColor ambient READ ambient WRITE setAmbient NOTIFY ambientChanged)
diff --git a/src/extras/defaults/qnormaldiffusespecularmapmaterial.h b/src/extras/defaults/qnormaldiffusespecularmapmaterial.h
index 164b07710..77ae9a7b6 100644
--- a/src/extras/defaults/qnormaldiffusespecularmapmaterial.h
+++ b/src/extras/defaults/qnormaldiffusespecularmapmaterial.h
@@ -50,7 +50,7 @@ namespace Qt3DExtras {
class QNormalDiffuseSpecularMapMaterialPrivate;
-class QT3DEXTRASSHARED_EXPORT QNormalDiffuseSpecularMapMaterial : public Qt3DRender::QMaterial
+class Q_3DEXTRASSHARED_EXPORT QNormalDiffuseSpecularMapMaterial : public Qt3DRender::QMaterial
{
Q_OBJECT
Q_PROPERTY(QColor ambient READ ambient WRITE setAmbient NOTIFY ambientChanged)
diff --git a/src/extras/defaults/qorbitcameracontroller.h b/src/extras/defaults/qorbitcameracontroller.h
index 684bfddf1..422498222 100644
--- a/src/extras/defaults/qorbitcameracontroller.h
+++ b/src/extras/defaults/qorbitcameracontroller.h
@@ -45,7 +45,7 @@ namespace Qt3DExtras {
class QOrbitCameraControllerPrivate;
-class QT3DEXTRASSHARED_EXPORT QOrbitCameraController : public QAbstractCameraController
+class Q_3DEXTRASSHARED_EXPORT QOrbitCameraController : public QAbstractCameraController
{
Q_OBJECT
Q_PROPERTY(float zoomInLimit READ zoomInLimit WRITE setZoomInLimit NOTIFY zoomInLimitChanged)
diff --git a/src/extras/defaults/qpervertexcolormaterial.h b/src/extras/defaults/qpervertexcolormaterial.h
index 8b64eb2d3..3b1b8bd6a 100644
--- a/src/extras/defaults/qpervertexcolormaterial.h
+++ b/src/extras/defaults/qpervertexcolormaterial.h
@@ -50,7 +50,7 @@ namespace Qt3DExtras {
class QPerVertexColorMaterialPrivate;
-class QT3DEXTRASSHARED_EXPORT QPerVertexColorMaterial : public Qt3DRender::QMaterial
+class Q_3DEXTRASSHARED_EXPORT QPerVertexColorMaterial : public Qt3DRender::QMaterial
{
Q_OBJECT
diff --git a/src/extras/defaults/qphongalphamaterial.h b/src/extras/defaults/qphongalphamaterial.h
index 667c5b283..37c853e70 100644
--- a/src/extras/defaults/qphongalphamaterial.h
+++ b/src/extras/defaults/qphongalphamaterial.h
@@ -52,7 +52,7 @@ namespace Qt3DExtras {
class QPhongAlphaMaterialPrivate;
-class QT3DEXTRASSHARED_EXPORT QPhongAlphaMaterial : public Qt3DRender::QMaterial
+class Q_3DEXTRASSHARED_EXPORT QPhongAlphaMaterial : public Qt3DRender::QMaterial
{
Q_OBJECT
Q_PROPERTY(QColor ambient READ ambient WRITE setAmbient NOTIFY ambientChanged)
diff --git a/src/extras/defaults/qphongmaterial.h b/src/extras/defaults/qphongmaterial.h
index d78c8c2ff..eab7e311b 100644
--- a/src/extras/defaults/qphongmaterial.h
+++ b/src/extras/defaults/qphongmaterial.h
@@ -50,7 +50,7 @@ namespace Qt3DExtras {
class QPhongMaterialPrivate;
-class QT3DEXTRASSHARED_EXPORT QPhongMaterial : public Qt3DRender::QMaterial
+class Q_3DEXTRASSHARED_EXPORT QPhongMaterial : public Qt3DRender::QMaterial
{
Q_OBJECT
Q_PROPERTY(QColor ambient READ ambient WRITE setAmbient NOTIFY ambientChanged)
diff --git a/src/extras/defaults/qskyboxentity.h b/src/extras/defaults/qskyboxentity.h
index e49782dc2..f0f2f3d63 100644
--- a/src/extras/defaults/qskyboxentity.h
+++ b/src/extras/defaults/qskyboxentity.h
@@ -49,7 +49,7 @@ namespace Qt3DExtras {
class QSkyboxEntityPrivate;
-class QT3DEXTRASSHARED_EXPORT QSkyboxEntity : public Qt3DCore::QEntity
+class Q_3DEXTRASSHARED_EXPORT QSkyboxEntity : public Qt3DCore::QEntity
{
Q_OBJECT
Q_PROPERTY(QString baseName READ baseName WRITE setBaseName NOTIFY baseNameChanged)
diff --git a/src/extras/defaults/qspritegrid.h b/src/extras/defaults/qspritegrid.h
index a0e73abdf..56f4b1976 100644
--- a/src/extras/defaults/qspritegrid.h
+++ b/src/extras/defaults/qspritegrid.h
@@ -51,7 +51,7 @@ namespace Qt3DExtras {
class QSpriteGridPrivate;
-class QT3DEXTRASSHARED_EXPORT QSpriteGrid : public QAbstractSpriteSheet
+class Q_3DEXTRASSHARED_EXPORT QSpriteGrid : public QAbstractSpriteSheet
{
Q_OBJECT
Q_PROPERTY(int rows READ rows WRITE setRows NOTIFY rowsChanged)
diff --git a/src/extras/defaults/qspritesheet.h b/src/extras/defaults/qspritesheet.h
index 0e78c0e22..d1faeb825 100644
--- a/src/extras/defaults/qspritesheet.h
+++ b/src/extras/defaults/qspritesheet.h
@@ -51,7 +51,7 @@ namespace Qt3DExtras {
class QSpriteSheetItem;
class QSpriteSheetPrivate;
-class QT3DEXTRASSHARED_EXPORT QSpriteSheet : public QAbstractSpriteSheet
+class Q_3DEXTRASSHARED_EXPORT QSpriteSheet : public QAbstractSpriteSheet
{
Q_OBJECT
Q_PROPERTY(QVector<QSpriteSheetItem *> sprites READ sprites WRITE setSprites NOTIFY spritesChanged)
diff --git a/src/extras/defaults/qspritesheetitem.h b/src/extras/defaults/qspritesheetitem.h
index f47846071..c98f3100e 100644
--- a/src/extras/defaults/qspritesheetitem.h
+++ b/src/extras/defaults/qspritesheetitem.h
@@ -48,7 +48,7 @@ namespace Qt3DExtras {
class QSpriteSheetItemPrivate;
-class QT3DEXTRASSHARED_EXPORT QSpriteSheetItem : public Qt3DCore::QNode
+class Q_3DEXTRASSHARED_EXPORT QSpriteSheetItem : public Qt3DCore::QNode
{
Q_OBJECT
Q_PROPERTY(int x READ x WRITE setX NOTIFY xChanged)
diff --git a/src/extras/defaults/qt3dwindow.h b/src/extras/defaults/qt3dwindow.h
index 7020a2bd5..bf4f44ff0 100644
--- a/src/extras/defaults/qt3dwindow.h
+++ b/src/extras/defaults/qt3dwindow.h
@@ -86,7 +86,7 @@ namespace Qt3DExtras {
class Qt3DWindowPrivate;
-class QT3DEXTRASSHARED_EXPORT Qt3DWindow : public QWindow
+class Q_3DEXTRASSHARED_EXPORT Qt3DWindow : public QWindow
{
Q_OBJECT
public:
diff --git a/src/extras/defaults/qtexturedmetalroughmaterial.h b/src/extras/defaults/qtexturedmetalroughmaterial.h
index 60f41b27f..23bce81f0 100644
--- a/src/extras/defaults/qtexturedmetalroughmaterial.h
+++ b/src/extras/defaults/qtexturedmetalroughmaterial.h
@@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DExtras {
-class QT_DEPRECATED_X("Use Qt3DExtras::QMetalRoughMaterial") QT3DEXTRASSHARED_EXPORT QTexturedMetalRoughMaterial : public QMetalRoughMaterial
+class QT_DEPRECATED_X("Use Qt3DExtras::QMetalRoughMaterial") Q_3DEXTRASSHARED_EXPORT QTexturedMetalRoughMaterial : public QMetalRoughMaterial
{
Q_OBJECT
Q_PROPERTY(QVariant ambientOcclusion READ ambientOcclusion WRITE setAmbientOcclusion NOTIFY ambientOcclusionChanged)
diff --git a/src/extras/defaults/qtexturematerial.h b/src/extras/defaults/qtexturematerial.h
index 4e36b1867..87c522992 100644
--- a/src/extras/defaults/qtexturematerial.h
+++ b/src/extras/defaults/qtexturematerial.h
@@ -57,7 +57,7 @@ namespace Qt3DExtras {
class QTextureMaterialPrivate;
-class QT3DEXTRASSHARED_EXPORT QTextureMaterial : public Qt3DRender::QMaterial
+class Q_3DEXTRASSHARED_EXPORT QTextureMaterial : public Qt3DRender::QMaterial
{
Q_OBJECT
Q_PROPERTY(Qt3DRender::QAbstractTexture *texture READ texture WRITE setTexture NOTIFY textureChanged)
diff --git a/src/extras/geometries/qconegeometry.h b/src/extras/geometries/qconegeometry.h
index 4f1dc944a..2deb56f0e 100644
--- a/src/extras/geometries/qconegeometry.h
+++ b/src/extras/geometries/qconegeometry.h
@@ -53,7 +53,7 @@ namespace Qt3DExtras {
class QConeGeometryPrivate;
-class QT3DEXTRASSHARED_EXPORT QConeGeometry : public Qt3DRender::QGeometry
+class Q_3DEXTRASSHARED_EXPORT QConeGeometry : public Qt3DRender::QGeometry
{
Q_OBJECT
Q_PROPERTY( bool hasTopEndcap READ hasTopEndcap WRITE setHasTopEndcap NOTIFY hasTopEndcapChanged )
diff --git a/src/extras/geometries/qconemesh.h b/src/extras/geometries/qconemesh.h
index c32070e5c..6c0408b7b 100644
--- a/src/extras/geometries/qconemesh.h
+++ b/src/extras/geometries/qconemesh.h
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DExtras {
-class QT3DEXTRASSHARED_EXPORT QConeMesh : public Qt3DRender::QGeometryRenderer
+class Q_3DEXTRASSHARED_EXPORT QConeMesh : public Qt3DRender::QGeometryRenderer
{
Q_OBJECT
Q_PROPERTY(int rings READ rings WRITE setRings NOTIFY ringsChanged)
diff --git a/src/extras/geometries/qcuboidgeometry.h b/src/extras/geometries/qcuboidgeometry.h
index 2c295d6c4..50bb10930 100644
--- a/src/extras/geometries/qcuboidgeometry.h
+++ b/src/extras/geometries/qcuboidgeometry.h
@@ -56,7 +56,7 @@ namespace Qt3DExtras {
class QCuboidGeometryPrivate;
-class QT3DEXTRASSHARED_EXPORT QCuboidGeometry : public Qt3DRender::QGeometry
+class Q_3DEXTRASSHARED_EXPORT QCuboidGeometry : public Qt3DRender::QGeometry
{
Q_OBJECT
Q_PROPERTY(float xExtent READ xExtent WRITE setXExtent NOTIFY xExtentChanged)
diff --git a/src/extras/geometries/qcuboidmesh.h b/src/extras/geometries/qcuboidmesh.h
index ca33c5f2d..dc7f821ff 100644
--- a/src/extras/geometries/qcuboidmesh.h
+++ b/src/extras/geometries/qcuboidmesh.h
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DExtras {
-class QT3DEXTRASSHARED_EXPORT QCuboidMesh : public Qt3DRender::QGeometryRenderer
+class Q_3DEXTRASSHARED_EXPORT QCuboidMesh : public Qt3DRender::QGeometryRenderer
{
Q_OBJECT
diff --git a/src/extras/geometries/qcylindergeometry.h b/src/extras/geometries/qcylindergeometry.h
index add4a7d96..0a9022016 100644
--- a/src/extras/geometries/qcylindergeometry.h
+++ b/src/extras/geometries/qcylindergeometry.h
@@ -54,7 +54,7 @@ class QAttribute;
namespace Qt3DExtras {
class QCylinderGeometryPrivate;
-class QT3DEXTRASSHARED_EXPORT QCylinderGeometry : public Qt3DRender::QGeometry
+class Q_3DEXTRASSHARED_EXPORT QCylinderGeometry : public Qt3DRender::QGeometry
{
Q_OBJECT
Q_PROPERTY(int rings READ rings WRITE setRings NOTIFY ringsChanged)
diff --git a/src/extras/geometries/qcylindermesh.h b/src/extras/geometries/qcylindermesh.h
index 3083ed849..19ef5d2cf 100644
--- a/src/extras/geometries/qcylindermesh.h
+++ b/src/extras/geometries/qcylindermesh.h
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DExtras {
-class QT3DEXTRASSHARED_EXPORT QCylinderMesh : public Qt3DRender::QGeometryRenderer
+class Q_3DEXTRASSHARED_EXPORT QCylinderMesh : public Qt3DRender::QGeometryRenderer
{
Q_OBJECT
Q_PROPERTY(int rings READ rings WRITE setRings NOTIFY ringsChanged)
diff --git a/src/extras/geometries/qplanegeometry.h b/src/extras/geometries/qplanegeometry.h
index 4a4efe6eb..91e985700 100644
--- a/src/extras/geometries/qplanegeometry.h
+++ b/src/extras/geometries/qplanegeometry.h
@@ -56,7 +56,7 @@ namespace Qt3DExtras {
class QPlaneGeometryPrivate;
-class QT3DEXTRASSHARED_EXPORT QPlaneGeometry : public Qt3DRender::QGeometry
+class Q_3DEXTRASSHARED_EXPORT QPlaneGeometry : public Qt3DRender::QGeometry
{
Q_OBJECT
Q_PROPERTY(float width READ width WRITE setWidth NOTIFY widthChanged)
diff --git a/src/extras/geometries/qplanemesh.h b/src/extras/geometries/qplanemesh.h
index 1cf2ae79e..eebea1dbf 100644
--- a/src/extras/geometries/qplanemesh.h
+++ b/src/extras/geometries/qplanemesh.h
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DExtras {
-class QT3DEXTRASSHARED_EXPORT QPlaneMesh : public Qt3DRender::QGeometryRenderer
+class Q_3DEXTRASSHARED_EXPORT QPlaneMesh : public Qt3DRender::QGeometryRenderer
{
Q_OBJECT
Q_PROPERTY(float width READ width WRITE setWidth NOTIFY widthChanged)
diff --git a/src/extras/geometries/qspheregeometry.h b/src/extras/geometries/qspheregeometry.h
index d657c0c67..8bd8c9c94 100644
--- a/src/extras/geometries/qspheregeometry.h
+++ b/src/extras/geometries/qspheregeometry.h
@@ -55,7 +55,7 @@ namespace Qt3DExtras {
class QSphereGeometryPrivate;
-class QT3DEXTRASSHARED_EXPORT QSphereGeometry : public Qt3DRender::QGeometry
+class Q_3DEXTRASSHARED_EXPORT QSphereGeometry : public Qt3DRender::QGeometry
{
Q_OBJECT
Q_PROPERTY(int rings READ rings WRITE setRings NOTIFY ringsChanged)
diff --git a/src/extras/geometries/qspheremesh.h b/src/extras/geometries/qspheremesh.h
index 58e77dcab..44e5b81bb 100644
--- a/src/extras/geometries/qspheremesh.h
+++ b/src/extras/geometries/qspheremesh.h
@@ -49,7 +49,7 @@ namespace Qt3DExtras {
class QSphereMeshPrivate;
-class QT3DEXTRASSHARED_EXPORT QSphereMesh : public Qt3DRender::QGeometryRenderer
+class Q_3DEXTRASSHARED_EXPORT QSphereMesh : public Qt3DRender::QGeometryRenderer
{
Q_OBJECT
Q_PROPERTY(int rings READ rings WRITE setRings NOTIFY ringsChanged)
diff --git a/src/extras/geometries/qtorusgeometry.h b/src/extras/geometries/qtorusgeometry.h
index ebde32bd8..cd4a4bb06 100644
--- a/src/extras/geometries/qtorusgeometry.h
+++ b/src/extras/geometries/qtorusgeometry.h
@@ -55,7 +55,7 @@ namespace Qt3DExtras {
class QTorusGeometryPrivate;
-class QT3DEXTRASSHARED_EXPORT QTorusGeometry : public Qt3DRender::QGeometry
+class Q_3DEXTRASSHARED_EXPORT QTorusGeometry : public Qt3DRender::QGeometry
{
Q_OBJECT
Q_PROPERTY(int rings READ rings WRITE setRings NOTIFY ringsChanged)
diff --git a/src/extras/geometries/qtorusmesh.h b/src/extras/geometries/qtorusmesh.h
index 69ad00efe..97bde10a2 100644
--- a/src/extras/geometries/qtorusmesh.h
+++ b/src/extras/geometries/qtorusmesh.h
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DExtras {
-class QT3DEXTRASSHARED_EXPORT QTorusMesh : public Qt3DRender::QGeometryRenderer
+class Q_3DEXTRASSHARED_EXPORT QTorusMesh : public Qt3DRender::QGeometryRenderer
{
Q_OBJECT
Q_PROPERTY(int rings READ rings WRITE setRings NOTIFY ringsChanged)
diff --git a/src/extras/qt3dextras_global.h b/src/extras/qt3dextras_global.h
index ee2111bcc..c4f649df3 100644
--- a/src/extras/qt3dextras_global.h
+++ b/src/extras/qt3dextras_global.h
@@ -46,12 +46,12 @@ QT_BEGIN_NAMESPACE
#if defined(QT_SHARED) || !defined(QT_STATIC)
# if defined(QT3DEXTRAS_LIBRARY)
-# define QT3DEXTRASSHARED_EXPORT Q_DECL_EXPORT
+# define Q_3DEXTRASSHARED_EXPORT Q_DECL_EXPORT
# else
-# define QT3DEXTRASSHARED_EXPORT Q_DECL_IMPORT
+# define Q_3DEXTRASSHARED_EXPORT Q_DECL_IMPORT
# endif
#else
-# define QT3DEXTRASSHARED_EXPORT
+# define Q_3DEXTRASSHARED_EXPORT
#endif
QT_END_NAMESPACE
diff --git a/src/extras/text/qtext2dentity.h b/src/extras/text/qtext2dentity.h
index 39be91a0f..1083d1c85 100644
--- a/src/extras/text/qtext2dentity.h
+++ b/src/extras/text/qtext2dentity.h
@@ -52,7 +52,7 @@ namespace Qt3DExtras {
class QText2DEntityPrivate;
-class QT3DEXTRASSHARED_EXPORT QText2DEntity : public Qt3DCore::QEntity
+class Q_3DEXTRASSHARED_EXPORT QText2DEntity : public Qt3DCore::QEntity
{
Q_OBJECT
Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged)
diff --git a/src/input/backend/qabstractphysicaldevicebackendnode_p.h b/src/input/backend/qabstractphysicaldevicebackendnode_p.h
index 339ad7324..e8e397883 100644
--- a/src/input/backend/qabstractphysicaldevicebackendnode_p.h
+++ b/src/input/backend/qabstractphysicaldevicebackendnode_p.h
@@ -66,7 +66,7 @@ namespace Qt3DInput {
class QInputAspect;
class QAbstractPhysicalDeviceBackendNodePrivate;
-class QT3DINPUTSHARED_PRIVATE_EXPORT QAbstractPhysicalDeviceBackendNode : public Qt3DCore::QBackendNode
+class Q_3DINPUTSHARED_PRIVATE_EXPORT QAbstractPhysicalDeviceBackendNode : public Qt3DCore::QBackendNode
{
public:
explicit QAbstractPhysicalDeviceBackendNode(QBackendNode::Mode mode);
diff --git a/src/input/backend/qabstractphysicaldevicebackendnode_p_p.h b/src/input/backend/qabstractphysicaldevicebackendnode_p_p.h
index d6928aced..4b0c47b36 100644
--- a/src/input/backend/qabstractphysicaldevicebackendnode_p_p.h
+++ b/src/input/backend/qabstractphysicaldevicebackendnode_p_p.h
@@ -83,7 +83,7 @@ class AxisSetting;
}
-class QT3DINPUTSHARED_PRIVATE_EXPORT QAbstractPhysicalDeviceBackendNodePrivate : public Qt3DCore::QBackendNodePrivate
+class Q_3DINPUTSHARED_PRIVATE_EXPORT QAbstractPhysicalDeviceBackendNodePrivate : public Qt3DCore::QBackendNodePrivate
{
public:
explicit QAbstractPhysicalDeviceBackendNodePrivate(Qt3DCore::QBackendNode::Mode mode = Qt3DCore::QBackendNode::ReadOnly);
diff --git a/src/input/frontend/qabstractactioninput.h b/src/input/frontend/qabstractactioninput.h
index a0c18cb54..0bafec351 100644
--- a/src/input/frontend/qabstractactioninput.h
+++ b/src/input/frontend/qabstractactioninput.h
@@ -48,7 +48,7 @@ namespace Qt3DInput {
class QAbstractActionInputPrivate;
-class QT3DINPUTSHARED_EXPORT QAbstractActionInput : public Qt3DCore::QNode
+class Q_3DINPUTSHARED_EXPORT QAbstractActionInput : public Qt3DCore::QNode
{
Q_OBJECT
public:
diff --git a/src/input/frontend/qabstractaxisinput.h b/src/input/frontend/qabstractaxisinput.h
index c0a93da31..fa3dc2fa8 100644
--- a/src/input/frontend/qabstractaxisinput.h
+++ b/src/input/frontend/qabstractaxisinput.h
@@ -51,7 +51,7 @@ namespace Qt3DInput {
class QAbstractPhysicalDevice;
class QAbstractAxisInputPrivate;
-class QT3DINPUTSHARED_EXPORT QAbstractAxisInput : public Qt3DCore::QNode
+class Q_3DINPUTSHARED_EXPORT QAbstractAxisInput : public Qt3DCore::QNode
{
Q_OBJECT
Q_PROPERTY(Qt3DInput::QAbstractPhysicalDevice *sourceDevice READ sourceDevice WRITE setSourceDevice NOTIFY sourceDeviceChanged)
diff --git a/src/input/frontend/qabstractphysicaldevice.h b/src/input/frontend/qabstractphysicaldevice.h
index bf93bc955..9e95d05f0 100644
--- a/src/input/frontend/qabstractphysicaldevice.h
+++ b/src/input/frontend/qabstractphysicaldevice.h
@@ -53,7 +53,7 @@ class QAxisSetting;
class QInputAspect;
class QAbstractPhysicalDevicePrivate;
-class QT3DINPUTSHARED_EXPORT QAbstractPhysicalDevice : public Qt3DCore::QNode
+class Q_3DINPUTSHARED_EXPORT QAbstractPhysicalDevice : public Qt3DCore::QNode
{
Q_OBJECT
public:
diff --git a/src/input/frontend/qabstractphysicaldevice_p.h b/src/input/frontend/qabstractphysicaldevice_p.h
index e2b67a815..8fa72aa02 100644
--- a/src/input/frontend/qabstractphysicaldevice_p.h
+++ b/src/input/frontend/qabstractphysicaldevice_p.h
@@ -65,7 +65,7 @@ namespace Qt3DInput {
class QAxisSetting;
-class QT3DINPUTSHARED_PRIVATE_EXPORT QAbstractPhysicalDevicePrivate : public Qt3DCore::QNodePrivate
+class Q_3DINPUTSHARED_PRIVATE_EXPORT QAbstractPhysicalDevicePrivate : public Qt3DCore::QNodePrivate
{
public:
QAbstractPhysicalDevicePrivate();
diff --git a/src/input/frontend/qabstractphysicaldeviceproxy_p.h b/src/input/frontend/qabstractphysicaldeviceproxy_p.h
index 64c634733..e250b9eb9 100644
--- a/src/input/frontend/qabstractphysicaldeviceproxy_p.h
+++ b/src/input/frontend/qabstractphysicaldeviceproxy_p.h
@@ -61,7 +61,7 @@ namespace Qt3DInput {
class QAbstractPhysicalDeviceProxyPrivate;
-class QT3DINPUTSHARED_PRIVATE_EXPORT QAbstractPhysicalDeviceProxy : public QAbstractPhysicalDevice
+class Q_3DINPUTSHARED_PRIVATE_EXPORT QAbstractPhysicalDeviceProxy : public QAbstractPhysicalDevice
{
Q_OBJECT
Q_PROPERTY(QString deviceName READ deviceName CONSTANT)
diff --git a/src/input/frontend/qabstractphysicaldeviceproxy_p_p.h b/src/input/frontend/qabstractphysicaldeviceproxy_p_p.h
index 2ba8f3bde..8f8d1bea3 100644
--- a/src/input/frontend/qabstractphysicaldeviceproxy_p_p.h
+++ b/src/input/frontend/qabstractphysicaldeviceproxy_p_p.h
@@ -62,7 +62,7 @@ namespace Qt3DInput {
class QAbstractPhysicalDeviceProxy;
class QAbstractPhysicalDevice;
-class QT3DINPUTSHARED_PRIVATE_EXPORT QAbstractPhysicalDeviceProxyPrivate : public QAbstractPhysicalDevicePrivate
+class Q_3DINPUTSHARED_PRIVATE_EXPORT QAbstractPhysicalDeviceProxyPrivate : public QAbstractPhysicalDevicePrivate
{
public:
explicit QAbstractPhysicalDeviceProxyPrivate(const QString &deviceName);
diff --git a/src/input/frontend/qaction.h b/src/input/frontend/qaction.h
index 4b282e0b9..f15159f68 100644
--- a/src/input/frontend/qaction.h
+++ b/src/input/frontend/qaction.h
@@ -50,7 +50,7 @@ namespace Qt3DInput {
class QActionPrivate;
class QAbstractActionInput;
-class QT3DINPUTSHARED_EXPORT QAction : public Qt3DCore::QNode
+class Q_3DINPUTSHARED_EXPORT QAction : public Qt3DCore::QNode
{
Q_OBJECT
Q_PROPERTY(bool active READ isActive NOTIFY activeChanged)
diff --git a/src/input/frontend/qactioninput.h b/src/input/frontend/qactioninput.h
index c4c2c934f..be620c5fb 100644
--- a/src/input/frontend/qactioninput.h
+++ b/src/input/frontend/qactioninput.h
@@ -51,7 +51,7 @@ namespace Qt3DInput {
class QAbstractPhysicalDevice;
class QActionInputPrivate;
-class QT3DINPUTSHARED_EXPORT QActionInput : public Qt3DInput::QAbstractActionInput
+class Q_3DINPUTSHARED_EXPORT QActionInput : public Qt3DInput::QAbstractActionInput
{
Q_OBJECT
Q_PROPERTY(Qt3DInput::QAbstractPhysicalDevice *sourceDevice READ sourceDevice WRITE setSourceDevice NOTIFY sourceDeviceChanged)
diff --git a/src/input/frontend/qanalogaxisinput.h b/src/input/frontend/qanalogaxisinput.h
index 9fe221b61..fca13a822 100644
--- a/src/input/frontend/qanalogaxisinput.h
+++ b/src/input/frontend/qanalogaxisinput.h
@@ -49,7 +49,7 @@ namespace Qt3DInput {
class QAnalogAxisInputPrivate;
-class QT3DINPUTSHARED_EXPORT QAnalogAxisInput : public QAbstractAxisInput
+class Q_3DINPUTSHARED_EXPORT QAnalogAxisInput : public QAbstractAxisInput
{
Q_OBJECT
Q_PROPERTY(int axis READ axis WRITE setAxis NOTIFY axisChanged)
diff --git a/src/input/frontend/qaxis.h b/src/input/frontend/qaxis.h
index a6d0b3b1f..a4f7ea7d4 100644
--- a/src/input/frontend/qaxis.h
+++ b/src/input/frontend/qaxis.h
@@ -49,7 +49,7 @@ namespace Qt3DInput {
class QAxisPrivate;
class QAbstractAxisInput;
-class QT3DINPUTSHARED_EXPORT QAxis : public Qt3DCore::QNode
+class Q_3DINPUTSHARED_EXPORT QAxis : public Qt3DCore::QNode
{
Q_OBJECT
Q_PROPERTY(float value READ value NOTIFY valueChanged)
diff --git a/src/input/frontend/qaxisaccumulator.h b/src/input/frontend/qaxisaccumulator.h
index 633713bb9..e5f35a32f 100644
--- a/src/input/frontend/qaxisaccumulator.h
+++ b/src/input/frontend/qaxisaccumulator.h
@@ -50,7 +50,7 @@ namespace Qt3DInput {
class QAxis;
class QAxisAccumulatorPrivate;
-class QT3DINPUTSHARED_EXPORT QAxisAccumulator : public Qt3DCore::QComponent
+class Q_3DINPUTSHARED_EXPORT QAxisAccumulator : public Qt3DCore::QComponent
{
Q_OBJECT
Q_PROPERTY(Qt3DInput::QAxis *sourceAxis READ sourceAxis WRITE setSourceAxis NOTIFY sourceAxisChanged)
diff --git a/src/input/frontend/qaxissetting.h b/src/input/frontend/qaxissetting.h
index 196dec735..979643e39 100644
--- a/src/input/frontend/qaxissetting.h
+++ b/src/input/frontend/qaxissetting.h
@@ -50,7 +50,7 @@ namespace Qt3DInput {
class QAxisSettingPrivate;
-class QT3DINPUTSHARED_EXPORT QAxisSetting : public Qt3DCore::QNode
+class Q_3DINPUTSHARED_EXPORT QAxisSetting : public Qt3DCore::QNode
{
Q_OBJECT
Q_PROPERTY(float deadZoneRadius READ deadZoneRadius WRITE setDeadZoneRadius NOTIFY deadZoneRadiusChanged)
diff --git a/src/input/frontend/qbuttonaxisinput.h b/src/input/frontend/qbuttonaxisinput.h
index 38223b6bf..15c6eec28 100644
--- a/src/input/frontend/qbuttonaxisinput.h
+++ b/src/input/frontend/qbuttonaxisinput.h
@@ -49,7 +49,7 @@ namespace Qt3DInput {
class QButtonAxisInputPrivate;
-class QT3DINPUTSHARED_EXPORT QButtonAxisInput : public QAbstractAxisInput
+class Q_3DINPUTSHARED_EXPORT QButtonAxisInput : public QAbstractAxisInput
{
Q_OBJECT
Q_PROPERTY(float scale READ scale WRITE setScale NOTIFY scaleChanged)
diff --git a/src/input/frontend/qgamepadinput_p.h b/src/input/frontend/qgamepadinput_p.h
index c064f1c94..fa47fc17c 100644
--- a/src/input/frontend/qgamepadinput_p.h
+++ b/src/input/frontend/qgamepadinput_p.h
@@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DInput {
class QGamepadInputPrivate;
-class QT3DINPUTSHARED_PRIVATE_EXPORT QGamepadInput : public QAbstractPhysicalDevice
+class Q_3DINPUTSHARED_PRIVATE_EXPORT QGamepadInput : public QAbstractPhysicalDevice
{
Q_OBJECT
Q_PROPERTY(int deviceId READ deviceId WRITE setDeviceId NOTIFY deviceIdChanged)
diff --git a/src/input/frontend/qgenericinputdevice_p.h b/src/input/frontend/qgenericinputdevice_p.h
index b46eada67..ea04e7290 100644
--- a/src/input/frontend/qgenericinputdevice_p.h
+++ b/src/input/frontend/qgenericinputdevice_p.h
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DInput {
-class QT3DINPUTSHARED_PRIVATE_EXPORT QGenericInputDevice : public QAbstractPhysicalDevice
+class Q_3DINPUTSHARED_PRIVATE_EXPORT QGenericInputDevice : public QAbstractPhysicalDevice
{
Q_OBJECT
Q_PROPERTY(QVariantMap axesMap READ axesMap WRITE setAxesMap NOTIFY axesMapChanged)
diff --git a/src/input/frontend/qinputaspect.cpp b/src/input/frontend/qinputaspect.cpp
index 1bc57579f..e7ff70326 100644
--- a/src/input/frontend/qinputaspect.cpp
+++ b/src/input/frontend/qinputaspect.cpp
@@ -223,7 +223,7 @@ QVector<QAspectJobPtr> QInputAspect::jobsToExecute(qint64 time)
{
Q_D(QInputAspect);
const qint64 deltaTime = time - d->m_time;
- const float dt = static_cast<const float>(deltaTime) / 1.0e9;
+ const float dt = static_cast<float>(deltaTime) / 1.0e9;
d->m_time = time;
QVector<QAspectJobPtr> jobs;
diff --git a/src/input/frontend/qinputaspect.h b/src/input/frontend/qinputaspect.h
index 90781d297..2e9ff76a3 100644
--- a/src/input/frontend/qinputaspect.h
+++ b/src/input/frontend/qinputaspect.h
@@ -51,7 +51,7 @@ class QAbstractPhysicalDevice;
class QInputAspectPrivate;
class QInputDeviceIntegration;
-class QT3DINPUTSHARED_EXPORT QInputAspect : public Qt3DCore::QAbstractAspect
+class Q_3DINPUTSHARED_EXPORT QInputAspect : public Qt3DCore::QAbstractAspect
{
Q_OBJECT
public:
diff --git a/src/input/frontend/qinputchord.h b/src/input/frontend/qinputchord.h
index cfc5806d7..570590229 100644
--- a/src/input/frontend/qinputchord.h
+++ b/src/input/frontend/qinputchord.h
@@ -51,7 +51,7 @@ namespace Qt3DInput {
class QAbstractPhysicalDevice;
class QInputChordPrivate;
-class QT3DINPUTSHARED_EXPORT QInputChord : public Qt3DInput::QAbstractActionInput
+class Q_3DINPUTSHARED_EXPORT QInputChord : public Qt3DInput::QAbstractActionInput
{
Q_OBJECT
Q_PROPERTY(int timeout READ timeout WRITE setTimeout NOTIFY timeoutChanged)
diff --git a/src/input/frontend/qinputdeviceintegration_p.h b/src/input/frontend/qinputdeviceintegration_p.h
index a066d7629..4522e2654 100644
--- a/src/input/frontend/qinputdeviceintegration_p.h
+++ b/src/input/frontend/qinputdeviceintegration_p.h
@@ -72,7 +72,7 @@ class QInputAspect;
class QAbstractPhysicalDevice;
class QInputDeviceIntegrationPrivate;
-class QT3DINPUTSHARED_PRIVATE_EXPORT QInputDeviceIntegration : public QObject
+class Q_3DINPUTSHARED_PRIVATE_EXPORT QInputDeviceIntegration : public QObject
{
Q_OBJECT
protected:
diff --git a/src/input/frontend/qinputdeviceintegration_p_p.h b/src/input/frontend/qinputdeviceintegration_p_p.h
index 31eea4cdf..35317972f 100644
--- a/src/input/frontend/qinputdeviceintegration_p_p.h
+++ b/src/input/frontend/qinputdeviceintegration_p_p.h
@@ -61,7 +61,7 @@ namespace Qt3DInput {
class QInputAspect;
class QInputDeviceIntegration;
-class QT3DINPUTSHARED_PRIVATE_EXPORT QInputDeviceIntegrationPrivate : public QObjectPrivate
+class Q_3DINPUTSHARED_PRIVATE_EXPORT QInputDeviceIntegrationPrivate : public QObjectPrivate
{
public:
QInputDeviceIntegrationPrivate();
diff --git a/src/input/frontend/qinputdeviceplugin_p.h b/src/input/frontend/qinputdeviceplugin_p.h
index a2f93eb3f..afce96a19 100644
--- a/src/input/frontend/qinputdeviceplugin_p.h
+++ b/src/input/frontend/qinputdeviceplugin_p.h
@@ -63,7 +63,7 @@ namespace Qt3DInput {
class QInputDeviceIntegration;
-class QT3DINPUTSHARED_PRIVATE_EXPORT QInputDevicePlugin : public QObject
+class Q_3DINPUTSHARED_PRIVATE_EXPORT QInputDevicePlugin : public QObject
{
Q_OBJECT
public:
diff --git a/src/input/frontend/qinputsequence.h b/src/input/frontend/qinputsequence.h
index acdad12d2..9d4aea6fc 100644
--- a/src/input/frontend/qinputsequence.h
+++ b/src/input/frontend/qinputsequence.h
@@ -51,7 +51,7 @@ namespace Qt3DInput {
class QAbstractPhysicalDevice;
class QInputSequencePrivate;
-class QT3DINPUTSHARED_EXPORT QInputSequence : public Qt3DInput::QAbstractActionInput
+class Q_3DINPUTSHARED_EXPORT QInputSequence : public Qt3DInput::QAbstractActionInput
{
Q_OBJECT
Q_PROPERTY(int timeout READ timeout WRITE setTimeout NOTIFY timeoutChanged)
diff --git a/src/input/frontend/qinputsettings.h b/src/input/frontend/qinputsettings.h
index 10f25d6ee..10e883ac4 100644
--- a/src/input/frontend/qinputsettings.h
+++ b/src/input/frontend/qinputsettings.h
@@ -49,7 +49,7 @@ namespace Qt3DInput {
class QInputSettingsPrivate;
-class QT3DINPUTSHARED_EXPORT QInputSettings : public Qt3DCore::QComponent
+class Q_3DINPUTSHARED_EXPORT QInputSettings : public Qt3DCore::QComponent
{
Q_OBJECT
Q_PROPERTY(QObject *eventSource READ eventSource WRITE setEventSource NOTIFY eventSourceChanged)
diff --git a/src/input/frontend/qkeyboarddevice.h b/src/input/frontend/qkeyboarddevice.h
index b418be5ff..c3478ec27 100644
--- a/src/input/frontend/qkeyboarddevice.h
+++ b/src/input/frontend/qkeyboarddevice.h
@@ -51,7 +51,7 @@ namespace Qt3DInput {
class QKeyboardDevicePrivate;
class QKeyboardHandler;
-class QT3DINPUTSHARED_EXPORT QKeyboardDevice : public Qt3DInput::QAbstractPhysicalDevice
+class Q_3DINPUTSHARED_EXPORT QKeyboardDevice : public Qt3DInput::QAbstractPhysicalDevice
{
Q_OBJECT
Q_PROPERTY(Qt3DInput::QKeyboardHandler *activeInput READ activeInput NOTIFY activeInputChanged)
diff --git a/src/input/frontend/qkeyboardhandler.h b/src/input/frontend/qkeyboardhandler.h
index 02b4fe1db..056d7c7a4 100644
--- a/src/input/frontend/qkeyboardhandler.h
+++ b/src/input/frontend/qkeyboardhandler.h
@@ -51,7 +51,7 @@ namespace Qt3DInput {
class QKeyboardDevice;
class QKeyboardHandlerPrivate;
-class QT3DINPUTSHARED_EXPORT QKeyboardHandler : public Qt3DCore::QComponent
+class Q_3DINPUTSHARED_EXPORT QKeyboardHandler : public Qt3DCore::QComponent
{
Q_OBJECT
Q_PROPERTY(Qt3DInput::QKeyboardDevice *sourceDevice READ sourceDevice WRITE setSourceDevice NOTIFY sourceDeviceChanged)
diff --git a/src/input/frontend/qkeyevent.h b/src/input/frontend/qkeyevent.h
index e028438ce..c1e221aae 100644
--- a/src/input/frontend/qkeyevent.h
+++ b/src/input/frontend/qkeyevent.h
@@ -53,7 +53,7 @@ class QKeyEvent;
typedef QSharedPointer<QKeyEvent> QKeyEventPtr;
-class QT3DINPUTSHARED_EXPORT QKeyEvent : public QObject
+class Q_3DINPUTSHARED_EXPORT QKeyEvent : public QObject
{
Q_OBJECT
Q_PROPERTY(int key READ key CONSTANT)
diff --git a/src/input/frontend/qlogicaldevice.h b/src/input/frontend/qlogicaldevice.h
index 4b32a0c90..b60000717 100644
--- a/src/input/frontend/qlogicaldevice.h
+++ b/src/input/frontend/qlogicaldevice.h
@@ -51,7 +51,7 @@ class QLogicalDevicePrivate;
class QAction;
class QAxis;
-class QT3DINPUTSHARED_EXPORT QLogicalDevice : public Qt3DCore::QComponent
+class Q_3DINPUTSHARED_EXPORT QLogicalDevice : public Qt3DCore::QComponent
{
Q_OBJECT
public:
diff --git a/src/input/frontend/qmousedevice.h b/src/input/frontend/qmousedevice.h
index 9e6d2c5ac..01e243790 100644
--- a/src/input/frontend/qmousedevice.h
+++ b/src/input/frontend/qmousedevice.h
@@ -53,7 +53,7 @@ class QMouseHandler;
class QMouseInput;
-class QT3DINPUTSHARED_EXPORT QMouseDevice : public Qt3DInput::QAbstractPhysicalDevice
+class Q_3DINPUTSHARED_EXPORT QMouseDevice : public Qt3DInput::QAbstractPhysicalDevice
{
Q_OBJECT
Q_PROPERTY(float sensitivity READ sensitivity WRITE setSensitivity NOTIFY sensitivityChanged)
diff --git a/src/input/frontend/qmouseevent.h b/src/input/frontend/qmouseevent.h
index 63786ac28..24bc763dc 100644
--- a/src/input/frontend/qmouseevent.h
+++ b/src/input/frontend/qmouseevent.h
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DInput {
-class QT3DINPUTSHARED_EXPORT QMouseEvent : public QObject
+class Q_3DINPUTSHARED_EXPORT QMouseEvent : public QObject
{
Q_OBJECT
Q_PROPERTY(int x READ x CONSTANT)
@@ -107,7 +107,7 @@ private:
typedef QSharedPointer<QMouseEvent> QMouseEventPtr;
#if QT_CONFIG(wheelevent)
-class QT3DINPUTSHARED_EXPORT QWheelEvent : public QObject
+class Q_3DINPUTSHARED_EXPORT QWheelEvent : public QObject
{
Q_OBJECT
Q_PROPERTY(int x READ x CONSTANT)
diff --git a/src/input/frontend/qmousehandler.h b/src/input/frontend/qmousehandler.h
index 50f7b028a..aec450cb9 100644
--- a/src/input/frontend/qmousehandler.h
+++ b/src/input/frontend/qmousehandler.h
@@ -51,7 +51,7 @@ namespace Qt3DInput {
class QMouseDevice;
class QMouseHandlerPrivate;
-class QT3DINPUTSHARED_EXPORT QMouseHandler : public Qt3DCore::QComponent
+class Q_3DINPUTSHARED_EXPORT QMouseHandler : public Qt3DCore::QComponent
{
Q_OBJECT
Q_PROPERTY(Qt3DInput::QMouseDevice *sourceDevice READ sourceDevice WRITE setSourceDevice NOTIFY sourceDeviceChanged)
diff --git a/src/input/frontend/qphysicaldevicecreatedchange.h b/src/input/frontend/qphysicaldevicecreatedchange.h
index 65cc4004a..6ffe559e9 100644
--- a/src/input/frontend/qphysicaldevicecreatedchange.h
+++ b/src/input/frontend/qphysicaldevicecreatedchange.h
@@ -47,7 +47,7 @@ namespace Qt3DInput {
class QAbstractPhysicalDevice;
class QPhysicalDeviceCreatedChangeBasePrivate;
-class QT3DINPUTSHARED_EXPORT QPhysicalDeviceCreatedChangeBase : public Qt3DCore::QNodeCreatedChangeBase
+class Q_3DINPUTSHARED_EXPORT QPhysicalDeviceCreatedChangeBase : public Qt3DCore::QNodeCreatedChangeBase
{
public:
explicit QPhysicalDeviceCreatedChangeBase(const QAbstractPhysicalDevice *device);
diff --git a/src/input/qt3dinput_global.h b/src/input/qt3dinput_global.h
index 9c76435f9..ee380fbc7 100644
--- a/src/input/qt3dinput_global.h
+++ b/src/input/qt3dinput_global.h
@@ -46,12 +46,12 @@ QT_BEGIN_NAMESPACE
#if defined(QT_SHARED) || !defined(QT_STATIC)
# if defined(QT_BUILD_3DINPUT_LIB)
-# define QT3DINPUTSHARED_EXPORT Q_DECL_EXPORT
+# define Q_3DINPUTSHARED_EXPORT Q_DECL_EXPORT
# else
-# define QT3DINPUTSHARED_EXPORT Q_DECL_IMPORT
+# define Q_3DINPUTSHARED_EXPORT Q_DECL_IMPORT
# endif
#else
-# define QT3DINPUTSHARED_EXPORT
+# define Q_3DINPUTSHARED_EXPORT
#endif
QT_END_NAMESPACE
diff --git a/src/input/qt3dinput_global_p.h b/src/input/qt3dinput_global_p.h
index 1bbc488dc..5ea3a8c5a 100644
--- a/src/input/qt3dinput_global_p.h
+++ b/src/input/qt3dinput_global_p.h
@@ -53,7 +53,7 @@
#include "qt3dinput_global.h"
-#define QT3DINPUTSHARED_PRIVATE_EXPORT QT3DINPUTSHARED_EXPORT
+#define Q_3DINPUTSHARED_PRIVATE_EXPORT Q_3DINPUTSHARED_EXPORT
#endif // QT3DINPUT_GLOBAL_P_H
diff --git a/src/logic/qframeaction.h b/src/logic/qframeaction.h
index f67bb9631..35cbf1883 100644
--- a/src/logic/qframeaction.h
+++ b/src/logic/qframeaction.h
@@ -54,7 +54,7 @@ namespace Logic {
class Executor;
}
-class QT3DLOGICSHARED_EXPORT QFrameAction : public Qt3DCore::QComponent
+class Q_3DLOGICSHARED_EXPORT QFrameAction : public Qt3DCore::QComponent
{
Q_OBJECT
diff --git a/src/logic/qlogicaspect.cpp b/src/logic/qlogicaspect.cpp
index d36e9b09d..649a14f25 100644
--- a/src/logic/qlogicaspect.cpp
+++ b/src/logic/qlogicaspect.cpp
@@ -118,7 +118,7 @@ QVector<QAspectJobPtr> QLogicAspect::jobsToExecute(qint64 time)
{
Q_D(QLogicAspect);
const qint64 deltaTime = time - d->m_time;
- const float dt = static_cast<const float>(deltaTime) / 1.0e9;
+ const float dt = static_cast<float>(deltaTime) / 1.0e9;
d->m_manager->setDeltaTime(dt);
d->m_time = time;
diff --git a/src/logic/qlogicaspect.h b/src/logic/qlogicaspect.h
index 958c0ce82..a44073ed0 100644
--- a/src/logic/qlogicaspect.h
+++ b/src/logic/qlogicaspect.h
@@ -49,7 +49,7 @@ namespace Qt3DLogic {
class QLogicAspectPrivate;
-class QT3DLOGICSHARED_EXPORT QLogicAspect : public Qt3DCore::QAbstractAspect
+class Q_3DLOGICSHARED_EXPORT QLogicAspect : public Qt3DCore::QAbstractAspect
{
Q_OBJECT
public:
diff --git a/src/logic/qt3dlogic_global.h b/src/logic/qt3dlogic_global.h
index 1e6610058..e11bae7af 100644
--- a/src/logic/qt3dlogic_global.h
+++ b/src/logic/qt3dlogic_global.h
@@ -46,12 +46,12 @@ QT_BEGIN_NAMESPACE
#if defined(QT_SHARED) || !defined(QT_STATIC)
# if defined(QT_BUILD_3DLOGIC_LIB)
-# define QT3DLOGICSHARED_EXPORT Q_DECL_EXPORT
+# define Q_3DLOGICSHARED_EXPORT Q_DECL_EXPORT
# else
-# define QT3DLOGICSHARED_EXPORT Q_DECL_IMPORT
+# define Q_3DLOGICSHARED_EXPORT Q_DECL_IMPORT
# endif
#else
-# define QT3DLOGICSHARED_EXPORT
+# define Q_3DLOGICSHARED_EXPORT
#endif
QT_END_NAMESPACE
diff --git a/src/plugins/geometryloaders/default/basegeometryloader.cpp b/src/plugins/geometryloaders/default/basegeometryloader.cpp
index 95e56f3b1..46e912a4e 100644
--- a/src/plugins/geometryloaders/default/basegeometryloader.cpp
+++ b/src/plugins/geometryloaders/default/basegeometryloader.cpp
@@ -152,7 +152,6 @@ void BaseGeometryLoader::generateGeometry()
} // of buffer filling loop
QBuffer *buf = new QBuffer();
- buf->setType(QBuffer::VertexBuffer);
buf->setData(bufferBytes);
if (m_geometry)
@@ -199,7 +198,6 @@ void BaseGeometryLoader::generateGeometry()
}
QBuffer *indexBuffer = new QBuffer();
- indexBuffer->setType(QBuffer::IndexBuffer);
indexBuffer->setData(indexBytes);
QAttribute *indexAttribute = new QAttribute(indexBuffer, ty, 1, m_indices.size());
indexAttribute->setAttributeType(QAttribute::IndexAttribute);
diff --git a/src/plugins/geometryloaders/gltf/gltfgeometryloader.cpp b/src/plugins/geometryloaders/gltf/gltfgeometryloader.cpp
index b16f87f02..ddb950f86 100644
--- a/src/plugins/geometryloaders/gltf/gltfgeometryloader.cpp
+++ b/src/plugins/geometryloaders/gltf/gltfgeometryloader.cpp
@@ -303,11 +303,11 @@ void GLTFGeometryLoader::processJSONBufferView(const QString &id, const QJsonObj
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;
+ case GL_ARRAY_BUFFER:
+ case GL_ELEMENT_ARRAY_BUFFER:
+ break;
default:
qCWarning(GLTFGeometryLoaderLog, "buffer %ls unsupported target: %d",
qUtf16PrintableImpl(id), target);
@@ -330,7 +330,6 @@ void GLTFGeometryLoader::processJSONBufferView(const QString &id, const QJsonObj
}
Qt3DRender::QBuffer *b = new Qt3DRender::QBuffer();
- b->setType(ty);
b->setData(bytes);
m_gltf1.m_buffers[id] = b;
}
@@ -345,11 +344,10 @@ void GLTFGeometryLoader::processJSONBufferViewV2(const QJsonObject &json)
const auto bufferData = m_gltf2.m_bufferDatas[bufferIndex];
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;
+ case GL_ARRAY_BUFFER:
+ case GL_ELEMENT_ARRAY_BUFFER:
+ break;
default:
return;
}
@@ -368,7 +366,7 @@ void GLTFGeometryLoader::processJSONBufferViewV2(const QJsonObject &json)
qUtf16PrintableImpl(bufferData.path));
}
- Qt3DRender::QBuffer *b(new Qt3DRender::QBuffer(ty));
+ auto b = new Qt3DRender::QBuffer;
b->setData(bytes);
m_gltf2.m_buffers.push_back(b);
}
diff --git a/src/plugins/sceneparsers/gltf/gltfimporter.cpp b/src/plugins/sceneparsers/gltf/gltfimporter.cpp
index 996077b16..79f2bf2d3 100644
--- a/src/plugins/sceneparsers/gltf/gltfimporter.cpp
+++ b/src/plugins/sceneparsers/gltf/gltfimporter.cpp
@@ -84,6 +84,7 @@
#include <Qt3DRender/qshaderprogram.h>
#include <Qt3DRender/qtechnique.h>
#include <Qt3DRender/qtexture.h>
+#include <Qt3DRender/qtextureimagedatagenerator.h>
#include <Qt3DRender/qdirectionallight.h>
#include <Qt3DRender/qspotlight.h>
#include <Qt3DRender/qpointlight.h>
@@ -97,6 +98,7 @@
#include <Qt3DExtras/qnormaldiffusespecularmapmaterial.h>
#include <Qt3DExtras/qgoochmaterial.h>
#include <Qt3DExtras/qpervertexcolormaterial.h>
+#include <Qt3DExtras/qmetalroughmaterial.h>
#include <Qt3DExtras/qconemesh.h>
#include <Qt3DExtras/qcuboidmesh.h>
#include <Qt3DExtras/qcylindermesh.h>
@@ -106,17 +108,60 @@
#include <private/qurlhelper_p.h>
+/**
+ * glTF 2.0 conformance report
+ *
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0
+ * Samples: https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0
+ *
+ * Most of the reference samples are rendered correctly, with the following exceptions:
+ *
+ * 'extensions' and 'extras' are ignored everywhere except in nodes.
+ *
+ * asset
+ * generator, copyright, minVersion: not parsed
+ * accessors
+ * min, max, normalized, sparse: not parsed
+ * animations
+ * the whole object is not parsed
+ * buffers
+ * all parsed
+ * bufferViews
+ * all parsed
+ * cameras
+ * all parsed
+ * images
+ * mimeType, bufferView, name: not parsed
+ * materials
+ * emissiveTexture, emissiveFactor: not parsed
+ * alphaMode, alphaCutoff, doubleSided: not parsed
+ * texCoord, strength: not parsed
+ * meshes
+ * weights: not parsed
+ * nodes
+ * skin, weights: not parsed
+ * samplers
+ * all parsed
+ * scenes
+ * all parsed
+ * textures
+ * all parsed
+ */
+
#ifndef qUtf16PrintableImpl // -Impl is a Qt 5.8 feature
# define qUtf16PrintableImpl(string) \
static_cast<const wchar_t*>(static_cast<const void*>(string.utf16()))
#endif
+#define KEY_ASSET QLatin1String("asset")
+#define KEY_VERSION QLatin1String("version")
#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_MESH QLatin1String("mesh")
#define KEY_MATRIX QLatin1String("matrix")
#define KEY_ROTATION QLatin1String("rotation")
#define KEY_SCALE QLatin1String("scale")
@@ -181,6 +226,15 @@
#define KEY_LINEAR_ATTENUATION QLatin1String("linearAttenuation")
#define KEY_QUAD_ATTENUATION QLatin1String("quadraticAttenuation")
#define KEY_INTENSITY QLatin1String("intensity")
+#define KEY_PBR_METAL_ROUGH QLatin1String("pbrMetallicRoughness")
+#define KEY_BASE_COLOR QLatin1String("baseColorFactor")
+#define KEY_BASE_COLOR_TEX QLatin1String("baseColorTexture")
+#define KEY_METAL_FACTOR QLatin1String("metallicFactor")
+#define KEY_METAL_ROUGH_TEX QLatin1String("metallicRoughnessTexture")
+#define KEY_ROUGH_FACTOR QLatin1String("roughnessFactor")
+#define KEY_NORMAL_TEX QLatin1String("normalTexture")
+#define KEY_OCCLUSION_TEX QLatin1String("occlusionTexture")
+#define KEY_INDEX QLatin1String("index")
#define KEY_INSTANCE_TECHNIQUE QLatin1String("instanceTechnique")
#define KEY_INSTANCE_PROGRAM QLatin1String("instanceProgram")
@@ -229,6 +283,18 @@ inline QVector3D jsonArrToVec3(const QJsonArray &array)
return QVector3D(array[0].toDouble(), array[1].toDouble(), array[2].toDouble());
}
+inline QVector4D jsonArrToVec4(const QJsonArray &array)
+{
+ return QVector4D(array[0].toDouble(), array[1].toDouble(),
+ array[2].toDouble(), array[3].toDouble());
+}
+
+inline QVariant jsonArrToColorVariant(const QJsonArray &array)
+{
+ return QVariant(QColor::fromRgbF(array[0].toDouble(), array[1].toDouble(),
+ array[2].toDouble(), array[3].toDouble()));
+}
+
inline QColor vec4ToQColor(const QVariant &vec4Var)
{
const QVector4D v = vec4Var.value<QVector4D>();
@@ -255,11 +321,40 @@ Qt3DRender::QFilterKey *buildFilterKey(const QString &key, const QJsonValue &val
namespace Qt3DRender {
-Q_LOGGING_CATEGORY(GLTFImporterLog, "Qt3D.GLTFImport", QtWarningMsg)
+Q_LOGGING_CATEGORY(GLTFImporterLog, "Qt3D.GLTFImport", QtWarningMsg);
+class GLTFRawTextureImage : public QAbstractTextureImage
+{
+ Q_OBJECT
+public:
+ explicit GLTFRawTextureImage(QNode *parent = nullptr);
+
+ QTextureImageDataGeneratorPtr dataGenerator() const final;
+
+ void setImage(const QImage &image);
+
+private:
+ QImage m_image;
-GLTFImporter::GLTFImporter() : QSceneImporter(),
- m_parseDone(false)
+ class GLTFRawTextureImageFunctor : public QTextureImageDataGenerator
+ {
+ public:
+ explicit GLTFRawTextureImageFunctor(const QImage &image);
+
+ QTextureImageDataPtr operator()() final;
+ bool operator ==(const QTextureImageDataGenerator &other) const final;
+
+ QT3D_FUNCTOR(GLTFRawTextureImageFunctor)
+ private:
+ QImage m_image;
+ };
+};
+
+GLTFImporter::GLTFImporter()
+ : QSceneImporter()
+ , m_parseDone(false)
+ , m_majorVersion(1)
+ , m_minorVersion(0)
{
}
@@ -286,9 +381,9 @@ void GLTFImporter::setBasePath(const QString& path)
Set a \a json document as the file used for importing a scene.
Returns true if the operation is successful.
*/
-bool GLTFImporter::setJSON(const QJsonDocument &json )
+bool GLTFImporter::setJSON(const QJsonDocument &json)
{
- if ( !json.isObject() ) {
+ if (!json.isObject()) {
return false;
}
@@ -360,12 +455,24 @@ bool GLTFImporter::areFileTypesSupported(const QStringList &extensions) const
*/
Qt3DCore::QEntity* GLTFImporter::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(GLTFImporterLog, "unknown node %ls in GLTF file %ls",
- qUtf16PrintableImpl(id), qUtf16PrintableImpl(m_basePath));
- return NULL;
+ QJsonValue jsonVal;
+
+ if (m_majorVersion > 1) {
+ const QJsonArray nodes = m_json.object().value(KEY_NODES).toArray();
+ if (Q_UNLIKELY(id.toInt() >= nodes.count())) {
+ qCWarning(GLTFImporterLog, "unknown node %ls in GLTF file %ls",
+ qUtf16PrintableImpl(id), qUtf16PrintableImpl(m_basePath));
+ return nullptr;
+ }
+ jsonVal = nodes[id.toInt()];
+ } else {
+ const QJsonObject nodes = m_json.object().value(KEY_NODES).toObject();
+ jsonVal = nodes.value(id);
+ if (Q_UNLIKELY(jsonVal.isUndefined())) {
+ qCWarning(GLTFImporterLog, "unknown node %ls in GLTF file %ls",
+ qUtf16PrintableImpl(id), qUtf16PrintableImpl(m_basePath));
+ return nullptr;
+ }
}
const QJsonObject jsonObj = jsonVal.toObject();
@@ -376,27 +483,44 @@ Qt3DCore::QEntity* GLTFImporter::node(const QString &id)
// 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(GLTFImporterLog, "node %ls references unknown mesh %ls",
- qUtf16PrintableImpl(id), qUtf16PrintableImpl(meshName));
- continue;
+ const QJsonValue meshesValue = jsonObj.value(KEY_MESHES);
+
+ if (meshesValue.isUndefined()) {
+ const QJsonValue mesh = jsonObj.value(KEY_MESH);
+ if (!mesh.isUndefined()) {
+ const QString meshName = QString::number(mesh.toInt());
+ const auto geometryRenderers = qAsConst(m_meshDict).equal_range(meshName);
+ 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);
+ }
}
+ } else {
+ const auto meshes = meshesValue.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(GLTFImporterLog, "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);
+ 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()) {
@@ -437,14 +561,13 @@ Qt3DCore::QEntity* GLTFImporter::node(const QString &id)
}
}
- {
- const auto children = jsonObj.value(KEY_CHILDREN).toArray();
- for (const QJsonValue &c : children) {
- QEntity* child = node(c.toString());
- if (!child)
- continue;
- child->setParent(result);
- }
+ // recursively retrieve children
+ const auto children = jsonObj.value(KEY_CHILDREN).toArray();
+ for (const QJsonValue &c : children) {
+ QEntity* child = node((m_majorVersion > 1) ? QString::number(c.toInt()) : c.toString());
+ if (!child)
+ continue;
+ child->setParent(result);
}
renameFromJson(jsonObj, result);
@@ -454,8 +577,8 @@ Qt3DCore::QEntity* GLTFImporter::node(const QString &id)
QMatrix4x4 m(Qt::Uninitialized);
QJsonArray matrixValues = matrix.toArray();
- for (int i=0; i<16; ++i) {
- double v = matrixValues.at( i ).toDouble();
+ for (int i = 0; i < 16; ++i) {
+ double v = matrixValues.at(i).toDouble();
m(i % 4, i >> 2) = v;
}
@@ -469,11 +592,7 @@ Qt3DCore::QEntity* GLTFImporter::node(const QString &id)
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());
+ QQuaternion quaternion(jsonArrToVec4(rotation.toArray()));
trans->setRotation(quaternion);
}
@@ -499,9 +618,10 @@ Qt3DCore::QEntity* GLTFImporter::node(const QString &id)
const bool newLens = cameraLens == nullptr;
if (newLens)
cameraLens = new QCameraLens;
- if (!fillCamera(*cameraLens, cameraEntity, cameraVal.toString())) {
+ const QString cameraID = (m_majorVersion > 1) ? QString::number(cameraVal.toInt()) : cameraVal.toString();
+ if (!fillCamera(*cameraLens, cameraEntity, cameraID)) {
qCWarning(GLTFImporterLog, "failed to build camera: %ls on node %ls",
- qUtf16PrintableImpl(cameraVal.toString()), qUtf16PrintableImpl(id));
+ qUtf16PrintableImpl(cameraID), qUtf16PrintableImpl(id));
} else if (newLens) {
result->addComponent(cameraLens);
}
@@ -511,7 +631,8 @@ Qt3DCore::QEntity* GLTFImporter::node(const QString &id)
if (!extensionsVal.isUndefined()) {
const auto commonMat = extensionsVal.toObject().value(KEY_COMMON_MAT);
if (!commonMat.isUndefined()) {
- const auto lightId = commonMat.toObject().value(KEY_LIGHT).toString();
+ const QJsonValue lightVal = commonMat.toObject().value(KEY_LIGHT);
+ const QString lightId = (m_majorVersion > 1) ? QString::number(lightVal.toInt()) : lightVal.toString();
QAbstractLight *lightComp = m_lights.value(lightId);
if (Q_UNLIKELY(!lightComp)) {
qCWarning(GLTFImporterLog, "failed to find light: %ls for node %ls",
@@ -532,24 +653,46 @@ Qt3DCore::QEntity* GLTFImporter::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(GLTFImporterLog, "GLTF: no such scene %ls in file %ls",
- qUtf16PrintableImpl(id), qUtf16PrintableImpl(m_basePath));
- return defaultScene();
- }
+ QEntity* sceneEntity = nullptr;
- 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);
+ if (m_majorVersion > 1) {
+ const QJsonArray scenes = m_json.object().value(KEY_SCENES).toArray();
+ const auto sceneVal = scenes.first();
+ if (Q_UNLIKELY(sceneVal.isUndefined())) {
+ if (Q_UNLIKELY(!id.isNull()))
+ qCWarning(GLTFImporterLog, "GLTF: no such scene %ls in file %ls",
+ qUtf16PrintableImpl(id), qUtf16PrintableImpl(m_basePath));
+ return defaultScene();
+ }
+ const QJsonObject sceneObj = sceneVal.toObject();
+ sceneEntity = new QEntity;
+ const auto nodes = sceneObj.value(KEY_NODES).toArray();
+ for (const QJsonValue &n : nodes) {
+ QEntity* child = node(QString::number(n.toInt()));
+ if (!child)
+ continue;
+ child->setParent(sceneEntity);
+ }
+ } else {
+ const 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(GLTFImporterLog, "GLTF: no such scene %ls in file %ls",
+ qUtf16PrintableImpl(id), qUtf16PrintableImpl(m_basePath));
+ return defaultScene();
+ }
+
+ const QJsonObject sceneObj = sceneVal.toObject();
+ 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);
+ }
}
cleanup();
@@ -592,14 +735,21 @@ GLTFImporter::AccessorData::AccessorData()
}
-GLTFImporter::AccessorData::AccessorData(const QJsonObject &json)
- : bufferViewName(json.value(KEY_BUFFER_VIEW).toString()),
- type(accessorTypeFromJSON(json.value(KEY_COMPONENT_TYPE).toInt())),
+GLTFImporter::AccessorData::AccessorData(const QJsonObject &json, int major, int minor)
+ : 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)
{
+ Q_UNUSED(minor)
+
+ if (major > 1) {
+ bufferViewName = QString::number(json.value(KEY_BUFFER_VIEW).toInt());
+ } else {
+ bufferViewName = json.value(KEY_BUFFER_VIEW).toString();
+ }
+
const auto byteOffset = json.value(KEY_BYTE_OFFSET);
if (!byteOffset.isUndefined())
offset = byteOffset.toInt();
@@ -618,6 +768,11 @@ bool GLTFImporter::isGLTFSupported(const QStringList &extensions)
return false;
}
+bool GLTFImporter::isEmbeddedResource(const QString &url)
+{
+ return url.startsWith("data:");
+}
+
void GLTFImporter::renameFromJson(const QJsonObject &json, QObject * const object)
{
const auto name = json.value(KEY_NAME);
@@ -690,7 +845,7 @@ Qt3DCore::QEntity* GLTFImporter::defaultScene()
{
if (Q_UNLIKELY(m_defaultScene.isEmpty())) {
qCWarning(GLTFImporterLog, "no default scene");
- return NULL;
+ return nullptr;
}
return scene(m_defaultScene);
@@ -708,7 +863,7 @@ QMaterial *GLTFImporter::materialWithCustomShader(const QString &id, const QJson
if (Q_UNLIKELY(it == m_techniques.cend())) {
qCWarning(GLTFImporterLog, "unknown technique %ls for material %ls in GLTF file %ls",
qUtf16PrintableImpl(techniqueName), qUtf16PrintableImpl(id), qUtf16PrintableImpl(m_basePath));
- return NULL;
+ return nullptr;
}
QTechnique *technique = *it;
technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGLES);
@@ -814,7 +969,7 @@ QMaterial *GLTFImporter::commonMaterial(const QJsonObject &jsonObj)
{
const auto jsonExt =
jsonObj.value(KEY_EXTENSIONS).toObject().value(KEY_COMMON_MAT).toObject();
- if (jsonExt.isEmpty())
+ if (m_majorVersion == 1 && jsonExt.isEmpty())
return nullptr;
QVariantHash params;
@@ -823,6 +978,13 @@ QMaterial *GLTFImporter::commonMaterial(const QJsonObject &jsonObj)
bool hasNormalMap = false;
bool hasAlpha = false;
+ if (m_majorVersion > 1) {
+ QMaterial *mat = pbrMaterial(jsonObj);
+
+ if (mat)
+ return mat;
+ }
+
const QJsonObject values = jsonExt.value(KEY_VALUES).toObject();
for (auto it = values.begin(), end = values.end(); it != end; ++it) {
const QString vName = it.key();
@@ -938,18 +1100,146 @@ QMaterial *GLTFImporter::commonMaterial(const QJsonObject &jsonObj)
return mat;
}
+QMaterial *GLTFImporter::pbrMaterial(const QJsonObject &jsonObj)
+{
+ // check for pbrMetallicRoughness material
+ QMetalRoughMaterial *mrMaterial = nullptr;
+ QJsonValue jsonValue = jsonObj.value(KEY_PBR_METAL_ROUGH);
+
+ if (!jsonValue.isUndefined()) {
+ const QJsonObject pbrObj = jsonValue.toObject();
+ mrMaterial = new QMetalRoughMaterial;
+ jsonValue = pbrObj.value(KEY_BASE_COLOR);
+ if (!jsonValue.isUndefined())
+ mrMaterial->setBaseColor(jsonArrToColorVariant(jsonValue.toArray()));
+
+ jsonValue = pbrObj.value(KEY_BASE_COLOR_TEX);
+ if (!jsonValue.isUndefined()) {
+ const QJsonObject texObj = jsonValue.toObject();
+ const QString textureId = QString::number(texObj.value(KEY_INDEX).toInt());
+ const auto it = m_textures.find(textureId);
+ if (Q_UNLIKELY(it == m_textures.end())) {
+ qCWarning(GLTFImporterLog, "unknown texture %ls", qUtf16PrintableImpl(textureId));
+ } else {
+ mrMaterial->setBaseColor(QVariant::fromValue(it.value()));
+ }
+ }
+
+ jsonValue = pbrObj.value(KEY_METAL_FACTOR);
+ if (!jsonValue.isUndefined())
+ mrMaterial->setMetalness(jsonValue.toVariant());
+
+ jsonValue = pbrObj.value(KEY_METAL_ROUGH_TEX);
+ if (!jsonValue.isUndefined()) {
+ const QJsonObject texObj = jsonValue.toObject();
+ const QString textureId = QString::number(texObj.value(KEY_INDEX).toInt());
+ const auto it = m_textures.find(textureId);
+ if (Q_UNLIKELY(it == m_textures.end())) {
+ qCWarning(GLTFImporterLog, "unknown texture %ls", qUtf16PrintableImpl(textureId));
+ } else {
+ // find the texture again
+ const QJsonArray texArray = m_json.object().value(KEY_TEXTURES).toArray();
+ const QJsonObject tObj = texArray.at(texObj.value(KEY_INDEX).toInt()).toObject();
+ const QString sourceId = QString::number(tObj.value(KEY_SOURCE).toInt());
+ QImage image;
+ if (m_imagePaths.contains(sourceId)) {
+ image.load(m_imagePaths.value(sourceId));
+ } else if (m_imageData.contains(sourceId)) {
+ image = m_imageData.value(sourceId);
+ } else {
+ return mrMaterial;
+ }
+
+ // at this point, in image there is data for metalness (on B) and
+ // roughness (on G) bytes. 2 new textures are created
+ // to make Qt3D happy, since it samples only on R.
+
+ QTexture2D* metalTex = new QTexture2D;
+ QTexture2D* roughTex = new QTexture2D;
+ GLTFRawTextureImage* metalImgTex = new GLTFRawTextureImage();
+ GLTFRawTextureImage* roughImgTex = new GLTFRawTextureImage();
+ QImage metalness(image.size(), image.format());
+ QImage roughness(image.size(), image.format());
+
+ const uchar *imgData = image.constBits();
+ const int pixelBytes = image.depth() / 8;
+ Q_ASSERT_X(pixelBytes < 3, "GLTFImporter::pbrMaterial", "Unsupported texture format");
+
+ for (int y = 0; y < image.height(); y++) {
+ for (int x = 0; x < image.width(); x++) {
+ metalness.setPixel(x, y, qRgb(imgData[0], imgData[0], imgData[0]));
+ roughness.setPixel(x, y, qRgb(imgData[1], imgData[1], imgData[1]));
+ imgData += pixelBytes;
+ }
+ }
+
+ metalImgTex->setImage(metalness);
+ metalTex->addTextureImage(metalImgTex);
+ roughImgTex->setImage(roughness);
+ roughTex->addTextureImage(roughImgTex);
+
+ setTextureSamplerInfo("", tObj, metalTex);
+ setTextureSamplerInfo("", tObj, roughTex);
+
+ mrMaterial->setMetalness(QVariant::fromValue(metalTex));
+ mrMaterial->setRoughness(QVariant::fromValue(roughTex));
+ }
+ }
+
+ jsonValue = pbrObj.value(KEY_ROUGH_FACTOR);
+ if (!jsonValue.isUndefined())
+ mrMaterial->setRoughness(jsonValue.toVariant());
+ }
+
+ jsonValue = jsonObj.value(KEY_NORMAL_TEX);
+ if (!jsonValue.isUndefined()) {
+ const QJsonObject texObj = jsonValue.toObject();
+ const QString textureId = QString::number(texObj.value(KEY_INDEX).toInt());
+ const auto it = m_textures.find(textureId);
+ if (Q_UNLIKELY(it == m_textures.end())) {
+ qCWarning(GLTFImporterLog, "unknown texture %ls", qUtf16PrintableImpl(textureId));
+ } else {
+ if (mrMaterial)
+ mrMaterial->setNormal(QVariant::fromValue(it.value()));
+ }
+ }
+
+ jsonValue = jsonObj.value(KEY_OCCLUSION_TEX);
+ if (!jsonValue.isUndefined()) {
+ const QJsonObject texObj = jsonValue.toObject();
+ const QString textureId = QString::number(texObj.value(KEY_INDEX).toInt());
+ const auto it = m_textures.find(textureId);
+ if (Q_UNLIKELY(it == m_textures.end())) {
+ qCWarning(GLTFImporterLog, "unknown texture %ls", qUtf16PrintableImpl(textureId));
+ } else {
+ if (mrMaterial)
+ mrMaterial->setAmbientOcclusion(QVariant::fromValue(it.value()));
+ }
+ }
+
+ return mrMaterial;
+}
+
QMaterial* GLTFImporter::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);
+ QJsonValue jsonVal;
+
+ if (m_majorVersion > 1) {
+ const QJsonArray mats = m_json.object().value(KEY_MATERIALS).toArray();
+ jsonVal = mats.at(id.toInt());
+ } else {
+ const QJsonObject mats = m_json.object().value(KEY_MATERIALS).toObject();
+ jsonVal = mats.value(id);
+ }
+
if (Q_UNLIKELY(jsonVal.isUndefined())) {
qCWarning(GLTFImporterLog, "unknown material %ls in GLTF file %ls",
qUtf16PrintableImpl(id), qUtf16PrintableImpl(m_basePath));
- return NULL;
+ return nullptr;
}
const QJsonObject jsonObj = jsonVal.toObject();
@@ -967,14 +1257,26 @@ QMaterial* GLTFImporter::material(const QString &id)
bool GLTFImporter::fillCamera(QCameraLens &lens, QCamera *cameraEntity, const QString &id) const
{
- const auto jsonVal = m_json.object().value(KEY_CAMERAS).toObject().value(id);
- if (Q_UNLIKELY(jsonVal.isUndefined())) {
- qCWarning(GLTFImporterLog, "unknown camera %ls in GLTF file %ls",
- qUtf16PrintableImpl(id), qUtf16PrintableImpl(m_basePath));
- return false;
+ QJsonObject jsonObj;
+
+ if (m_majorVersion > 1) {
+ const QJsonArray camArray = m_json.object().value(KEY_CAMERAS).toArray();
+ if (id.toInt() >= camArray.count()) {
+ qCWarning(GLTFImporterLog, "unknown camera %ls in GLTF file %ls",
+ qUtf16PrintableImpl(id), qUtf16PrintableImpl(m_basePath));
+ return false;
+ }
+ jsonObj = camArray[id.toInt()].toObject();
+ } else {
+ const auto jsonVal = m_json.object().value(KEY_CAMERAS).toObject().value(id);
+ if (Q_UNLIKELY(jsonVal.isUndefined())) {
+ qCWarning(GLTFImporterLog, "unknown camera %ls in GLTF file %ls",
+ qUtf16PrintableImpl(id), qUtf16PrintableImpl(m_basePath));
+ return false;
+ }
+ jsonObj = jsonVal.toObject();
}
- QJsonObject jsonObj = jsonVal.toObject();
QString camTy = jsonObj.value(KEY_TYPE).toString();
if (camTy == QLatin1String("perspective")) {
@@ -1025,12 +1327,26 @@ bool GLTFImporter::fillCamera(QCameraLens &lens, QCamera *cameraEntity, const QS
return true;
}
-
void GLTFImporter::parse()
{
if (m_parseDone)
return;
+ const QJsonValue asset = m_json.object().value(KEY_ASSET);
+ if (!asset.isUndefined())
+ processJSONAsset(asset.toObject());
+
+ if (m_majorVersion > 1) {
+ parseV2();
+ } else {
+ parseV1();
+ }
+
+ m_parseDone = true;
+}
+
+void GLTFImporter::parseV1()
+{
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());
@@ -1082,7 +1398,38 @@ void GLTFImporter::parse()
processJSONEffect(it.key(), it.value().toObject());
m_defaultScene = m_json.object().value(KEY_SCENE).toString();
- m_parseDone = true;
+}
+
+void GLTFImporter::parseV2()
+{
+ int i;
+ const QJsonArray buffers = m_json.object().value(KEY_BUFFERS).toArray();
+ for (i = 0; i < buffers.count(); i++)
+ processJSONBuffer(QString::number(i), buffers[i].toObject());
+
+ const QJsonArray views = m_json.object().value(KEY_BUFFER_VIEWS).toArray();
+ loadBufferData();
+ for (i = 0; i < views.count(); i++)
+ processJSONBufferView(QString::number(i), views[i].toObject());
+ unloadBufferData();
+
+ const QJsonArray accessors = m_json.object().value(KEY_ACCESSORS).toArray();
+ for (i = 0; i < accessors.count(); i++)
+ processJSONAccessor(QString::number(i), accessors[i].toObject());
+
+ const QJsonArray meshes = m_json.object().value(KEY_MESHES).toArray();
+ for (i = 0; i < meshes.count(); i++)
+ processJSONMesh(QString::number(i), meshes[i].toObject());
+
+ const QJsonArray images = m_json.object().value(KEY_IMAGES).toArray();
+ for (i = 0; i < images.count(); i++)
+ processJSONImage(QString::number(i), images[i].toObject());
+
+ const QJsonArray textures = m_json.object().value(KEY_TEXTURES).toArray();
+ for (i = 0; i < textures.count(); i++)
+ processJSONTexture(QString::number(i), textures[i].toObject());
+
+ m_defaultScene = QString::number(m_json.object().value(KEY_SCENE).toInt());
}
namespace {
@@ -1116,6 +1463,7 @@ void GLTFImporter::cleanup()
delete_if_without_parent(m_textures);
m_textures.clear();
m_imagePaths.clear();
+ m_imageData.clear();
m_defaultScene.clear();
m_parameterDataDict.clear();
delete_if_without_parent(m_renderPasses);
@@ -1124,6 +1472,18 @@ void GLTFImporter::cleanup()
m_effects.clear();
}
+void GLTFImporter::processJSONAsset(const QJsonObject &json)
+{
+ const QString version = json.value(KEY_VERSION).toString();
+ if (!version.isEmpty()) {
+ const QStringList verTokens = version.split('.');
+ if (verTokens.length() >= 2) {
+ m_majorVersion = verTokens[0].toInt();
+ m_minorVersion = verTokens[1].toInt();
+ }
+ }
+}
+
void GLTFImporter::processJSONBuffer(const QString &id, const QJsonObject& json)
{
// simply cache buffers for lookup by buffer-views
@@ -1132,7 +1492,12 @@ void GLTFImporter::processJSONBuffer(const QString &id, const QJsonObject& json)
void GLTFImporter::processJSONBufferView(const QString &id, const QJsonObject& json)
{
- QString bufName = json.value(KEY_BUFFER).toString();
+ QString bufName;
+ if (m_majorVersion > 1) {
+ bufName = QString::number(json.value(KEY_BUFFER).toInt());
+ } else {
+ bufName = json.value(KEY_BUFFER).toString();
+ }
const auto it = qAsConst(m_bufferDatas).find(bufName);
if (Q_UNLIKELY(it == m_bufferDatas.cend())) {
qCWarning(GLTFImporterLog, "unknown buffer: %ls processing view: %ls",
@@ -1141,7 +1506,13 @@ void GLTFImporter::processJSONBufferView(const QString &id, const QJsonObject& j
}
const auto &bufferData = *it;
- int target = json.value(KEY_TARGET).toInt();
+ const QJsonValue targetValue = json.value(KEY_TARGET);
+ int target;
+ if (targetValue.isUndefined()) {
+ target = GL_ARRAY_BUFFER;
+ } else {
+ target = targetValue.toInt();
+ }
Qt3DRender::QBuffer::BufferType ty(Qt3DRender::QBuffer::VertexBuffer);
switch (target) {
@@ -1180,14 +1551,21 @@ void GLTFImporter::processJSONShader(const QString &id, const QJsonObject &jsonO
// to the program section
QString path = jsonObject.value(KEY_URI).toString();
- QFileInfo info(m_basePath, path);
- if (Q_UNLIKELY(!info.exists())) {
- qCWarning(GLTFImporterLog, "can't find shader %ls from path %ls",
- qUtf16PrintableImpl(id), qUtf16PrintableImpl(path));
- return;
+ if (!isEmbeddedResource(path)) {
+ QFileInfo info(m_basePath, path);
+ if (Q_UNLIKELY(!info.exists())) {
+ qCWarning(GLTFImporterLog, "can't find shader %ls from path %ls",
+ qUtf16PrintableImpl(id), qUtf16PrintableImpl(path));
+ return;
+ }
+
+ m_shaderPaths[id] = info.absoluteFilePath();
+ } else {
+ const QByteArray base64Data = path.toLatin1().remove(0, path.indexOf(",") + 1);
+ m_shaderPaths[id] = QString(QByteArray::fromBase64(base64Data));
}
- m_shaderPaths[id] = info.absoluteFilePath();
+
}
void GLTFImporter::processJSONProgram(const QString &id, const QJsonObject &jsonObject)
@@ -1361,9 +1739,9 @@ void GLTFImporter::processJSONTechnique(const QString &id, const QJsonObject &js
m_techniques[id] = t;
}
-void GLTFImporter::processJSONAccessor( const QString &id, const QJsonObject& json )
+void GLTFImporter::processJSONAccessor(const QString &id, const QJsonObject& json)
{
- m_accessorDict[id] = AccessorData(json);
+ m_accessorDict[id] = AccessorData(json, m_majorVersion, m_minorVersion);
}
void GLTFImporter::processJSONMesh(const QString &id, const QJsonObject &json)
@@ -1374,22 +1752,27 @@ void GLTFImporter::processJSONMesh(const QString &id, const QJsonObject &json)
// Custom mesh
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();
+ const QJsonObject primitiveObject = primitiveValue.toObject();
+ const QJsonValue type = primitiveObject.value(KEY_MODE);
+ const QJsonValue matValue = primitiveObject.value(KEY_MATERIAL);
+ const QString material = (m_majorVersion > 1) ? QString::number(matValue.toInt()) : matValue.toString();
QGeometryRenderer *geometryRenderer = new QGeometryRenderer;
QGeometry *meshGeometry = new QGeometry(geometryRenderer);
//Set Primitive Type
- geometryRenderer->setPrimitiveType(static_cast<QGeometryRenderer::PrimitiveType>(type));
+ if (type.isUndefined()) {
+ geometryRenderer->setPrimitiveType(QGeometryRenderer::Triangles);
+ } else {
+ geometryRenderer->setPrimitiveType(static_cast<QGeometryRenderer::PrimitiveType>(type.toInt()));
+ }
//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 QString k = (m_majorVersion > 1) ? QString::number(it.value().toInt()) : it.value().toString();
const auto accessorIt = qAsConst(m_accessorDict).find(k);
if (Q_UNLIKELY(accessorIt == m_accessorDict.cend())) {
qCWarning(GLTFImporterLog, "unknown attribute accessor: %ls on mesh %ls",
@@ -1424,18 +1807,16 @@ void GLTFImporter::processJSONMesh(const QString &id, const QJsonObject &json)
const auto indices = primitiveObject.value(KEY_INDICES);
if (!indices.isUndefined()) {
- QString k = indices.toString();
- const auto accessorIt = qAsConst(m_accessorDict).find(k);
+ const QString accIndex = (m_majorVersion > 1) ? QString::number(indices.toInt()) : indices.toString();
+ const auto accessorIt = qAsConst(m_accessorDict).find(accIndex);
if (Q_UNLIKELY(accessorIt == m_accessorDict.cend())) {
qCWarning(GLTFImporterLog, "unknown index accessor: %ls on mesh %ls",
- qUtf16PrintableImpl(k), qUtf16PrintableImpl(id));
+ qUtf16PrintableImpl(accIndex), qUtf16PrintableImpl(id));
} else {
//Get buffer handle for accessor
- Qt3DRender::QBuffer *buffer = m_buffers.value(accessorIt->bufferViewName,
- nullptr);
+ Qt3DRender::QBuffer *buffer = m_buffers.value(accessorIt->bufferViewName, nullptr);
if (Q_UNLIKELY(!buffer)) {
- qCWarning(GLTFImporterLog,
- "unknown buffer-view: %ls processing accessor: %ls",
+ qCWarning(GLTFImporterLog, "unknown buffer-view: %ls processing accessor: %ls",
qUtf16PrintableImpl(accessorIt->bufferViewName),
qUtf16PrintableImpl(id));
continue;
@@ -1505,7 +1886,9 @@ void GLTFImporter::processJSONMesh(const QString &id, const QJsonObject &json)
}
}
mesh->setObjectName(meshName);
- m_meshMaterialDict[mesh] = json.value(KEY_MATERIAL).toString();
+ m_meshMaterialDict[mesh] = (m_majorVersion > 1) ?
+ QString::number(json.value(KEY_MATERIAL).toInt()) :
+ json.value(KEY_MATERIAL).toString();
m_meshDict.insert(id, mesh);
}
}
@@ -1514,66 +1897,73 @@ void GLTFImporter::processJSONMesh(const QString &id, const QJsonObject &json)
void GLTFImporter::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(GLTFImporterLog, "can't find image %ls from path %ls",
- qUtf16PrintableImpl(id), qUtf16PrintableImpl(path));
- return;
- }
- m_imagePaths[id] = info.absoluteFilePath();
+ if (!isEmbeddedResource(path)) {
+ QFileInfo info(m_basePath, path);
+ if (Q_UNLIKELY(!info.exists())) {
+ qCWarning(GLTFImporterLog, "can't find image %ls from path %ls",
+ qUtf16PrintableImpl(id), qUtf16PrintableImpl(path));
+ return;
+ }
+
+ m_imagePaths[id] = info.absoluteFilePath();
+ } else {
+ const QByteArray base64Data = path.toLatin1().remove(0, path.indexOf(",") + 1);
+ QImage image;
+ image.loadFromData(QByteArray::fromBase64(base64Data));
+ m_imageData[id] = image;
+ }
}
void GLTFImporter::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(GLTFImporterLog, "unsupported texture target: %d", target);
- return;
+ QJsonValue jsonVal = jsonObject.value(KEY_TARGET);
+ if (!jsonVal.isUndefined()) {
+ int target = jsonVal.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(GLTFImporterLog, "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);
+ int internalFormat = GL_RGBA;
+ jsonVal = jsonObject.value(KEY_INTERNAL_FORMAT);
+ if (!jsonVal.isUndefined())
+ 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();
+ QJsonValue srcValue = jsonObject.value(KEY_SOURCE);
+ QString source = (m_majorVersion > 1) ? QString::number(srcValue.toInt()) : srcValue.toString();
+
const auto imagIt = qAsConst(m_imagePaths).find(source);
if (Q_UNLIKELY(imagIt == m_imagePaths.cend())) {
- qCWarning(GLTFImporterLog, "texture %ls references missing image %ls",
- qUtf16PrintableImpl(id), qUtf16PrintableImpl(source));
- return;
- }
-
- QTextureImage *texImage = new QTextureImage(tex);
- texImage->setMirrored(false);
- texImage->setSource(QUrl::fromLocalFile(imagIt.value()));
- tex->addTextureImage(texImage);
+ // if an image is not found in paths, it probably means
+ // it was an embedded resource, referenced in m_imageData
+ const auto embImgIt = qAsConst(m_imageData).find(source);
+ if (Q_UNLIKELY(embImgIt == m_imageData.cend())) {
+ qCWarning(GLTFImporterLog, "texture %ls references missing image %ls",
+ qUtf16PrintableImpl(id), qUtf16PrintableImpl(source));
+ return;
+ }
- const auto samplersDictValue = m_json.object().value(KEY_SAMPLERS).toObject().value(samplerId);
- if (Q_UNLIKELY(samplersDictValue.isUndefined())) {
- qCWarning(GLTFImporterLog, "texture %ls references unknown sampler %ls",
- qUtf16PrintableImpl(id), qUtf16PrintableImpl(samplerId));
- return;
+ QImage img = embImgIt.value();
+ GLTFRawTextureImage *imageData = new GLTFRawTextureImage();
+ imageData->setImage(img);
+ tex->addTextureImage(imageData);
+ } else {
+ QTextureImage *texImage = new QTextureImage(tex);
+ texImage->setMirrored(false);
+ texImage->setSource(QUrl::fromLocalFile(imagIt.value()));
+ tex->addTextureImage(texImage);
}
- 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()));
+ setTextureSamplerInfo(id, jsonObject, tex);
m_textures[id] = tex;
}
@@ -1708,10 +2098,16 @@ QByteArray GLTFImporter::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();
+ // check for embedded data
+ if (isEmbeddedResource(path)) {
+ const QByteArray base64Data = path.toLatin1().remove(0, path.indexOf(",") + 1);
+ return QByteArray::fromBase64(base64Data);
+ } else {
+ const QString absPath = d.absoluteFilePath(path);
+ QFile f(absPath);
+ f.open(QIODevice::ReadOnly);
+ return f.readAll();
+ }
}
QVariant GLTFImporter::parameterValueFromJSON(int type, const QJsonValue &value) const
@@ -2167,9 +2563,85 @@ void GLTFImporter::addProgramToPass(QRenderPass *pass, const QString &progName)
pass->setShaderProgram(progIt.value());
}
+void GLTFImporter::setTextureSamplerInfo(const QString &id, const QJsonObject &jsonObj, QTexture2D *tex)
+{
+ QJsonObject sampler;
+ const QJsonValue jsonValue = jsonObj.value(KEY_SAMPLER);
+ if (jsonValue.isUndefined())
+ return;
+
+ if (m_majorVersion > 1) {
+ const int samplerId = jsonValue.toInt();
+ const QJsonArray sArray = m_json.object().value(KEY_SAMPLERS).toArray();
+ if (Q_UNLIKELY(samplerId >= sArray.count())) {
+ qCWarning(GLTFImporterLog, "texture %ls references unknown sampler %d",
+ qUtf16PrintableImpl(id), samplerId);
+ return;
+ }
+ sampler = sArray[samplerId].toObject();
+ } else {
+ const QString samplerId = jsonValue.toString();
+ const QJsonValue samplersDictValue = m_json.object().value(KEY_SAMPLERS).toObject().value(samplerId);
+ if (Q_UNLIKELY(samplersDictValue.isUndefined())) {
+ qCWarning(GLTFImporterLog, "texture %ls references unknown sampler %ls",
+ qUtf16PrintableImpl(id), qUtf16PrintableImpl(samplerId));
+ return;
+ }
+ 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()));
+}
+
+GLTFRawTextureImage::GLTFRawTextureImage(QNode *parent)
+ : QAbstractTextureImage(parent)
+{
+}
+
+QTextureImageDataGeneratorPtr GLTFRawTextureImage::dataGenerator() const
+{
+ return QTextureImageDataGeneratorPtr(new GLTFRawTextureImageFunctor(m_image));
+}
+
+void GLTFRawTextureImage::setImage(const QImage &image)
+{
+ if (image != m_image) {
+ m_image = image;
+ notifyDataGeneratorChanged();
+ }
+}
+
+GLTFRawTextureImage::GLTFRawTextureImageFunctor::GLTFRawTextureImageFunctor(const QImage &image)
+ : QTextureImageDataGenerator()
+ , m_image(image)
+{
+}
+
+QTextureImageDataPtr GLTFRawTextureImage::GLTFRawTextureImageFunctor::operator()()
+{
+ QTextureImageDataPtr dataPtr = QTextureImageDataPtr::create();
+ // Note: we assume 4 components per pixel and not compressed for now
+ dataPtr->setImage(m_image);
+ return dataPtr;
+}
+
+bool GLTFRawTextureImage::GLTFRawTextureImageFunctor::operator ==(const QTextureImageDataGenerator &other) const
+{
+ const GLTFRawTextureImageFunctor *otherFunctor = functor_cast<GLTFRawTextureImageFunctor>(&other);
+ return (otherFunctor != nullptr && otherFunctor->m_image == m_image);
+}
} // namespace Qt3DRender
QT_END_NAMESPACE
-#include "moc_gltfimporter.cpp"
+#include "gltfimporter.moc"
diff --git a/src/plugins/sceneparsers/gltf/gltfimporter.h b/src/plugins/sceneparsers/gltf/gltfimporter.h
index d47a6a729..271ce5979 100644
--- a/src/plugins/sceneparsers/gltf/gltfimporter.h
+++ b/src/plugins/sceneparsers/gltf/gltfimporter.h
@@ -57,6 +57,7 @@
#include <QtCore/qjsondocument.h>
#include <QtCore/qjsonobject.h>
#include <QtCore/qhash.h>
+#include <QtCore/qloggingcategory.h>
#include <Qt3DRender/private/qsceneimporter_p.h>
@@ -82,6 +83,7 @@ class QParameter;
class QGeometryRenderer;
class QAbstractLight;
class QRenderPass;
+class QTexture2D;
Q_DECLARE_LOGGING_CATEGORY(GLTFImporterLog)
@@ -94,7 +96,7 @@ public:
~GLTFImporter();
void setBasePath(const QString& path);
- bool setJSON( const QJsonDocument &json );
+ bool setJSON(const QJsonDocument &json);
// SceneParserInterface interface
void setSource(const QUrl &source) final;
@@ -130,7 +132,7 @@ private:
{
public:
AccessorData();
- explicit AccessorData(const QJsonObject& json);
+ explicit AccessorData(const QJsonObject& json, int major, int minor);
QString bufferViewName;
QAttribute::VertexBaseType type;
@@ -141,6 +143,7 @@ private:
};
static bool isGLTFSupported(const QStringList &extensions);
+ static bool isEmbeddedResource(const QString &url);
static void renameFromJson(const QJsonObject& json, QObject * const object );
static bool hasStandardUniformNameFromSemantic(const QString &semantic);
static QString standardAttributeNameFromSemantic(const QString &semantic);
@@ -151,8 +154,11 @@ private:
bool fillCamera(QCameraLens &lens, QCamera *cameraEntity, const QString &id) const;
void parse();
+ void parseV1();
+ void parseV2();
void cleanup();
+ void processJSONAsset(const QJsonObject &json);
void processJSONBuffer(const QString &id, const QJsonObject &json);
void processJSONBufferView(const QString &id, const QJsonObject &json);
void processJSONShader(const QString &id, const QJsonObject &jsonObject);
@@ -181,12 +187,16 @@ private:
void populateRenderStates(QRenderPass *pass, const QJsonObject &states);
void addProgramToPass(QRenderPass *pass, const QString &progName);
+ void setTextureSamplerInfo(const QString &id, const QJsonObject &jsonObj, QTexture2D *tex);
QMaterial *materialWithCustomShader(const QString &id, const QJsonObject &jsonObj);
QMaterial *commonMaterial(const QJsonObject &jsonObj);
+ QMaterial *pbrMaterial(const QJsonObject &jsonObj);
QJsonDocument m_json;
QString m_basePath;
bool m_parseDone;
+ int m_majorVersion;
+ int m_minorVersion;
QString m_defaultScene;
// multi-hash because our QMeshData corresponds to a single primitive
@@ -215,6 +225,7 @@ private:
QHash<QString, QAbstractTexture*> m_textures;
QHash<QString, QString> m_imagePaths;
+ QHash<QString, QImage> m_imageData;
QHash<QString, QAbstractLight *> m_lights;
};
diff --git a/src/quick3d/imports/animation/plugins.qmltypes b/src/quick3d/imports/animation/plugins.qmltypes
index ad2bc8812..a8f207245 100644
--- a/src/quick3d/imports/animation/plugins.qmltypes
+++ b/src/quick3d/imports/animation/plugins.qmltypes
@@ -4,7 +4,7 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable -dependencies dependencies.json Qt3D.Animation 2.12'
+// 'qmlplugindump -nonrelocatable -dependencies dependencies.json Qt3D.Animation 2.13'
Module {
dependencies: ["Qt3D.Core 2.0"]
diff --git a/src/quick3d/imports/core/plugins.qmltypes b/src/quick3d/imports/core/plugins.qmltypes
index 4c0719a97..390fd78fb 100644
--- a/src/quick3d/imports/core/plugins.qmltypes
+++ b/src/quick3d/imports/core/plugins.qmltypes
@@ -4,10 +4,10 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable Qt3D.Core 2.12'
+// 'qmlplugindump -nonrelocatable Qt3D.Core 2.13'
Module {
- dependencies: ["QtQuick 2.12"]
+ dependencies: ["QtQuick 2.0"]
Component {
name: "Qt3DCore::QAbstractSkeleton"
prototype: "Qt3DCore::QNode"
diff --git a/src/quick3d/imports/extras/plugins.qmltypes b/src/quick3d/imports/extras/plugins.qmltypes
index ecfeaed8f..72857d402 100644
--- a/src/quick3d/imports/extras/plugins.qmltypes
+++ b/src/quick3d/imports/extras/plugins.qmltypes
@@ -4,7 +4,7 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable -dependencies dependencies.json Qt3D.Extras 2.12'
+// 'qmlplugindump -nonrelocatable -dependencies dependencies.json Qt3D.Extras 2.13'
Module {
dependencies: ["Qt3D.Logic 2.0", "Qt3D.Render 2.0"]
diff --git a/src/quick3d/imports/extras/qt3dquick3dextrasplugin.cpp b/src/quick3d/imports/extras/qt3dquick3dextrasplugin.cpp
index 65b8863a1..91ec85795 100644
--- a/src/quick3d/imports/extras/qt3dquick3dextrasplugin.cpp
+++ b/src/quick3d/imports/extras/qt3dquick3dextrasplugin.cpp
@@ -113,7 +113,10 @@ void Qt3DQuick3DExtrasPlugin::registerTypes(const char *uri)
qmlRegisterType<Qt3DExtras::QDiffuseSpecularMaterial>(uri, 2, 10, "DiffuseSpecularMaterial");
qmlRegisterType<Qt3DExtras::QMetalRoughMaterial>(uri, 2, 9, "MetalRoughMaterial");
qmlRegisterType<Qt3DExtras::QMetalRoughMaterial, 10>(uri, 2, 10, "MetalRoughMaterial");
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
qmlRegisterType<Qt3DExtras::QTexturedMetalRoughMaterial>(uri, 2, 9, "TexturedMetalRoughMaterial");
+QT_WARNING_POP
qmlRegisterType<Qt3DExtras::QMorphPhongMaterial>(uri, 2, 9, "MorphPhongMaterial");
qmlRegisterType<Qt3DExtras::QSpriteGrid>(uri, 2, 10, "SpriteGrid");
diff --git a/src/quick3d/imports/input/plugins.qmltypes b/src/quick3d/imports/input/plugins.qmltypes
index a4662fc5e..8e9cac4d1 100644
--- a/src/quick3d/imports/input/plugins.qmltypes
+++ b/src/quick3d/imports/input/plugins.qmltypes
@@ -4,7 +4,7 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable -dependencies dependencies.json Qt3D.Input 2.12'
+// 'qmlplugindump -nonrelocatable -dependencies dependencies.json Qt3D.Input 2.13'
Module {
dependencies: ["Qt3D.Core 2.0"]
diff --git a/src/quick3d/imports/logic/plugins.qmltypes b/src/quick3d/imports/logic/plugins.qmltypes
index 20071117d..294f6b068 100644
--- a/src/quick3d/imports/logic/plugins.qmltypes
+++ b/src/quick3d/imports/logic/plugins.qmltypes
@@ -4,7 +4,7 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable -dependencies dependencies.json Qt3D.Logic 2.12'
+// 'qmlplugindump -nonrelocatable -dependencies dependencies.json Qt3D.Logic 2.13'
Module {
dependencies: ["Qt3D.Core 2.0"]
diff --git a/src/quick3d/imports/render/plugins.qmltypes b/src/quick3d/imports/render/plugins.qmltypes
index a801f99e0..f5f5b3c61 100644
--- a/src/quick3d/imports/render/plugins.qmltypes
+++ b/src/quick3d/imports/render/plugins.qmltypes
@@ -4,7 +4,7 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable -dependencies dependencies.json Qt3D.Render 2.12'
+// 'qmlplugindump -nonrelocatable -dependencies dependencies.json Qt3D.Render 2.13'
Module {
dependencies: ["Qt3D.Core 2.0"]
@@ -48,6 +48,7 @@ Module {
Property { name: "visibility"; revision: 1; type: "Visibility" }
Property { name: "contentOrientation"; type: "Qt::ScreenOrientation" }
Property { name: "opacity"; revision: 1; type: "double" }
+ Property { name: "transientParent"; revision: 13; type: "QWindow"; isPointer: true }
Signal {
name: "screenChanged"
Parameter { name: "screen"; type: "QScreen"; isPointer: true }
@@ -120,6 +121,11 @@ Module {
revision: 1
Parameter { name: "opacity"; type: "double" }
}
+ Signal {
+ name: "transientParentChanged"
+ revision: 13
+ Parameter { name: "transientParent"; type: "QWindow"; isPointer: true }
+ }
Method { name: "requestActivate"; revision: 1 }
Method {
name: "setVisible"
@@ -268,9 +274,9 @@ Module {
Component {
name: "Qt3DRender::QAbstractTexture"
prototype: "Qt3DCore::QNode"
- exports: ["Qt3D.Render/Texture 2.0"]
+ exports: ["Qt3D.Render/Texture 2.0", "Qt3D.Render/Texture 2.13"]
isCreatable: false
- exportMetaObjectRevisions: [0]
+ exportMetaObjectRevisions: [0, 13]
Enum {
name: "Status"
values: {
@@ -443,6 +449,13 @@ Module {
"CompareNone": 0
}
}
+ Enum {
+ name: "HandleType"
+ values: {
+ "NoHandle": 0,
+ "OpenGLTextureId": 1
+ }
+ }
Property { name: "target"; type: "Target"; isReadonly: true }
Property { name: "format"; type: "TextureFormat" }
Property { name: "generateMipMaps"; type: "bool" }
@@ -463,6 +476,8 @@ Module {
Property { name: "comparisonMode"; type: "ComparisonMode" }
Property { name: "layers"; type: "int" }
Property { name: "samples"; type: "int" }
+ Property { name: "handleType"; revision: 13; type: "HandleType"; isReadonly: true }
+ Property { name: "handle"; revision: 13; type: "QVariant"; isReadonly: true }
Signal {
name: "formatChanged"
Parameter { name: "format"; type: "TextureFormat" }
@@ -515,6 +530,16 @@ Module {
name: "samplesChanged"
Parameter { name: "samples"; type: "int" }
}
+ Signal {
+ name: "handleTypeChanged"
+ revision: 13
+ Parameter { name: "handleType"; type: "HandleType" }
+ }
+ Signal {
+ name: "handleChanged"
+ revision: 13
+ Parameter { name: "handle"; type: "QVariant" }
+ }
Method {
name: "setFormat"
Parameter { name: "format"; type: "TextureFormat" }
@@ -644,8 +669,12 @@ Module {
Component {
name: "Qt3DRender::QAttribute"
prototype: "Qt3DCore::QNode"
- exports: ["Qt3D.Render/Attribute 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "Qt3D.Render/Attribute 2.0",
+ "Qt3D.Render/Attribute 2.10",
+ "Qt3D.Render/Attribute 2.11"
+ ]
+ exportMetaObjectRevisions: [0, 10, 11]
Enum {
name: "AttributeType"
values: {
@@ -1557,11 +1586,22 @@ Module {
Component {
name: "Qt3DRender::QComputeCommand"
prototype: "Qt3DCore::QComponent"
- exports: ["Qt3D.Render/ComputeCommand 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "Qt3D.Render/ComputeCommand 2.0",
+ "Qt3D.Render/ComputeCommand 2.13"
+ ]
+ exportMetaObjectRevisions: [0, 13]
+ Enum {
+ name: "RunType"
+ values: {
+ "Continuous": 0,
+ "Manual": 1
+ }
+ }
Property { name: "workGroupX"; type: "int" }
Property { name: "workGroupY"; type: "int" }
Property { name: "workGroupZ"; type: "int" }
+ Property { name: "runType"; revision: 13; type: "RunType" }
Method {
name: "setWorkGroupX"
Parameter { name: "workGroupX"; type: "int" }
@@ -1574,6 +1614,32 @@ Module {
name: "setWorkGroupZ"
Parameter { name: "workGroupZ"; type: "int" }
}
+ Method {
+ name: "setRunType"
+ revision: 13
+ Parameter { name: "runType"; type: "RunType" }
+ }
+ Method {
+ name: "trigger"
+ revision: 13
+ Parameter { name: "frameCount"; type: "int" }
+ }
+ Method { name: "trigger"; revision: 13 }
+ Method {
+ name: "trigger"
+ revision: 13
+ Parameter { name: "workGroupX"; type: "int" }
+ Parameter { name: "workGroupY"; type: "int" }
+ Parameter { name: "workGroupZ"; type: "int" }
+ Parameter { name: "frameCount"; type: "int" }
+ }
+ Method {
+ name: "trigger"
+ revision: 13
+ Parameter { name: "workGroupX"; type: "int" }
+ Parameter { name: "workGroupY"; type: "int" }
+ Parameter { name: "workGroupZ"; type: "int" }
+ }
}
Component {
name: "Qt3DRender::QCullFace"
@@ -1787,10 +1853,22 @@ Module {
type: "Qt3DRender::QAttribute"
isPointer: true
}
+ Property { name: "minExtent"; revision: 13; type: "QVector3D"; isReadonly: true }
+ Property { name: "maxExtent"; revision: 13; type: "QVector3D"; isReadonly: true }
Signal {
name: "boundingVolumePositionAttributeChanged"
Parameter { name: "boundingVolumePositionAttribute"; type: "QAttribute"; isPointer: true }
}
+ Signal {
+ name: "minExtentChanged"
+ revision: 13
+ Parameter { name: "minExtent"; type: "QVector3D" }
+ }
+ Signal {
+ name: "maxExtentChanged"
+ revision: 13
+ Parameter { name: "maxExtent"; type: "QVector3D" }
+ }
Method {
name: "setBoundingVolumePositionAttribute"
Parameter { name: "boundingVolumePositionAttribute"; type: "QAttribute"; isPointer: true }
@@ -2261,13 +2339,15 @@ Module {
prototype: "Qt3DCore::QComponent"
exports: [
"Qt3D.Render/ObjectPicker 2.0",
+ "Qt3D.Render/ObjectPicker 2.13",
"Qt3D.Render/ObjectPicker 2.9"
]
- exportMetaObjectRevisions: [0, 9]
+ exportMetaObjectRevisions: [0, 13, 9]
Property { name: "hoverEnabled"; type: "bool" }
Property { name: "dragEnabled"; type: "bool" }
Property { name: "pressed"; type: "bool"; isReadonly: true }
Property { name: "containsMouse"; type: "bool"; isReadonly: true }
+ Property { name: "priority"; revision: 13; type: "int" }
Signal {
name: "pressed"
Parameter { name: "pick"; type: "Qt3DRender::QPickEvent"; isPointer: true }
@@ -2302,6 +2382,11 @@ Module {
name: "containsMouseChanged"
Parameter { name: "containsMouse"; type: "bool" }
}
+ Signal {
+ name: "priorityChanged"
+ revision: 13
+ Parameter { name: "priority"; type: "int" }
+ }
Method {
name: "setHoverEnabled"
Parameter { name: "hoverEnabled"; type: "bool" }
@@ -2310,6 +2395,11 @@ Module {
name: "setDragEnabled"
Parameter { name: "dragEnabled"; type: "bool" }
}
+ Method {
+ name: "setPriority"
+ revision: 13
+ Parameter { name: "priority"; type: "int" }
+ }
}
Component {
name: "Qt3DRender::QParameter"
@@ -2399,7 +2489,8 @@ Module {
name: "PickResultMode"
values: {
"NearestPick": 0,
- "AllPicks": 1
+ "AllPicks": 1,
+ "NearestPriorityPick": 2
}
}
Enum {
@@ -3030,6 +3121,29 @@ Module {
exportMetaObjectRevisions: [0]
}
Component {
+ name: "Qt3DRender::QSetFence"
+ prototype: "Qt3DRender::QFrameGraphNode"
+ exports: ["Qt3D.Render/SetFence 2.13"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "HandleType"
+ values: {
+ "NoHandle": 0,
+ "OpenGLFenceId": 1
+ }
+ }
+ Property { name: "handleType"; type: "HandleType"; isReadonly: true }
+ Property { name: "handle"; type: "QVariant"; isReadonly: true }
+ Signal {
+ name: "handleTypeChanged"
+ Parameter { name: "handleType"; type: "HandleType" }
+ }
+ Signal {
+ name: "handleChanged"
+ Parameter { name: "handle"; type: "QVariant" }
+ }
+ }
+ Component {
name: "Qt3DRender::QShaderData"
prototype: "Qt3DCore::QComponent"
exports: ["Qt3D.Render/QShaderData 2.0"]
@@ -3136,8 +3250,11 @@ Module {
Component {
name: "Qt3DRender::QShaderProgramBuilder"
prototype: "Qt3DCore::QNode"
- exports: ["Qt3D.Render/ShaderProgramBuilder 2.10"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "Qt3D.Render/ShaderProgramBuilder 2.10",
+ "Qt3D.Render/ShaderProgramBuilder 2.13"
+ ]
+ exportMetaObjectRevisions: [0, 13]
Property { name: "shaderProgram"; type: "Qt3DRender::QShaderProgram"; isPointer: true }
Property { name: "enabledLayers"; type: "QStringList" }
Property { name: "vertexShaderGraph"; type: "QUrl" }
@@ -3146,6 +3263,22 @@ Module {
Property { name: "geometryShaderGraph"; type: "QUrl" }
Property { name: "fragmentShaderGraph"; type: "QUrl" }
Property { name: "computeShaderGraph"; type: "QUrl" }
+ Property { name: "vertexShaderCode"; revision: 13; type: "QByteArray"; isReadonly: true }
+ Property {
+ name: "tessellationControlShaderCode"
+ revision: 13
+ type: "QByteArray"
+ isReadonly: true
+ }
+ Property {
+ name: "tessellationEvaluationShaderCode"
+ revision: 13
+ type: "QByteArray"
+ isReadonly: true
+ }
+ Property { name: "geometryShaderCode"; revision: 13; type: "QByteArray"; isReadonly: true }
+ Property { name: "fragmentShaderCode"; revision: 13; type: "QByteArray"; isReadonly: true }
+ Property { name: "computeShaderCode"; revision: 13; type: "QByteArray"; isReadonly: true }
Signal {
name: "shaderProgramChanged"
Parameter { name: "shaderProgram"; type: "Qt3DRender::QShaderProgram"; isPointer: true }
@@ -3178,6 +3311,36 @@ Module {
name: "computeShaderGraphChanged"
Parameter { name: "computeShaderGraph"; type: "QUrl" }
}
+ Signal {
+ name: "vertexShaderCodeChanged"
+ revision: 13
+ Parameter { name: "vertexShaderCode"; type: "QByteArray" }
+ }
+ Signal {
+ name: "tessellationControlShaderCodeChanged"
+ revision: 13
+ Parameter { name: "tessellationControlShaderCode"; type: "QByteArray" }
+ }
+ Signal {
+ name: "tessellationEvaluationShaderCodeChanged"
+ revision: 13
+ Parameter { name: "tessellationEvaluationShaderCode"; type: "QByteArray" }
+ }
+ Signal {
+ name: "geometryShaderCodeChanged"
+ revision: 13
+ Parameter { name: "geometryShaderCode"; type: "QByteArray" }
+ }
+ Signal {
+ name: "fragmentShaderCodeChanged"
+ revision: 13
+ Parameter { name: "fragmentShaderCode"; type: "QByteArray" }
+ }
+ Signal {
+ name: "computeShaderCodeChanged"
+ revision: 13
+ Parameter { name: "computeShaderCode"; type: "QByteArray" }
+ }
Method {
name: "setShaderProgram"
Parameter { name: "program"; type: "Qt3DRender::QShaderProgram"; isPointer: true }
@@ -3212,6 +3375,21 @@ Module {
}
}
Component {
+ name: "Qt3DRender::QSharedGLTexture"
+ prototype: "Qt3DRender::QAbstractTexture"
+ exports: ["Qt3D.Render/SharedGLTexture 2.13"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "textureId"; type: "int" }
+ Signal {
+ name: "textureIdChanged"
+ Parameter { name: "textureId"; type: "int" }
+ }
+ Method {
+ name: "setTextureId"
+ Parameter { name: "id"; type: "int" }
+ }
+ }
+ Component {
name: "Qt3DRender::QSortPolicy"
prototype: "Qt3DRender::QFrameGraphNode"
exports: ["Qt3D.Render/SortPolicy 2.0"]
@@ -3821,6 +3999,39 @@ Module {
}
}
Component {
+ name: "Qt3DRender::QWaitFence"
+ prototype: "Qt3DRender::QFrameGraphNode"
+ exports: ["Qt3D.Render/WaitFence 2.13"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "HandleType"
+ values: {
+ "NoHandle": 0,
+ "OpenGLFenceId": 1
+ }
+ }
+ Property { name: "handleType"; type: "HandleType" }
+ Property { name: "handle"; type: "QVariant" }
+ Property { name: "waitOnCPU"; type: "bool" }
+ Property { name: "timeout"; type: "qulonglong" }
+ Signal {
+ name: "waitOnCPUChanged"
+ Parameter { name: "waitOnCPU"; type: "bool" }
+ }
+ Signal {
+ name: "timeoutChanged"
+ Parameter { name: "timeoutChanged"; type: "qulonglong" }
+ }
+ Signal {
+ name: "handleTypeChanged"
+ Parameter { name: "handleType"; type: "HandleType" }
+ }
+ Signal {
+ name: "handleChanged"
+ Parameter { name: "handle"; type: "QVariant" }
+ }
+ }
+ Component {
name: "Qt3DRender::Render::Quick::Quick3DBuffer"
prototype: "Qt3DRender::QBuffer"
exports: ["Qt3D.Render/Buffer 2.0"]
diff --git a/src/quick3d/imports/render/qt3dquick3drenderplugin.cpp b/src/quick3d/imports/render/qt3dquick3drenderplugin.cpp
index 4d2d5d19c..3f4a1278e 100644
--- a/src/quick3d/imports/render/qt3dquick3drenderplugin.cpp
+++ b/src/quick3d/imports/render/qt3dquick3drenderplugin.cpp
@@ -112,6 +112,8 @@
#include <Qt3DRender/qviewport.h>
#include <Qt3DRender/qproximityfilter.h>
#include <Qt3DRender/qblitframebuffer.h>
+#include <Qt3DRender/qsetfence.h>
+#include <Qt3DRender/qwaitfence.h>
#include <QtGui/qwindow.h>
@@ -178,6 +180,7 @@ void Qt3DQuick3DRenderPlugin::registerTypes(const char *uri)
qmlRegisterType<Qt3DRender::QShaderProgram>(uri, 2, 0, "ShaderProgram");
qmlRegisterType<Qt3DRender::QShaderProgram, 9>(uri, 2, 9, "ShaderProgram");
qmlRegisterType<Qt3DRender::QShaderProgramBuilder>(uri, 2, 10, "ShaderProgramBuilder");
+ qmlRegisterType<Qt3DRender::QShaderProgramBuilder, 13>(uri, 2, 13, "ShaderProgramBuilder");
qmlRegisterUncreatableType<Qt3DRender::QShaderData>(uri, 2, 0, "QShaderData", "Quick3D should instantiate Quick3DShaderData only");
qmlRegisterType<Qt3DRender::Render::Quick::Quick3DShaderDataArray>(uri, 2, 0, "ShaderDataArray");
qmlRegisterType<Qt3DRender::Render::Quick::Quick3DShaderData>(uri, 2, 0, "ShaderData");
@@ -191,6 +194,7 @@ void Qt3DQuick3DRenderPlugin::registerTypes(const char *uri)
// Textures
qmlRegisterType<Qt3DRender::QTextureWrapMode>(uri, 2, 0, "WrapMode");//, QStringLiteral("QTextureWrapMode cannot be created from QML"));
qmlRegisterUncreatableType<Qt3DRender::QAbstractTexture>(uri, 2, 0, "Texture", QStringLiteral("Texture should be created from one of the subclasses"));
+ qmlRegisterUncreatableType<Qt3DRender::QAbstractTexture, 13>(uri, 2, 13, "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");
@@ -205,6 +209,7 @@ void Qt3DQuick3DRenderPlugin::registerTypes(const char *uri)
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");
+ qmlRegisterType<Qt3DRender::QSharedGLTexture>(uri, 2, 13, "SharedGLTexture");
// Geometry
qmlRegisterType<Qt3DRender::QAttribute>(uri, 2, 0, "Attribute");
@@ -225,12 +230,14 @@ void Qt3DQuick3DRenderPlugin::registerTypes(const char *uri)
// Picking
qmlRegisterType<Qt3DRender::QObjectPicker>(uri, 2, 0, "ObjectPicker");
qmlRegisterType<Qt3DRender::QObjectPicker, 9>(uri, 2, 9, "ObjectPicker");
+ qmlRegisterType<Qt3DRender::QObjectPicker, 13>(uri, 2, 13, "ObjectPicker");
qmlRegisterUncreatableType<Qt3DRender::QPickEvent>(uri, 2, 0, "PickEvent", QStringLiteral("Events cannot be created"));
qmlRegisterType<Qt3DRender::Render::Quick::Quick3DRayCaster>(uri, 2, 11, "RayCaster");
qmlRegisterType<Qt3DRender::Render::Quick::Quick3DScreenRayCaster>(uri, 2, 11, "ScreenRayCaster");
// Compute Job
qmlRegisterType<Qt3DRender::QComputeCommand>(uri, 2, 0, "ComputeCommand");
+ qmlRegisterType<Qt3DRender::QComputeCommand, 13>(uri, 2, 13, "ComputeCommand");
// Layers
qmlRegisterType<Qt3DRender::QLayer>(uri, 2, 0, "Layer");
@@ -263,6 +270,8 @@ void Qt3DQuick3DRenderPlugin::registerTypes(const char *uri)
Qt3DRender::Quick::registerExtendedType<Qt3DRender::QMemoryBarrier, Qt3DRender::Render::Quick::Quick3DMemoryBarrier>("QMemoryBarrier", "Qt3D.Render/MemoryBarrier", uri, 2, 9, "MemoryBarrier");
qmlRegisterType<Qt3DRender::QProximityFilter>(uri, 2, 10, "ProximityFilter");
qmlRegisterType<Qt3DRender::QBlitFramebuffer>(uri, 2, 10, "BlitFramebuffer");
+ qmlRegisterType<Qt3DRender::QSetFence>(uri, 2, 13, "SetFence");
+ qmlRegisterType<Qt3DRender::QWaitFence>(uri, 2, 13, "WaitFence");
// RenderTarget
qmlRegisterType<Qt3DRender::QRenderTargetOutput>(uri, 2, 0, "RenderTargetOutput");
diff --git a/src/quick3d/imports/scene2d/plugins.qmltypes b/src/quick3d/imports/scene2d/plugins.qmltypes
index 783dff7a3..9d2c855a6 100644
--- a/src/quick3d/imports/scene2d/plugins.qmltypes
+++ b/src/quick3d/imports/scene2d/plugins.qmltypes
@@ -4,7 +4,7 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Scene2D 2.12'
+// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Scene2D 2.13'
Module {
dependencies: ["Qt3D.Core 2.0", "Qt3D.Render 2.0"]
diff --git a/src/quick3d/imports/scene3d/plugins.qmltypes b/src/quick3d/imports/scene3d/plugins.qmltypes
index 65526a450..da3d7ec3e 100644
--- a/src/quick3d/imports/scene3d/plugins.qmltypes
+++ b/src/quick3d/imports/scene3d/plugins.qmltypes
@@ -4,7 +4,7 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Scene3D 2.12'
+// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Scene3D 2.13'
Module {
dependencies: ["Qt3D.Core 2.0", "QtQuick 2.0"]
diff --git a/src/quick3d/quick3d/items/quick3dentity_p.h b/src/quick3d/quick3d/items/quick3dentity_p.h
index 7ba5c62c2..fe895f3ec 100644
--- a/src/quick3d/quick3d/items/quick3dentity_p.h
+++ b/src/quick3d/quick3d/items/quick3dentity_p.h
@@ -66,7 +66,7 @@ class QComponent;
namespace Quick {
-class QT3DQUICKSHARED_PRIVATE_EXPORT Quick3DEntity : public QObject
+class Q_3DQUICKSHARED_PRIVATE_EXPORT Quick3DEntity : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<Qt3DCore::QComponent> components READ componentList)
diff --git a/src/quick3d/quick3d/items/quick3dentityloader_p.h b/src/quick3d/quick3d/items/quick3dentityloader_p.h
index 611d86cb2..9d3a70147 100644
--- a/src/quick3d/quick3d/items/quick3dentityloader_p.h
+++ b/src/quick3d/quick3d/items/quick3dentityloader_p.h
@@ -70,7 +70,7 @@ namespace Quick {
class Quick3DEntityLoaderPrivate;
-class QT3DQUICKSHARED_PRIVATE_EXPORT Quick3DEntityLoader : public QEntity
+class Q_3DQUICKSHARED_PRIVATE_EXPORT Quick3DEntityLoader : public QEntity
{
Q_OBJECT
Q_PROPERTY(QObject *entity READ entity NOTIFY entityChanged)
diff --git a/src/quick3d/quick3d/items/quick3djoint_p.h b/src/quick3d/quick3d/items/quick3djoint_p.h
index bef161643..d66419433 100644
--- a/src/quick3d/quick3d/items/quick3djoint_p.h
+++ b/src/quick3d/quick3d/items/quick3djoint_p.h
@@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DCore {
namespace Quick {
-class QT3DQUICKSHARED_PRIVATE_EXPORT Quick3DJoint : public QObject
+class Q_3DQUICKSHARED_PRIVATE_EXPORT Quick3DJoint : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<Qt3DCore::QJoint> childJoints READ childJoints)
diff --git a/src/quick3d/quick3d/items/quick3dnode_p.h b/src/quick3d/quick3d/items/quick3dnode_p.h
index 640a58149..6b146d691 100644
--- a/src/quick3d/quick3d/items/quick3dnode_p.h
+++ b/src/quick3d/quick3d/items/quick3dnode_p.h
@@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DCore {
namespace Quick {
-class QT3DQUICKSHARED_PRIVATE_EXPORT Quick3DNode : public QObject
+class Q_3DQUICKSHARED_PRIVATE_EXPORT Quick3DNode : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<QObject> data READ data)
diff --git a/src/quick3d/quick3d/items/quick3dnodeinstantiator_p.h b/src/quick3d/quick3d/items/quick3dnodeinstantiator_p.h
index b92c98133..ac888e0cb 100644
--- a/src/quick3d/quick3d/items/quick3dnodeinstantiator_p.h
+++ b/src/quick3d/quick3d/items/quick3dnodeinstantiator_p.h
@@ -65,7 +65,7 @@ namespace Quick {
class Quick3DNodeInstantiatorPrivate;
-class QT3DQUICKSHARED_PRIVATE_EXPORT Quick3DNodeInstantiator : public QNode, public QQmlParserStatus
+class Q_3DQUICKSHARED_PRIVATE_EXPORT Quick3DNodeInstantiator : public QNode, public QQmlParserStatus
{
Q_OBJECT
diff --git a/src/quick3d/quick3d/items/quick3dnodev9_p.h b/src/quick3d/quick3d/items/quick3dnodev9_p.h
index d969c4b64..a088e72e6 100644
--- a/src/quick3d/quick3d/items/quick3dnodev9_p.h
+++ b/src/quick3d/quick3d/items/quick3dnodev9_p.h
@@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DCore {
namespace Quick {
-class QT3DQUICKSHARED_PRIVATE_EXPORT Quick3DNodeV9 : public QObject
+class Q_3DQUICKSHARED_PRIVATE_EXPORT Quick3DNodeV9 : public QObject
{
Q_OBJECT
Q_PROPERTY(QJSValue propertyTrackingOverrides READ propertyTrackingOverrides WRITE setPropertyTrackingOverrides NOTIFY propertyTrackingOverridesChanged)
diff --git a/src/quick3d/quick3d/qqmlaspectengine.h b/src/quick3d/quick3d/qqmlaspectengine.h
index a7b09ec8a..1b3922212 100644
--- a/src/quick3d/quick3d/qqmlaspectengine.h
+++ b/src/quick3d/quick3d/qqmlaspectengine.h
@@ -51,7 +51,7 @@ namespace Quick {
class QQmlAspectEnginePrivate;
-class QT3DQUICKSHARED_EXPORT QQmlAspectEngine: public QObject
+class Q_3DQUICKSHARED_EXPORT QQmlAspectEngine: public QObject
{
Q_OBJECT
public:
diff --git a/src/quick3d/quick3d/qquaternionanimation.cpp b/src/quick3d/quick3d/qquaternionanimation.cpp
index adccf4d97..22cc905f7 100644
--- a/src/quick3d/quick3d/qquaternionanimation.cpp
+++ b/src/quick3d/quick3d/qquaternionanimation.cpp
@@ -143,7 +143,10 @@ void QQuaternionAnimation::setType(Type type)
d->type = type;
switch (type) {
case Nlerp:
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_GCC(-Wcast-function-type)
d->interpolator = reinterpret_cast<QVariantAnimation::Interpolator>(&q_quaternionNlerpInterpolator);
+QT_WARNING_POP
break;
case Slerp:
default:
diff --git a/src/quick3d/quick3d/qquaternionanimation_p.h b/src/quick3d/quick3d/qquaternionanimation_p.h
index 172d3bc85..7fb49f670 100644
--- a/src/quick3d/quick3d/qquaternionanimation_p.h
+++ b/src/quick3d/quick3d/qquaternionanimation_p.h
@@ -63,7 +63,7 @@ namespace Quick {
class QQuaternionAnimationPrivate;
-class QT3DQUICKSHARED_PRIVATE_EXPORT QQuaternionAnimation : public QQuickPropertyAnimation
+class Q_3DQUICKSHARED_PRIVATE_EXPORT QQuaternionAnimation : public QQuickPropertyAnimation
{
Q_OBJECT
Q_DECLARE_PRIVATE(QQuaternionAnimation)
@@ -125,7 +125,7 @@ Q_SIGNALS:
void toZRotationChanged(float value);
};
-QT3DQUICKSHARED_PRIVATE_EXPORT QVariant q_quaternionInterpolator(const QQuaternion &from, const QQuaternion &to, qreal progress);
+Q_3DQUICKSHARED_PRIVATE_EXPORT QVariant q_quaternionInterpolator(const QQuaternion &from, const QQuaternion &to, qreal progress);
} // namespace Quick
} // namespace Qt3DCore
diff --git a/src/quick3d/quick3d/qt3dquick_global.h b/src/quick3d/quick3d/qt3dquick_global.h
index b2f580335..ae79a6fb6 100644
--- a/src/quick3d/quick3d/qt3dquick_global.h
+++ b/src/quick3d/quick3d/qt3dquick_global.h
@@ -46,12 +46,12 @@ QT_BEGIN_NAMESPACE
#if defined(QT_SHARED) || !defined(QT_STATIC)
# if defined(QT_BUILD_3DQUICK_LIB)
-# define QT3DQUICKSHARED_EXPORT Q_DECL_EXPORT
+# define Q_3DQUICKSHARED_EXPORT Q_DECL_EXPORT
# else
-# define QT3DQUICKSHARED_EXPORT Q_DECL_IMPORT
+# define Q_3DQUICKSHARED_EXPORT Q_DECL_IMPORT
# endif
#else
-# define QT3DQUICKSHARED_EXPORT
+# define Q_3DQUICKSHARED_EXPORT
#endif
QT_END_NAMESPACE
diff --git a/src/quick3d/quick3d/qt3dquick_global_p.h b/src/quick3d/quick3d/qt3dquick_global_p.h
index ffc603f91..87fd4764c 100644
--- a/src/quick3d/quick3d/qt3dquick_global_p.h
+++ b/src/quick3d/quick3d/qt3dquick_global_p.h
@@ -54,16 +54,16 @@
#include <Qt3DQuick/qt3dquick_global.h>
#include <QtQml/qqml.h>
-#define QT3DQUICKSHARED_PRIVATE_EXPORT QT3DQUICKSHARED_EXPORT
+#define Q_3DQUICKSHARED_PRIVATE_EXPORT Q_3DQUICKSHARED_EXPORT
QT_BEGIN_NAMESPACE
namespace Qt3DCore {
namespace Quick {
-QT3DQUICKSHARED_PRIVATE_EXPORT void Quick3D_initialize();
-QT3DQUICKSHARED_PRIVATE_EXPORT void Quick3D_uninitialize();
-QT3DQUICKSHARED_PRIVATE_EXPORT void Quick3D_registerType(const char *className, const char *quickName, int major, int minor);
+Q_3DQUICKSHARED_PRIVATE_EXPORT void Quick3D_initialize();
+Q_3DQUICKSHARED_PRIVATE_EXPORT void Quick3D_uninitialize();
+Q_3DQUICKSHARED_PRIVATE_EXPORT void Quick3D_registerType(const char *className, const char *quickName, int major, int minor);
template<class T, class E> void registerExtendedType(const char *className, const char *quickName,
const char *uri, int major, int minor, const char *name)
diff --git a/src/quick3d/quick3d/qt3dquickvaluetypes_p.h b/src/quick3d/quick3d/qt3dquickvaluetypes_p.h
index d1b4a4d5d..ab98771d3 100644
--- a/src/quick3d/quick3d/qt3dquickvaluetypes_p.h
+++ b/src/quick3d/quick3d/qt3dquickvaluetypes_p.h
@@ -68,11 +68,11 @@ namespace Qt3DCore {
namespace Quick {
namespace Quick3DValueTypes {
-QT3DQUICKSHARED_PRIVATE_EXPORT void registerValueTypes();
+Q_3DQUICKSHARED_PRIVATE_EXPORT void registerValueTypes();
}
-class QT3DQUICKSHARED_PRIVATE_EXPORT Quick3DColorValueType
+class Q_3DQUICKSHARED_PRIVATE_EXPORT Quick3DColorValueType
{
QColor v;
Q_PROPERTY(qreal r READ r WRITE setR FINAL)
@@ -111,7 +111,7 @@ public:
void setHslLightness(qreal);
};
-class QT3DQUICKSHARED_PRIVATE_EXPORT Quick3DVector2DValueType
+class Q_3DQUICKSHARED_PRIVATE_EXPORT Quick3DVector2DValueType
{
QVector2D v;
Q_PROPERTY(qreal x READ x WRITE setX FINAL)
@@ -138,7 +138,7 @@ public:
Q_INVOKABLE bool fuzzyEquals(const QVector2D &vec) const;
};
-class QT3DQUICKSHARED_PRIVATE_EXPORT Quick3DVector3DValueType
+class Q_3DQUICKSHARED_PRIVATE_EXPORT Quick3DVector3DValueType
{
QVector3D v;
Q_PROPERTY(qreal x READ x WRITE setX FINAL)
@@ -170,7 +170,7 @@ public:
Q_INVOKABLE bool fuzzyEquals(const QVector3D &vec) const;
};
-class QT3DQUICKSHARED_PRIVATE_EXPORT Quick3DVector4DValueType
+class Q_3DQUICKSHARED_PRIVATE_EXPORT Quick3DVector4DValueType
{
QVector4D v;
Q_PROPERTY(qreal x READ x WRITE setX FINAL)
@@ -204,7 +204,7 @@ public:
Q_INVOKABLE bool fuzzyEquals(const QVector4D &vec) const;
};
-class QT3DQUICKSHARED_PRIVATE_EXPORT Quick3DQuaternionValueType
+class Q_3DQUICKSHARED_PRIVATE_EXPORT Quick3DQuaternionValueType
{
QQuaternion v;
Q_PROPERTY(qreal scalar READ scalar WRITE setScalar)
@@ -225,7 +225,7 @@ public:
void setZ(qreal);
};
-class QT3DQUICKSHARED_PRIVATE_EXPORT Quick3DMatrix4x4ValueType
+class Q_3DQUICKSHARED_PRIVATE_EXPORT Quick3DMatrix4x4ValueType
{
QMatrix4x4 v;
Q_PROPERTY(qreal m11 READ m11 WRITE setM11 FINAL)
diff --git a/src/quick3d/quick3danimation/items/quick3danimationcontroller_p.h b/src/quick3d/quick3danimation/items/quick3danimationcontroller_p.h
index a3033e537..d6add010d 100644
--- a/src/quick3d/quick3danimation/items/quick3danimationcontroller_p.h
+++ b/src/quick3d/quick3danimation/items/quick3danimationcontroller_p.h
@@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DAnimation {
namespace Quick {
-class QT3DQUICKANIMATIONSHARED_PRIVATE_EXPORT QQuick3DAnimationController : public QObject
+class Q_3DQUICKANIMATIONSHARED_PRIVATE_EXPORT QQuick3DAnimationController : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<Qt3DAnimation::QAnimationGroup> animationGroups READ animationGroups)
diff --git a/src/quick3d/quick3danimation/items/quick3danimationgroup_p.h b/src/quick3d/quick3danimation/items/quick3danimationgroup_p.h
index aef202480..53b25cf67 100644
--- a/src/quick3d/quick3danimation/items/quick3danimationgroup_p.h
+++ b/src/quick3d/quick3danimation/items/quick3danimationgroup_p.h
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DAnimation {
namespace Quick {
-class QT3DQUICKANIMATIONSHARED_PRIVATE_EXPORT QQuick3DAnimationGroup : public QObject
+class Q_3DQUICKANIMATIONSHARED_PRIVATE_EXPORT QQuick3DAnimationGroup : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<Qt3DAnimation::QAbstractAnimation> animations READ animations)
diff --git a/src/quick3d/quick3danimation/items/quick3dchannelmapper_p.h b/src/quick3d/quick3danimation/items/quick3dchannelmapper_p.h
index c3ec577a2..a21a67411 100644
--- a/src/quick3d/quick3danimation/items/quick3dchannelmapper_p.h
+++ b/src/quick3d/quick3danimation/items/quick3dchannelmapper_p.h
@@ -62,7 +62,7 @@ namespace Qt3DAnimation {
namespace Animation {
namespace Quick {
-class QT3DQUICKANIMATIONSHARED_PRIVATE_EXPORT Quick3DChannelMapper : public QObject
+class Q_3DQUICKANIMATIONSHARED_PRIVATE_EXPORT Quick3DChannelMapper : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<Qt3DAnimation::QAbstractChannelMapping> mappings READ qmlMappings CONSTANT)
diff --git a/src/quick3d/quick3danimation/items/quick3dkeyframeanimation_p.h b/src/quick3d/quick3danimation/items/quick3dkeyframeanimation_p.h
index 944cdbe67..b4eda766c 100644
--- a/src/quick3d/quick3danimation/items/quick3dkeyframeanimation_p.h
+++ b/src/quick3d/quick3danimation/items/quick3dkeyframeanimation_p.h
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DAnimation {
namespace Quick {
-class QT3DQUICKANIMATIONSHARED_PRIVATE_EXPORT QQuick3DKeyframeAnimation : public QObject
+class Q_3DQUICKANIMATIONSHARED_PRIVATE_EXPORT QQuick3DKeyframeAnimation : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<Qt3DCore::QTransform> keyframes READ keyframes)
diff --git a/src/quick3d/quick3danimation/items/quick3dmorphinganimation_p.h b/src/quick3d/quick3danimation/items/quick3dmorphinganimation_p.h
index 31d008a89..3ba018473 100644
--- a/src/quick3d/quick3danimation/items/quick3dmorphinganimation_p.h
+++ b/src/quick3d/quick3danimation/items/quick3dmorphinganimation_p.h
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DAnimation {
namespace Quick {
-class QT3DQUICKANIMATIONSHARED_PRIVATE_EXPORT QQuick3DMorphingAnimation : public QObject
+class Q_3DQUICKANIMATIONSHARED_PRIVATE_EXPORT QQuick3DMorphingAnimation : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<Qt3DAnimation::QMorphTarget> morphTargets READ morphTargets)
diff --git a/src/quick3d/quick3danimation/items/quick3dmorphtarget_p.h b/src/quick3d/quick3danimation/items/quick3dmorphtarget_p.h
index 03b52dfeb..5ca783e6b 100644
--- a/src/quick3d/quick3danimation/items/quick3dmorphtarget_p.h
+++ b/src/quick3d/quick3danimation/items/quick3dmorphtarget_p.h
@@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DAnimation {
namespace Quick {
-class QT3DQUICKANIMATIONSHARED_PRIVATE_EXPORT QQuick3DMorphTarget : public QObject
+class Q_3DQUICKANIMATIONSHARED_PRIVATE_EXPORT QQuick3DMorphTarget : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<Qt3DRender::QAttribute> attributes READ attributes)
diff --git a/src/quick3d/quick3danimation/items/quick3dvertexblendanimation_p.h b/src/quick3d/quick3danimation/items/quick3dvertexblendanimation_p.h
index 6be2d662f..f33730fb5 100644
--- a/src/quick3d/quick3danimation/items/quick3dvertexblendanimation_p.h
+++ b/src/quick3d/quick3danimation/items/quick3dvertexblendanimation_p.h
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DAnimation {
namespace Quick {
-class QT3DQUICKANIMATIONSHARED_PRIVATE_EXPORT QQuick3DVertexBlendAnimation : public QObject
+class Q_3DQUICKANIMATIONSHARED_PRIVATE_EXPORT QQuick3DVertexBlendAnimation : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<Qt3DAnimation::QMorphTarget> morphTargets READ morphTargets)
diff --git a/src/quick3d/quick3danimation/qt3dquickanimation_global.h b/src/quick3d/quick3danimation/qt3dquickanimation_global.h
index 962321b2f..51b38dd96 100644
--- a/src/quick3d/quick3danimation/qt3dquickanimation_global.h
+++ b/src/quick3d/quick3danimation/qt3dquickanimation_global.h
@@ -46,12 +46,12 @@ QT_BEGIN_NAMESPACE
#if defined(QT_SHARED) || !defined(QT_STATIC)
# if defined(QT_BUILD_3DQUICKANIMATION_LIB)
-# define QT3DQUICKANIMATIONSHARED_EXPORT Q_DECL_EXPORT
+# define Q_3DQUICKANIMATIONSHARED_EXPORT Q_DECL_EXPORT
# else
-# define QT3DQUICKANIMATIONSHARED_EXPORT Q_DECL_IMPORT
+# define Q_3DQUICKANIMATIONSHARED_EXPORT Q_DECL_IMPORT
# endif
#else
-# define QT3DQUICKANIMATIONSHARED_EXPORT
+# define Q_3DQUICKANIMATIONSHARED_EXPORT
#endif
QT_END_NAMESPACE
diff --git a/src/quick3d/quick3danimation/qt3dquickanimation_global_p.h b/src/quick3d/quick3danimation/qt3dquickanimation_global_p.h
index 89d755931..c57cd55ea 100644
--- a/src/quick3d/quick3danimation/qt3dquickanimation_global_p.h
+++ b/src/quick3d/quick3danimation/qt3dquickanimation_global_p.h
@@ -54,15 +54,15 @@
#include <Qt3DQuickAnimation/qt3dquickanimation_global.h>
#include <QtQml/qqml.h>
-#define QT3DQUICKANIMATIONSHARED_PRIVATE_EXPORT QT3DQUICKANIMATIONSHARED_EXPORT
+#define Q_3DQUICKANIMATIONSHARED_PRIVATE_EXPORT Q_3DQUICKANIMATIONSHARED_EXPORT
QT_BEGIN_NAMESPACE
namespace Qt3DAnimation {
namespace Quick {
-QT3DQUICKANIMATIONSHARED_PRIVATE_EXPORT void Quick3DAnimation_initialize();
-QT3DQUICKANIMATIONSHARED_PRIVATE_EXPORT void Quick3DAnimation_registerType(const char *className, const char *quickName, int major, int minor);
+Q_3DQUICKANIMATIONSHARED_PRIVATE_EXPORT void Quick3DAnimation_initialize();
+Q_3DQUICKANIMATIONSHARED_PRIVATE_EXPORT void Quick3DAnimation_registerType(const char *className, const char *quickName, int major, int minor);
template<class T, class E> void registerExtendedType(const char *className, const char *quickName,
const char *uri, int major, int minor, const char *name)
diff --git a/src/quick3d/quick3dextras/items/quick3dlevelofdetailloader_p.h b/src/quick3d/quick3dextras/items/quick3dlevelofdetailloader_p.h
index 445e7bca6..adc756e96 100644
--- a/src/quick3d/quick3dextras/items/quick3dlevelofdetailloader_p.h
+++ b/src/quick3d/quick3dextras/items/quick3dlevelofdetailloader_p.h
@@ -63,7 +63,7 @@ namespace Quick {
class Quick3DLevelOfDetailLoaderPrivate;
-class QT3DQUICKEXTRASSHARED_PRIVATE_EXPORT Quick3DLevelOfDetailLoader : public Qt3DCore::QEntity
+class Q_3DQUICKEXTRASSHARED_PRIVATE_EXPORT Quick3DLevelOfDetailLoader : public Qt3DCore::QEntity
{
Q_OBJECT
Q_PROPERTY(QVariantList sources READ sources WRITE setSources NOTIFY sourcesChanged)
diff --git a/src/quick3d/quick3dextras/items/quick3dspritesheet_p.h b/src/quick3d/quick3dextras/items/quick3dspritesheet_p.h
index 38a92dd2a..82409b755 100644
--- a/src/quick3d/quick3dextras/items/quick3dspritesheet_p.h
+++ b/src/quick3d/quick3dextras/items/quick3dspritesheet_p.h
@@ -61,7 +61,7 @@ namespace Qt3DExtras {
namespace Extras {
namespace Quick {
-class QT3DQUICKEXTRASSHARED_EXPORT Quick3DSpriteSheet : public QObject
+class Q_3DQUICKEXTRASSHARED_EXPORT Quick3DSpriteSheet : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<Qt3DExtras::QSpriteSheetItem> sprites READ sprites CONSTANT)
diff --git a/src/quick3d/quick3dextras/qt3dquickextras_global.h b/src/quick3d/quick3dextras/qt3dquickextras_global.h
index d9277baee..8f589378e 100644
--- a/src/quick3d/quick3dextras/qt3dquickextras_global.h
+++ b/src/quick3d/quick3dextras/qt3dquickextras_global.h
@@ -46,12 +46,12 @@ QT_BEGIN_NAMESPACE
#if defined(QT_SHARED) || !defined(QT_STATIC)
# if defined(QT_BUILD_3DQUICKEXTRAS_LIB)
-# define QT3DQUICKEXTRASSHARED_EXPORT Q_DECL_EXPORT
+# define Q_3DQUICKEXTRASSHARED_EXPORT Q_DECL_EXPORT
# else
-# define QT3DQUICKEXTRASSHARED_EXPORT Q_DECL_IMPORT
+# define Q_3DQUICKEXTRASSHARED_EXPORT Q_DECL_IMPORT
# endif
#else
-# define QT3DQUICKEXTRASSHARED_EXPORT
+# define Q_3DQUICKEXTRASSHARED_EXPORT
#endif
QT_END_NAMESPACE
diff --git a/src/quick3d/quick3dextras/qt3dquickextras_global_p.h b/src/quick3d/quick3dextras/qt3dquickextras_global_p.h
index a27533517..40c8d8a10 100644
--- a/src/quick3d/quick3dextras/qt3dquickextras_global_p.h
+++ b/src/quick3d/quick3dextras/qt3dquickextras_global_p.h
@@ -54,15 +54,15 @@
#include <Qt3DQuickExtras/qt3dquickextras_global.h>
#include <QtQml/qqml.h>
-#define QT3DQUICKEXTRASSHARED_PRIVATE_EXPORT QT3DQUICKEXTRASSHARED_EXPORT
+#define Q_3DQUICKEXTRASSHARED_PRIVATE_EXPORT Q_3DQUICKEXTRASSHARED_EXPORT
QT_BEGIN_NAMESPACE
namespace Qt3DExtras {
namespace Quick {
-QT3DQUICKEXTRASSHARED_PRIVATE_EXPORT void Quick3DExtras_initialize();
-QT3DQUICKEXTRASSHARED_PRIVATE_EXPORT void Quick3DExtras_registerType(const char *className, const char *quickName, int major, int minor);
+Q_3DQUICKEXTRASSHARED_PRIVATE_EXPORT void Quick3DExtras_initialize();
+Q_3DQUICKEXTRASSHARED_PRIVATE_EXPORT void Quick3DExtras_registerType(const char *className, const char *quickName, int major, int minor);
template<class T, class E> void registerExtendedType(const char *className, const char *quickName,
const char *uri, int major, int minor, const char *name)
diff --git a/src/quick3d/quick3dextras/qt3dquickwindow.h b/src/quick3d/quick3dextras/qt3dquickwindow.h
index 30f901979..2d0717651 100644
--- a/src/quick3d/quick3dextras/qt3dquickwindow.h
+++ b/src/quick3d/quick3dextras/qt3dquickwindow.h
@@ -86,7 +86,7 @@ namespace Quick {
class Qt3DQuickWindowPrivate;
-class QT3DQUICKEXTRASSHARED_EXPORT Qt3DQuickWindow : public QWindow
+class Q_3DQUICKEXTRASSHARED_EXPORT Qt3DQuickWindow : public QWindow
{
Q_OBJECT
Q_PROPERTY(CameraAspectRatioMode cameraAspectRatioMode READ cameraAspectRatioMode WRITE setCameraAspectRatioMode NOTIFY cameraAspectRatioModeChanged)
diff --git a/src/quick3d/quick3dinput/items/quick3daction_p.h b/src/quick3d/quick3dinput/items/quick3daction_p.h
index 86e52eb33..8fb91ed40 100644
--- a/src/quick3d/quick3dinput/items/quick3daction_p.h
+++ b/src/quick3d/quick3dinput/items/quick3daction_p.h
@@ -63,7 +63,7 @@ namespace Qt3DInput {
namespace Input {
namespace Quick {
-class QT3DQUICKINPUTSHARED_PRIVATE_EXPORT Quick3DAction : public QObject
+class Q_3DQUICKINPUTSHARED_PRIVATE_EXPORT Quick3DAction : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<Qt3DInput::QAbstractActionInput> inputs READ qmlActionInputs CONSTANT)
diff --git a/src/quick3d/quick3dinput/items/quick3daxis_p.h b/src/quick3d/quick3dinput/items/quick3daxis_p.h
index 58ba32ae7..631139212 100644
--- a/src/quick3d/quick3dinput/items/quick3daxis_p.h
+++ b/src/quick3d/quick3dinput/items/quick3daxis_p.h
@@ -63,7 +63,7 @@ namespace Qt3DInput {
namespace Input {
namespace Quick {
-class QT3DQUICKINPUTSHARED_PRIVATE_EXPORT Quick3DAxis : public QObject
+class Q_3DQUICKINPUTSHARED_PRIVATE_EXPORT Quick3DAxis : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<Qt3DInput::QAbstractAxisInput> inputs READ qmlAxisInputs CONSTANT)
diff --git a/src/quick3d/quick3dinput/items/quick3dinputchord_p.h b/src/quick3d/quick3dinput/items/quick3dinputchord_p.h
index 3380fefa4..5bfd15b09 100644
--- a/src/quick3d/quick3dinput/items/quick3dinputchord_p.h
+++ b/src/quick3d/quick3dinput/items/quick3dinputchord_p.h
@@ -62,7 +62,7 @@ namespace Qt3DInput {
namespace Input {
namespace Quick {
-class QT3DQUICKINPUTSHARED_PRIVATE_EXPORT Quick3DInputChord : public QObject
+class Q_3DQUICKINPUTSHARED_PRIVATE_EXPORT Quick3DInputChord : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<Qt3DInput::QAbstractActionInput> chords READ qmlActionInputs CONSTANT)
diff --git a/src/quick3d/quick3dinput/items/quick3dinputsequence_p.h b/src/quick3d/quick3dinput/items/quick3dinputsequence_p.h
index aea671f12..54e40ec42 100644
--- a/src/quick3d/quick3dinput/items/quick3dinputsequence_p.h
+++ b/src/quick3d/quick3dinput/items/quick3dinputsequence_p.h
@@ -62,7 +62,7 @@ namespace Qt3DInput {
namespace Input {
namespace Quick {
-class QT3DQUICKINPUTSHARED_PRIVATE_EXPORT Quick3DInputSequence : public QObject
+class Q_3DQUICKINPUTSHARED_PRIVATE_EXPORT Quick3DInputSequence : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<Qt3DInput::QAbstractActionInput> sequences READ qmlActionInputs CONSTANT)
diff --git a/src/quick3d/quick3dinput/items/quick3dlogicaldevice_p.h b/src/quick3d/quick3dinput/items/quick3dlogicaldevice_p.h
index 050d81ab8..e544bbc14 100644
--- a/src/quick3d/quick3dinput/items/quick3dlogicaldevice_p.h
+++ b/src/quick3d/quick3dinput/items/quick3dlogicaldevice_p.h
@@ -64,7 +64,7 @@ namespace Qt3DInput {
namespace Input {
namespace Quick {
-class QT3DQUICKINPUTSHARED_PRIVATE_EXPORT Quick3DLogicalDevice : public QObject
+class Q_3DQUICKINPUTSHARED_PRIVATE_EXPORT Quick3DLogicalDevice : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<Qt3DInput::QAxis> axes READ qmlAxes CONSTANT)
diff --git a/src/quick3d/quick3dinput/items/quick3dphysicaldevice_p.h b/src/quick3d/quick3dinput/items/quick3dphysicaldevice_p.h
index b4c96ac14..0c0940952 100644
--- a/src/quick3d/quick3dinput/items/quick3dphysicaldevice_p.h
+++ b/src/quick3d/quick3dinput/items/quick3dphysicaldevice_p.h
@@ -64,7 +64,7 @@ namespace Qt3DInput {
namespace Input {
namespace Quick {
-class QT3DQUICKINPUTSHARED_PRIVATE_EXPORT Quick3DPhysicalDevice : public QObject
+class Q_3DQUICKINPUTSHARED_PRIVATE_EXPORT Quick3DPhysicalDevice : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<Qt3DInput::QAxisSetting> axisSettings READ axisSettings CONSTANT)
diff --git a/src/quick3d/quick3dinput/qt3dquickinput_global.h b/src/quick3d/quick3dinput/qt3dquickinput_global.h
index d34667dc3..2a5b5f1e5 100644
--- a/src/quick3d/quick3dinput/qt3dquickinput_global.h
+++ b/src/quick3d/quick3dinput/qt3dquickinput_global.h
@@ -46,12 +46,12 @@ QT_BEGIN_NAMESPACE
#if defined(QT_SHARED) || !defined(QT_STATIC)
# if defined(QT_BUILD_3DQUICKINPUT_LIB)
-# define QT3DQUICKINPUTSHARED_EXPORT Q_DECL_EXPORT
+# define Q_3DQUICKINPUTSHARED_EXPORT Q_DECL_EXPORT
# else
-# define QT3DQUICKINPUTSHARED_EXPORT Q_DECL_IMPORT
+# define Q_3DQUICKINPUTSHARED_EXPORT Q_DECL_IMPORT
# endif
#else
-# define QT3DQUICKINPUTSHARED_EXPORT
+# define Q_3DQUICKINPUTSHARED_EXPORT
#endif
QT_END_NAMESPACE
diff --git a/src/quick3d/quick3dinput/qt3dquickinput_global_p.h b/src/quick3d/quick3dinput/qt3dquickinput_global_p.h
index a5d9adcec..0924fcb62 100644
--- a/src/quick3d/quick3dinput/qt3dquickinput_global_p.h
+++ b/src/quick3d/quick3dinput/qt3dquickinput_global_p.h
@@ -54,7 +54,7 @@
#include <Qt3DQuickInput/qt3dquickinput_global.h>
#include <QtQml/qqml.h>
-#define QT3DQUICKINPUTSHARED_PRIVATE_EXPORT QT3DQUICKINPUTSHARED_EXPORT
+#define Q_3DQUICKINPUTSHARED_PRIVATE_EXPORT Q_3DQUICKINPUTSHARED_EXPORT
QT_BEGIN_NAMESPACE
@@ -62,8 +62,8 @@ namespace Qt3DInput {
namespace Quick {
-QT3DQUICKINPUTSHARED_PRIVATE_EXPORT void Quick3DInput_initialize();
-QT3DQUICKINPUTSHARED_PRIVATE_EXPORT void Quick3DInput_registerType(const char *className, const char *quickName, int major, int minor);
+Q_3DQUICKINPUTSHARED_PRIVATE_EXPORT void Quick3DInput_initialize();
+Q_3DQUICKINPUTSHARED_PRIVATE_EXPORT void Quick3DInput_registerType(const char *className, const char *quickName, int major, int minor);
template<class T, class E> void registerExtendedType(const char *className, const char *quickName,
const char *uri, int major, int minor, const char *name)
diff --git a/src/quick3d/quick3drender/items/quick3dbuffer_p.h b/src/quick3d/quick3drender/items/quick3dbuffer_p.h
index 712e11078..233cc3faf 100644
--- a/src/quick3d/quick3drender/items/quick3dbuffer_p.h
+++ b/src/quick3d/quick3drender/items/quick3dbuffer_p.h
@@ -70,7 +70,7 @@ namespace Render {
namespace Quick {
-class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DBuffer : public Qt3DRender::QBuffer
+class Q_3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DBuffer : public Qt3DRender::QBuffer
{
Q_OBJECT
Q_PROPERTY(QVariant data READ bufferData WRITE setBufferData NOTIFY bufferDataChanged)
diff --git a/src/quick3d/quick3drender/items/quick3deffect_p.h b/src/quick3d/quick3drender/items/quick3deffect_p.h
index 3b778563d..69c5b2be6 100644
--- a/src/quick3d/quick3drender/items/quick3deffect_p.h
+++ b/src/quick3d/quick3drender/items/quick3deffect_p.h
@@ -63,7 +63,7 @@ namespace Qt3DRender {
namespace Render {
namespace Quick {
-class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DEffect : public QObject
+class Q_3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DEffect : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<Qt3DRender::QTechnique> techniques READ techniqueList)
diff --git a/src/quick3d/quick3drender/items/quick3dgeometry_p.h b/src/quick3d/quick3drender/items/quick3dgeometry_p.h
index 6bf7faf58..19a308076 100644
--- a/src/quick3d/quick3drender/items/quick3dgeometry_p.h
+++ b/src/quick3d/quick3drender/items/quick3dgeometry_p.h
@@ -62,7 +62,7 @@ namespace Qt3DRender {
namespace Render {
namespace Quick {
-class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DGeometry : public QObject
+class Q_3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DGeometry : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<Qt3DRender::QAttribute> attributes READ attributeList)
diff --git a/src/quick3d/quick3drender/items/quick3dlayerfilter_p.h b/src/quick3d/quick3drender/items/quick3dlayerfilter_p.h
index f59be2787..6294d2b98 100644
--- a/src/quick3d/quick3drender/items/quick3dlayerfilter_p.h
+++ b/src/quick3d/quick3drender/items/quick3dlayerfilter_p.h
@@ -63,7 +63,7 @@ namespace Qt3DRender {
namespace Render {
namespace Quick {
-class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DLayerFilter : public QObject
+class Q_3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DLayerFilter : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<Qt3DRender::QLayer> layers READ qmlLayers)
diff --git a/src/quick3d/quick3drender/items/quick3dmaterial_p.h b/src/quick3d/quick3drender/items/quick3dmaterial_p.h
index 646e3b154..2069ba9c6 100644
--- a/src/quick3d/quick3drender/items/quick3dmaterial_p.h
+++ b/src/quick3d/quick3drender/items/quick3dmaterial_p.h
@@ -66,7 +66,7 @@ namespace Quick {
// FIXME - write a custom QML parser and stop mis-using Tag
// Tags could be replaced by Parameters directly
-class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DMaterial : public QObject
+class Q_3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DMaterial : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<Qt3DRender::QParameter> parameters READ qmlParameters)
diff --git a/src/quick3d/quick3drender/items/quick3dmemorybarrier_p.h b/src/quick3d/quick3drender/items/quick3dmemorybarrier_p.h
index ab8f72a76..2bbe8f34e 100644
--- a/src/quick3d/quick3drender/items/quick3dmemorybarrier_p.h
+++ b/src/quick3d/quick3drender/items/quick3dmemorybarrier_p.h
@@ -62,7 +62,7 @@ namespace Quick {
// Qt6: Handle QFlags as Q_PROPERTY in QML
-class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DMemoryBarrier : public QObject
+class Q_3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DMemoryBarrier : public QObject
{
Q_OBJECT
Q_PROPERTY(int waitFor READ waitFor WRITE setWaitFor)
diff --git a/src/quick3d/quick3drender/items/quick3dparameter_p.h b/src/quick3d/quick3drender/items/quick3dparameter_p.h
index 948df22a7..939cfaab8 100644
--- a/src/quick3d/quick3drender/items/quick3dparameter_p.h
+++ b/src/quick3d/quick3drender/items/quick3dparameter_p.h
@@ -63,7 +63,7 @@ namespace Quick {
class Quick3DParameterPrivate;
-class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DParameter : public QParameter
+class Q_3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DParameter : public QParameter
{
Q_OBJECT
public:
diff --git a/src/quick3d/quick3drender/items/quick3draycaster_p.h b/src/quick3d/quick3drender/items/quick3draycaster_p.h
index 9be11f534..31778dc3b 100644
--- a/src/quick3d/quick3drender/items/quick3draycaster_p.h
+++ b/src/quick3d/quick3drender/items/quick3draycaster_p.h
@@ -66,7 +66,7 @@ namespace Quick {
class Quick3DRayCasterPrivate;
-class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DRayCaster : public QRayCaster
+class Q_3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DRayCaster : public QRayCaster
{
Q_OBJECT
Q_PROPERTY(QJSValue hits READ hits NOTIFY hitsChanged)
diff --git a/src/quick3d/quick3drender/items/quick3draycaster_p_p.h b/src/quick3d/quick3drender/items/quick3draycaster_p_p.h
index 0098634bc..ef875eb43 100644
--- a/src/quick3d/quick3drender/items/quick3draycaster_p_p.h
+++ b/src/quick3d/quick3drender/items/quick3draycaster_p_p.h
@@ -65,7 +65,7 @@ namespace Qt3DRender {
namespace Render {
namespace Quick {
-class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DRayCasterPrivate : public QAbstractRayCasterPrivate
+class Q_3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DRayCasterPrivate : public QAbstractRayCasterPrivate
{
public:
explicit Quick3DRayCasterPrivate() : QAbstractRayCasterPrivate() { }
diff --git a/src/quick3d/quick3drender/items/quick3drenderpass_p.h b/src/quick3d/quick3drender/items/quick3drenderpass_p.h
index c9d2fce59..982cab9f4 100644
--- a/src/quick3d/quick3drender/items/quick3drenderpass_p.h
+++ b/src/quick3d/quick3drender/items/quick3drenderpass_p.h
@@ -63,7 +63,7 @@ namespace Qt3DRender {
namespace Render {
namespace Quick {
-class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DRenderPass : public QObject
+class Q_3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DRenderPass : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<Qt3DRender::QFilterKey> filterKeys READ filterKeyList)
diff --git a/src/quick3d/quick3drender/items/quick3drenderpassfilter_p.h b/src/quick3d/quick3drender/items/quick3drenderpassfilter_p.h
index cab75f4a6..8f81766ef 100644
--- a/src/quick3d/quick3drender/items/quick3drenderpassfilter_p.h
+++ b/src/quick3d/quick3drender/items/quick3drenderpassfilter_p.h
@@ -64,7 +64,7 @@ namespace Qt3DRender {
namespace Render {
namespace Quick {
-class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DRenderPassFilter : public QObject
+class Q_3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DRenderPassFilter : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<Qt3DRender::QFilterKey> matchAny READ includeList)
diff --git a/src/quick3d/quick3drender/items/quick3drendertargetoutput_p.h b/src/quick3d/quick3drender/items/quick3drendertargetoutput_p.h
index 7626a2db7..f7b15b0cb 100644
--- a/src/quick3d/quick3drender/items/quick3drendertargetoutput_p.h
+++ b/src/quick3d/quick3drender/items/quick3drendertargetoutput_p.h
@@ -63,7 +63,7 @@ namespace Qt3DRender {
namespace Render {
namespace Quick {
-class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DRenderTargetOutput : public QObject
+class Q_3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DRenderTargetOutput : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<Qt3DRender::QRenderTargetOutput> attachments READ qmlAttachments)
diff --git a/src/quick3d/quick3drender/items/quick3drendertargetselector_p.h b/src/quick3d/quick3drender/items/quick3drendertargetselector_p.h
index 610ea1a49..7f4b99749 100644
--- a/src/quick3d/quick3drender/items/quick3drendertargetselector_p.h
+++ b/src/quick3d/quick3drender/items/quick3drendertargetselector_p.h
@@ -64,7 +64,7 @@ namespace Qt3DRender {
namespace Render {
namespace Quick {
-class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DRenderTargetSelector : public QObject
+class Q_3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DRenderTargetSelector : public QObject
{
Q_OBJECT
Q_PROPERTY(QVariantList drawBuffers READ drawBuffers WRITE setDrawBuffers NOTIFY drawBuffersChanged)
diff --git a/src/quick3d/quick3drender/items/quick3dscene_p.h b/src/quick3d/quick3drender/items/quick3dscene_p.h
index a7173a6c7..6b7448090 100644
--- a/src/quick3d/quick3drender/items/quick3dscene_p.h
+++ b/src/quick3d/quick3drender/items/quick3dscene_p.h
@@ -62,7 +62,7 @@ namespace Qt3DRender {
namespace Render {
namespace Quick {
-class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DScene : public QObject
+class Q_3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DScene : public QObject
{
Q_OBJECT
public:
diff --git a/src/quick3d/quick3drender/items/quick3dscreenraycaster_p.h b/src/quick3d/quick3drender/items/quick3dscreenraycaster_p.h
index b337163c5..63d3f0428 100644
--- a/src/quick3d/quick3drender/items/quick3dscreenraycaster_p.h
+++ b/src/quick3d/quick3drender/items/quick3dscreenraycaster_p.h
@@ -66,7 +66,7 @@ namespace Quick {
class Quick3DScreenRayCasterPrivate;
-class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DScreenRayCaster : public QScreenRayCaster
+class Q_3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DScreenRayCaster : public QScreenRayCaster
{
Q_OBJECT
Q_PROPERTY(QJSValue hits READ hits NOTIFY hitsChanged)
diff --git a/src/quick3d/quick3drender/items/quick3dscreenraycaster_p_p.h b/src/quick3d/quick3drender/items/quick3dscreenraycaster_p_p.h
index 5c58e5087..ad5d0b941 100644
--- a/src/quick3d/quick3drender/items/quick3dscreenraycaster_p_p.h
+++ b/src/quick3d/quick3drender/items/quick3dscreenraycaster_p_p.h
@@ -66,7 +66,7 @@ namespace Quick {
class Quick3DScreenRayCaster;
-class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DScreenRayCasterPrivate : public QAbstractRayCasterPrivate
+class Q_3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DScreenRayCasterPrivate : public QAbstractRayCasterPrivate
{
public:
explicit Quick3DScreenRayCasterPrivate() : QAbstractRayCasterPrivate() { }
diff --git a/src/quick3d/quick3drender/items/quick3dshaderdata_p.h b/src/quick3d/quick3drender/items/quick3dshaderdata_p.h
index 207096149..481f44446 100644
--- a/src/quick3d/quick3drender/items/quick3dshaderdata_p.h
+++ b/src/quick3d/quick3drender/items/quick3dshaderdata_p.h
@@ -63,7 +63,7 @@ namespace Qt3DRender {
namespace Render {
namespace Quick {
-class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DShaderData : public QShaderData
+class Q_3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DShaderData : public QShaderData
{
Q_OBJECT
public:
diff --git a/src/quick3d/quick3drender/items/quick3dshaderdataarray_p.h b/src/quick3d/quick3drender/items/quick3dshaderdataarray_p.h
index 162f402aa..86d11d13c 100644
--- a/src/quick3d/quick3drender/items/quick3dshaderdataarray_p.h
+++ b/src/quick3d/quick3drender/items/quick3dshaderdataarray_p.h
@@ -69,7 +69,7 @@ namespace Quick {
class Quick3DShaderDataArrayPrivate;
class Quick3DShaderData;
-class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DShaderDataArray : public Qt3DCore::QNode
+class Q_3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DShaderDataArray : public Qt3DCore::QNode
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<Qt3DRender::QShaderData> values READ valuesList)
diff --git a/src/quick3d/quick3drender/items/quick3dstateset_p.h b/src/quick3d/quick3drender/items/quick3dstateset_p.h
index b2e63c066..7b532ec83 100644
--- a/src/quick3d/quick3drender/items/quick3dstateset_p.h
+++ b/src/quick3d/quick3drender/items/quick3dstateset_p.h
@@ -62,7 +62,7 @@ namespace Qt3DRender {
namespace Render {
namespace Quick {
-class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DStateSet : public QObject
+class Q_3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DStateSet : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<Qt3DRender::QRenderState> renderStates READ renderStateList CONSTANT)
diff --git a/src/quick3d/quick3drender/items/quick3dtechnique_p.h b/src/quick3d/quick3drender/items/quick3dtechnique_p.h
index 9cdfdfefe..0c02e07c3 100644
--- a/src/quick3d/quick3drender/items/quick3dtechnique_p.h
+++ b/src/quick3d/quick3drender/items/quick3dtechnique_p.h
@@ -62,7 +62,7 @@ namespace Qt3DRender {
namespace Render {
namespace Quick {
-class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DTechnique : public QObject
+class Q_3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DTechnique : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<Qt3DRender::QFilterKey> filterKeys READ filterKeyList)
diff --git a/src/quick3d/quick3drender/items/quick3dtechniquefilter_p.h b/src/quick3d/quick3drender/items/quick3dtechniquefilter_p.h
index 2b10bc108..9cd776827 100644
--- a/src/quick3d/quick3drender/items/quick3dtechniquefilter_p.h
+++ b/src/quick3d/quick3drender/items/quick3dtechniquefilter_p.h
@@ -64,7 +64,7 @@ namespace Qt3DRender {
namespace Render {
namespace Quick {
-class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DTechniqueFilter : public QObject
+class Q_3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DTechniqueFilter : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<Qt3DRender::QFilterKey> matchAll READ matchList)
diff --git a/src/quick3d/quick3drender/items/quick3dtexture_p.h b/src/quick3d/quick3drender/items/quick3dtexture_p.h
index 6b0430211..54d23a16b 100644
--- a/src/quick3d/quick3drender/items/quick3dtexture_p.h
+++ b/src/quick3d/quick3drender/items/quick3dtexture_p.h
@@ -63,7 +63,7 @@ namespace Qt3DRender {
namespace Render {
namespace Quick {
-class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DTextureExtension : public QObject
+class Q_3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DTextureExtension : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<Qt3DRender::QAbstractTextureImage> textureImages READ textureImages)
diff --git a/src/quick3d/quick3drender/items/quick3dviewport_p.h b/src/quick3d/quick3drender/items/quick3dviewport_p.h
index adf0c983f..8a61b490b 100644
--- a/src/quick3d/quick3drender/items/quick3dviewport_p.h
+++ b/src/quick3d/quick3drender/items/quick3dviewport_p.h
@@ -64,7 +64,7 @@ namespace Quick {
// TO DO : Check if this is required or if this might as well be removed
-class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DViewport : public QObject
+class Q_3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DViewport : public QObject
{
Q_OBJECT
public:
diff --git a/src/quick3d/quick3drender/qt3dquickrender_global.h b/src/quick3d/quick3drender/qt3dquickrender_global.h
index 7c21243e3..d8900265c 100644
--- a/src/quick3d/quick3drender/qt3dquickrender_global.h
+++ b/src/quick3d/quick3drender/qt3dquickrender_global.h
@@ -46,12 +46,12 @@ QT_BEGIN_NAMESPACE
#if defined(QT_SHARED) || !defined(QT_STATIC)
# if defined(QT_BUILD_3DQUICKRENDER_LIB)
-# define QT3DQUICKRENDERSHARED_EXPORT Q_DECL_EXPORT
+# define Q_3DQUICKRENDERSHARED_EXPORT Q_DECL_EXPORT
# else
-# define QT3DQUICKRENDERSHARED_EXPORT Q_DECL_IMPORT
+# define Q_3DQUICKRENDERSHARED_EXPORT Q_DECL_IMPORT
# endif
#else
-# define QT3DQUICKRENDERSHARED_EXPORT
+# define Q_3DQUICKRENDERSHARED_EXPORT
#endif
QT_END_NAMESPACE
diff --git a/src/quick3d/quick3drender/qt3dquickrender_global_p.h b/src/quick3d/quick3drender/qt3dquickrender_global_p.h
index 77378f41b..11a4f2ff1 100644
--- a/src/quick3d/quick3drender/qt3dquickrender_global_p.h
+++ b/src/quick3d/quick3drender/qt3dquickrender_global_p.h
@@ -55,7 +55,7 @@
#include <Qt3DQuickRender/qt3dquickrender_global.h>
#include <QtQml/qqml.h>
-#define QT3DQUICKRENDERSHARED_PRIVATE_EXPORT QT3DQUICKRENDERSHARED_EXPORT
+#define Q_3DQUICKRENDERSHARED_PRIVATE_EXPORT Q_3DQUICKRENDERSHARED_EXPORT
QT_BEGIN_NAMESPACE
@@ -63,8 +63,8 @@ namespace Qt3DRender {
namespace Quick {
-QT3DQUICKRENDERSHARED_PRIVATE_EXPORT void Quick3DRender_initialize();
-QT3DQUICKRENDERSHARED_PRIVATE_EXPORT void Quick3DRender_registerType(const char *className, const char *quickName, int major, int minor);
+Q_3DQUICKRENDERSHARED_PRIVATE_EXPORT void Quick3DRender_initialize();
+Q_3DQUICKRENDERSHARED_PRIVATE_EXPORT void Quick3DRender_registerType(const char *className, const char *quickName, int major, int minor);
template<class T, class E> void registerExtendedType(const char *className, const char *quickName,
const char *uri, int major, int minor, const char *name)
diff --git a/src/quick3d/quick3dscene2d/items/qscene2d.h b/src/quick3d/quick3dscene2d/items/qscene2d.h
index c309fc831..eab900ca4 100644
--- a/src/quick3d/quick3dscene2d/items/qscene2d.h
+++ b/src/quick3d/quick3dscene2d/items/qscene2d.h
@@ -60,7 +60,7 @@ namespace Quick {
class QScene2DPrivate;
-class QT3DQUICKSCENE2DSHARED_EXPORT QScene2D : public Qt3DCore::QNode
+class Q_3DQUICKSCENE2DSHARED_EXPORT QScene2D : public Qt3DCore::QNode
{
Q_OBJECT
diff --git a/src/quick3d/quick3dscene2d/items/qt3dquick3dscene2d_p.h b/src/quick3d/quick3dscene2d/items/qt3dquick3dscene2d_p.h
index 57734223b..fe4dd157c 100644
--- a/src/quick3d/quick3dscene2d/items/qt3dquick3dscene2d_p.h
+++ b/src/quick3d/quick3dscene2d/items/qt3dquick3dscene2d_p.h
@@ -60,7 +60,7 @@ namespace Qt3DRender {
namespace Render {
namespace Quick {
-class QT3DQUICKSCENE2DSHARED_EXPORT QQuick3DScene2D : public QObject
+class Q_3DQUICKSCENE2DSHARED_EXPORT QQuick3DScene2D : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<Qt3DCore::QEntity> entities READ entities)
diff --git a/src/quick3d/quick3dscene2d/items/scene2d_p.h b/src/quick3d/quick3dscene2d/items/scene2d_p.h
index b8999887a..bd7874cd6 100644
--- a/src/quick3d/quick3dscene2d/items/scene2d_p.h
+++ b/src/quick3d/quick3dscene2d/items/scene2d_p.h
@@ -81,7 +81,7 @@ private:
Scene2D *m_node;
};
-class QT3DQUICKSCENE2DSHARED_EXPORT Scene2D : public Qt3DRender::Render::BackendNode
+class Q_3DQUICKSCENE2DSHARED_EXPORT Scene2D : public Qt3DRender::Render::BackendNode
{
public:
Scene2D();
diff --git a/src/quick3d/quick3dscene2d/items/scene2dsharedobject_p.h b/src/quick3d/quick3dscene2d/items/scene2dsharedobject_p.h
index 416a2280d..8de92c574 100644
--- a/src/quick3d/quick3dscene2d/items/scene2dsharedobject_p.h
+++ b/src/quick3d/quick3dscene2d/items/scene2dsharedobject_p.h
@@ -70,7 +70,7 @@ namespace Quick {
class Scene2DManager;
-class QT3DQUICKSCENE2DSHARED_EXPORT Scene2DSharedObject
+class Q_3DQUICKSCENE2DSHARED_EXPORT Scene2DSharedObject
{
public:
Scene2DSharedObject(Scene2DManager *manager);
diff --git a/src/quick3d/quick3dscene2d/qt3dquickscene2d_global.h b/src/quick3d/quick3dscene2d/qt3dquickscene2d_global.h
index 509a62024..ac2f34d0d 100644
--- a/src/quick3d/quick3dscene2d/qt3dquickscene2d_global.h
+++ b/src/quick3d/quick3dscene2d/qt3dquickscene2d_global.h
@@ -43,12 +43,12 @@ QT_BEGIN_NAMESPACE
#if defined(QT_SHARED) || !defined(QT_STATIC)
# if defined(QT_BUILD_3DQUICKSCENE2D_LIB)
-# define QT3DQUICKSCENE2DSHARED_EXPORT Q_DECL_EXPORT
+# define Q_3DQUICKSCENE2DSHARED_EXPORT Q_DECL_EXPORT
# else
-# define QT3DQUICKSCENE2DSHARED_EXPORT Q_DECL_IMPORT
+# define Q_3DQUICKSCENE2DSHARED_EXPORT Q_DECL_IMPORT
# endif
#else
-# define QT3DQUICKSCENE2DSHARED_EXPORT
+# define Q_3DQUICKSCENE2DSHARED_EXPORT
#endif
QT_END_NAMESPACE
diff --git a/src/quick3d/quick3dscene2d/qt3dquickscene2d_global_p.h b/src/quick3d/quick3dscene2d/qt3dquickscene2d_global_p.h
index e115e3d5e..7b68e002c 100644
--- a/src/quick3d/quick3dscene2d/qt3dquickscene2d_global_p.h
+++ b/src/quick3d/quick3dscene2d/qt3dquickscene2d_global_p.h
@@ -51,7 +51,7 @@
#include <Qt3DQuickScene2D/qt3dquickscene2d_global.h>
#include <QtQml/qqml.h>
-#define QT3DQUICKSCENE2DSHARED_PRIVATE_EXPORT QT3DQUICKSCENE2DSHARED_EXPORT
+#define Q_3DQUICKSCENE2DSHARED_PRIVATE_EXPORT Q_3DQUICKSCENE2DSHARED_EXPORT
QT_BEGIN_NAMESPACE
@@ -59,8 +59,8 @@ namespace Qt3DRender {
namespace Quick {
-QT3DQUICKSCENE2DSHARED_PRIVATE_EXPORT void Quick3DScene2D_initialize();
-QT3DQUICKSCENE2DSHARED_PRIVATE_EXPORT void Quick3DScene2D_registerType(const char *className,
+Q_3DQUICKSCENE2DSHARED_PRIVATE_EXPORT void Quick3DScene2D_initialize();
+Q_3DQUICKSCENE2DSHARED_PRIVATE_EXPORT void Quick3DScene2D_registerType(const char *className,
const char *quickName,
int major, int minor);
diff --git a/src/render/backend/abstractrenderer_p.h b/src/render/backend/abstractrenderer_p.h
index cd662b84d..69e71dece 100644
--- a/src/render/backend/abstractrenderer_p.h
+++ b/src/render/backend/abstractrenderer_p.h
@@ -87,7 +87,7 @@ class BackendNode;
class OffscreenSurfaceHelper;
class Shader;
-class QT3DRENDERSHARED_PRIVATE_EXPORT AbstractRenderer
+class Q_3DRENDERSHARED_PRIVATE_EXPORT AbstractRenderer
{
public:
virtual ~AbstractRenderer() {}
@@ -155,6 +155,7 @@ public:
virtual bool shouldRender() = 0;
virtual void skipNextFrame() = 0;
+ virtual QVector<Qt3DCore::QAspectJobPtr> preRenderingJobs() = 0;
virtual QVector<Qt3DCore::QAspectJobPtr> renderBinJobs() = 0;
virtual Qt3DCore::QAspectJobPtr pickBoundingVolumeJob() = 0;
virtual Qt3DCore::QAspectJobPtr rayCastingJob() = 0;
diff --git a/src/render/backend/backendnode_p.h b/src/render/backend/backendnode_p.h
index 8db68b11d..f94033c1a 100644
--- a/src/render/backend/backendnode_p.h
+++ b/src/render/backend/backendnode_p.h
@@ -64,7 +64,7 @@ namespace Render {
class RenderBackendResourceAccessor;
-class QT3DRENDERSHARED_PRIVATE_EXPORT BackendNode : public Qt3DCore::QBackendNode
+class Q_3DRENDERSHARED_PRIVATE_EXPORT BackendNode : public Qt3DCore::QBackendNode
{
public:
BackendNode(Qt3DCore::QBackendNode::Mode mode = ReadOnly);
diff --git a/src/render/backend/cameralens.cpp b/src/render/backend/cameralens.cpp
index b540b24c8..42635bad7 100644
--- a/src/render/backend/cameralens.cpp
+++ b/src/render/backend/cameralens.cpp
@@ -145,6 +145,7 @@ void CameraLens::computeSceneBoundingVolume(QNodeId entityId,
ComputeFilteredBoundingVolumeJobPtr job(new GetBoundingVolumeWithoutCameraJob(this, commandId));
job->addDependency(m_renderer->expandBoundingVolumeJob());
job->setRoot(root);
+ job->setManagers(nodeManagers);
job->ignoreSubTree(camNode);
m_renderAspect->scheduleSingleShotJob(job);
}
diff --git a/src/render/backend/cameralens_p.h b/src/render/backend/cameralens_p.h
index d00358fb8..80a1715cf 100644
--- a/src/render/backend/cameralens_p.h
+++ b/src/render/backend/cameralens_p.h
@@ -80,7 +80,7 @@ private:
QRenderAspect *m_renderAspect;
};
-class QT3DRENDERSHARED_PRIVATE_EXPORT CameraLens : public BackendNode
+class Q_3DRENDERSHARED_PRIVATE_EXPORT CameraLens : public BackendNode
{
public:
CameraLens();
diff --git a/src/render/backend/computecommand.cpp b/src/render/backend/computecommand.cpp
index 2b23df9aa..349941965 100644
--- a/src/render/backend/computecommand.cpp
+++ b/src/render/backend/computecommand.cpp
@@ -40,7 +40,6 @@
#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>
@@ -51,7 +50,9 @@ namespace Qt3DRender {
namespace Render {
ComputeCommand::ComputeCommand()
- : BackendNode(ReadOnly)
+ : BackendNode(ReadWrite)
+ , m_frameCount(0)
+ , m_runType(QComputeCommand::Continuous)
{
m_workGroups[0] = 1;
m_workGroups[1] = 1;
@@ -68,6 +69,8 @@ void ComputeCommand::cleanup()
m_workGroups[0] = 1;
m_workGroups[1] = 1;
m_workGroups[2] = 1;
+ m_frameCount = 0;
+ m_runType = QComputeCommand::Continuous;
}
void ComputeCommand::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
@@ -77,6 +80,8 @@ void ComputeCommand::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePt
m_workGroups[0] = data.workGroupX;
m_workGroups[1] = data.workGroupY;
m_workGroups[2] = data.workGroupZ;
+ m_runType = data.runType;
+ m_frameCount = data.frameCount;
if (m_renderer != nullptr)
BackendNode::markDirty(AbstractRenderer::ComputeDirty);
}
@@ -91,11 +96,30 @@ void ComputeCommand::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
m_workGroups[1] = propertyChange->value().toInt();
else if (propertyChange->propertyName() == QByteArrayLiteral("workGroupZ"))
m_workGroups[2] = propertyChange->value().toInt();
- markDirty(AbstractRenderer::AllDirty);
+ else if (propertyChange->propertyName() == QByteArrayLiteral("frameCount"))
+ m_frameCount = propertyChange->value().toInt();
+ else if (propertyChange->propertyName() == QByteArrayLiteral("runType"))
+ m_runType = static_cast<QComputeCommand::RunType>(propertyChange->value().toInt());
+ markDirty(AbstractRenderer::ComputeDirty);
}
BackendNode::sceneChangeEvent(e);
}
+// Called from buildComputeRenderCommands in a job
+void ComputeCommand::updateFrameCount()
+{
+ // Disable frontend node when reaching 0
+ --m_frameCount;
+ if (m_frameCount <= 0) {
+ setEnabled(false);
+ auto e = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
+ e->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll);
+ e->setPropertyName("enabled");
+ e->setValue(false);
+ notifyObservers(e);
+ }
+}
+
} // Render
} // Qt3DRender
diff --git a/src/render/backend/computecommand_p.h b/src/render/backend/computecommand_p.h
index fb8ca39ff..10e10fd25 100644
--- a/src/render/backend/computecommand_p.h
+++ b/src/render/backend/computecommand_p.h
@@ -52,6 +52,7 @@
//
#include <Qt3DRender/private/backendnode_p.h>
+#include <Qt3DRender/qcomputecommand.h>
QT_BEGIN_NAMESPACE
@@ -73,10 +74,17 @@ public:
inline int x() const Q_DECL_NOTHROW { return m_workGroups[0]; }
inline int y() const Q_DECL_NOTHROW { return m_workGroups[1]; }
inline int z() const Q_DECL_NOTHROW { return m_workGroups[2]; }
+ inline int frameCount() const Q_DECL_NOTHROW { return m_frameCount; }
+ inline QComputeCommand::RunType runType() const Q_DECL_NOTHROW { return m_runType; }
+
+ // Called from a job
+ void updateFrameCount();
private:
void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) override;
int m_workGroups[3];
+ int m_frameCount;
+ QComputeCommand::RunType m_runType;
};
} // Render
diff --git a/src/render/backend/entity.cpp b/src/render/backend/entity.cpp
index d8d04aef1..bf128b508 100644
--- a/src/render/backend/entity.cpp
+++ b/src/render/backend/entity.cpp
@@ -289,6 +289,26 @@ QVector<Entity *> Entity::children() const
return childrenVector;
}
+void Entity::traverse(const std::function<void(Entity *)> &operation)
+{
+ operation(this);
+ for (const HEntity &handle : qAsConst(m_childrenHandles)) {
+ Entity *child = m_nodeManagers->renderNodesManager()->data(handle);
+ if (child != nullptr)
+ child->traverse(operation);
+ }
+}
+
+void Entity::traverse(const std::function<void(const Entity *)> &operation) const
+{
+ operation(this);
+ for (const HEntity &handle : m_childrenHandles) {
+ const Entity *child = m_nodeManagers->renderNodesManager()->data(handle);
+ if (child != nullptr)
+ child->traverse(operation);
+ }
+}
+
Matrix4x4 *Entity::worldTransform()
{
return m_nodeManagers->worldMatrixManager()->data(m_worldTransform);
diff --git a/src/render/backend/entity_p.h b/src/render/backend/entity_p.h
index afa7dbf23..b4c9541f2 100644
--- a/src/render/backend/entity_p.h
+++ b/src/render/backend/entity_p.h
@@ -107,6 +107,8 @@ public:
QVector<HEntity> childrenHandles() const { return m_childrenHandles; }
QVector<Entity *> children() const;
bool hasChildren() const { return !m_childrenHandles.empty(); }
+ void traverse(const std::function<void(Entity *)> &operation);
+ void traverse(const std::function<void(const Entity *)> &operation) const;
Matrix4x4 *worldTransform();
const Matrix4x4 *worldTransform() const;
@@ -220,25 +222,25 @@ private:
#define ENTITY_COMPONENT_TEMPLATE_SPECIALIZATION(Type, Handle) \
/* Handle */ \
template<> \
- QT3DRENDERSHARED_PRIVATE_EXPORT Handle Entity::componentHandle<Type>() const; \
+ Q_3DRENDERSHARED_PRIVATE_EXPORT Handle Entity::componentHandle<Type>() const; \
/* Component */ \
template<> \
- QT3DRENDERSHARED_PRIVATE_EXPORT Type *Entity::renderComponent<Type>() const; \
+ Q_3DRENDERSHARED_PRIVATE_EXPORT Type *Entity::renderComponent<Type>() const; \
/* Uuid */ \
template<> \
- QT3DRENDERSHARED_PRIVATE_EXPORT Qt3DCore::QNodeId Entity::componentUuid<Type>() const;
+ Q_3DRENDERSHARED_PRIVATE_EXPORT Qt3DCore::QNodeId Entity::componentUuid<Type>() const;
#define ENTITY_COMPONENT_LIST_TEMPLATE_SPECIALIZATION(Type, Handle) \
/* Handle */ \
template<> \
- QT3DRENDERSHARED_PRIVATE_EXPORT QVector<Handle> Entity::componentsHandle<Type>() const; \
+ Q_3DRENDERSHARED_PRIVATE_EXPORT QVector<Handle> Entity::componentsHandle<Type>() const; \
/* Component */ \
template<> \
- QT3DRENDERSHARED_PRIVATE_EXPORT QVector<Type *> Entity::renderComponents<Type>() const; \
+ Q_3DRENDERSHARED_PRIVATE_EXPORT QVector<Type *> Entity::renderComponents<Type>() const; \
/* Uuid */ \
template<> \
- QT3DRENDERSHARED_PRIVATE_EXPORT Qt3DCore::QNodeIdVector Entity::componentsUuid<Type>() const;
+ Q_3DRENDERSHARED_PRIVATE_EXPORT Qt3DCore::QNodeIdVector Entity::componentsUuid<Type>() const;
#define ENTITY_COMPONENT_TEMPLATE_IMPL(Type, Handle, Manager, variable) \
/* Handle */ \
diff --git a/src/render/backend/entityaccumulator.cpp b/src/render/backend/entityaccumulator.cpp
new file mode 100644
index 000000000..f003420dd
--- /dev/null
+++ b/src/render/backend/entityaccumulator.cpp
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** 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 "entityaccumulator_p.h"
+#include "entityvisitor_p.h"
+
+QT_USE_NAMESPACE
+using namespace Qt3DRender::Render;
+
+namespace {
+
+class Accumulator : public EntityVisitor
+{
+public:
+ Accumulator(std::function<bool(Entity *)> predicate, NodeManagers *manager)
+ : EntityVisitor(manager)
+ , m_predicate(predicate)
+ {
+ }
+
+ EntityVisitor::Operation visit(Entity *entity) override {
+ if (m_predicate(entity))
+ m_entities << entity;
+ return Continue;
+ }
+
+ QVector<Entity *> m_entities;
+
+private:
+ std::function<bool(Entity *)> m_predicate;
+};
+
+}
+
+EntityAccumulator::EntityAccumulator(NodeManagers *manager)
+ : m_manager(manager)
+ , m_predicate([](Entity*) { return true; })
+{
+
+}
+
+EntityAccumulator::EntityAccumulator(std::function<bool (Entity *)> predicate, NodeManagers *manager)
+ : m_manager(manager)
+ , m_predicate(predicate)
+{
+
+}
+
+/*!
+ * \internal
+ *
+ * Call this to traverse the scene graph and return all entities for
+ * which the predicate returns true.
+ *
+ * Can be useful to get all the entities that contain a specific type
+ * of component.
+ */
+QVector<Entity *> EntityAccumulator::apply(Entity *root) const
+{
+ Accumulator a(m_predicate, m_manager);
+ a.apply(root);
+ return a.m_entities;
+}
diff --git a/src/render/backend/entityaccumulator_p.h b/src/render/backend/entityaccumulator_p.h
new file mode 100644
index 000000000..69656815f
--- /dev/null
+++ b/src/render/backend/entityaccumulator_p.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** 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_ENTITYACCUMULATOR_H
+#define QT3DRENDER_RENDER_ENTITYACCUMULATOR_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/entity_p.h>
+#include <Qt3DRender/private/qt3drender_global_p.h>
+#include <QVector>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+namespace Render {
+
+class NodeManagers;
+
+class Q_3DRENDERSHARED_PRIVATE_EXPORT EntityAccumulator
+{
+public:
+ EntityAccumulator(NodeManagers *manager);
+ EntityAccumulator(std::function<bool(Entity*)> predicate, NodeManagers *manager);
+
+ QVector<Entity *> apply(Entity *root) const;
+
+private:
+ NodeManagers *m_manager;
+ std::function<bool(Entity *)> m_predicate;
+};
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_ENTITYACCUMULATOR_H
diff --git a/src/render/backend/entityvisitor.cpp b/src/render/backend/entityvisitor.cpp
new file mode 100644
index 000000000..87dd353bb
--- /dev/null
+++ b/src/render/backend/entityvisitor.cpp
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** 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 "entityvisitor_p.h"
+#include <Qt3DRender/private/managers_p.h>
+#include <Qt3DRender/private/nodemanagers_p.h>
+
+QT_USE_NAMESPACE
+using namespace Qt3DRender::Render;
+
+EntityVisitor::EntityVisitor(NodeManagers *manager)
+ : m_manager(manager)
+ , m_pruneDisabled(false)
+{
+
+}
+
+EntityVisitor::~EntityVisitor() = default;
+
+/*!
+ * \internal
+ *
+ * Override in derived class to do work on the current entity
+ *
+ * Return value (Continue, Prune, Stop) will affect traversal
+ */
+EntityVisitor::Operation EntityVisitor::visit(Entity *entity) {
+ // return false to stop traversal
+ if (!entity)
+ return Stop;
+ return Continue;
+}
+
+/*!
+ * \internal
+ *
+ * If true, disabled entities and all their children will be ignored
+ * during traversal
+ *
+ */
+bool EntityVisitor::pruneDisabled() const
+{
+ return m_pruneDisabled;
+}
+
+void EntityVisitor::setPruneDisabled(bool pruneDisabled)
+{
+ m_pruneDisabled = pruneDisabled;
+}
+
+/*!
+ * \internal
+ *
+ * Call on the root of the tree that should be traversed.
+ * Returns false if any visit resulted in Stop
+ */
+bool EntityVisitor::apply(Entity *root) {
+ if (!root)
+ return false;
+ if (m_pruneDisabled && !root->isEnabled())
+ return true;
+
+ const auto op = visit(root);
+ if (op == Stop)
+ return false;
+ if (op == Prune)
+ return true;
+
+ const auto childrenHandles = root->childrenHandles();
+ for (const HEntity &handle : childrenHandles) {
+ Entity *child = m_manager->renderNodesManager()->data(handle);
+ if (child != nullptr && !apply(child))
+ return false;
+ }
+
+ return true;
+}
diff --git a/src/render/backend/entityvisitor_p.h b/src/render/backend/entityvisitor_p.h
new file mode 100644
index 000000000..2f4f1c813
--- /dev/null
+++ b/src/render/backend/entityvisitor_p.h
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** 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_ENTITYVISITOR_H
+#define QT3DRENDER_RENDER_ENTITYVISITOR_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 <qglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+namespace Render {
+
+class Entity;
+class NodeManagers;
+
+class Q_AUTOTEST_EXPORT EntityVisitor
+{
+public:
+ enum Operation {
+ Continue, //! continue traversal
+ Prune, //! don't traverse children
+ Stop //! abort traversal
+ };
+
+ EntityVisitor(NodeManagers *manager);
+ virtual ~EntityVisitor();
+
+ virtual Operation visit(Entity *entity = nullptr);
+
+ bool pruneDisabled() const;
+ void setPruneDisabled(bool pruneDisabled);
+
+ bool apply(Entity *root);
+
+protected:
+ NodeManagers *m_manager;
+
+private:
+ bool m_pruneDisabled;
+};
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_ENTITYVISITOR_H
diff --git a/src/render/backend/managers_p.h b/src/render/backend/managers_p.h
index fc2a0b479..f28dbe768 100644
--- a/src/render/backend/managers_p.h
+++ b/src/render/backend/managers_p.h
@@ -72,6 +72,7 @@
#include <Qt3DRender/private/shaderdata_p.h>
#include <Qt3DRender/private/handle_types_p.h>
#include <Qt3DRender/private/glbuffer_p.h>
+#include <Qt3DRender/private/glfence_p.h>
#include <Qt3DRender/private/textureimage_p.h>
#include <Qt3DRender/private/attribute_p.h>
#include <Qt3DRender/private/geometry_p.h>
@@ -317,6 +318,10 @@ class GLBufferManager : public Qt3DCore::QResourceManager<
{
};
+class GLFenceManager : public QHash<Qt3DCore::QNodeId, GLFence>
+{
+};
+
class TextureImageManager : public Qt3DCore::QResourceManager<
TextureImage,
Qt3DCore::QNodeId,
diff --git a/src/render/backend/nodemanagers.cpp b/src/render/backend/nodemanagers.cpp
index 5db35082d..584ddd65c 100644
--- a/src/render/backend/nodemanagers.cpp
+++ b/src/render/backend/nodemanagers.cpp
@@ -85,6 +85,7 @@ NodeManagers::NodeManagers()
, m_parameterManager(new ParameterManager())
, m_shaderDataManager(new ShaderDataManager())
, m_glBufferManager(new GLBufferManager())
+ , m_glFenceManager(new GLFenceManager())
, m_bufferManager(new BufferManager())
, m_attributeManager(new AttributeManager())
, m_geometryManager(new GeometryManager())
@@ -128,6 +129,7 @@ NodeManagers::~NodeManagers()
delete m_parameterManager;
delete m_shaderDataManager;
delete m_glBufferManager;
+ delete m_glFenceManager;
delete m_textureImageManager;
delete m_bufferManager;
delete m_attributeManager;
diff --git a/src/render/backend/nodemanagers_p.h b/src/render/backend/nodemanagers_p.h
index 9277d4385..4ef1f4927 100644
--- a/src/render/backend/nodemanagers_p.h
+++ b/src/render/backend/nodemanagers_p.h
@@ -87,6 +87,7 @@ class AttachmentManager;
class ParameterManager;
class ShaderDataManager;
class GLBufferManager;
+class GLFenceManager;
class TextureImageManager;
class FilterKeyManager;
class FrameGraphManager;
@@ -145,7 +146,7 @@ class OpenGLVertexArrayObject;
class ResourceAccessor;
-class QT3DRENDERSHARED_PRIVATE_EXPORT NodeManagers
+class Q_3DRENDERSHARED_PRIVATE_EXPORT NodeManagers
{
public:
NodeManagers();
@@ -210,6 +211,7 @@ public:
inline ParameterManager *parameterManager() const Q_DECL_NOEXCEPT { return m_parameterManager; }
inline ShaderDataManager *shaderDataManager() const Q_DECL_NOEXCEPT { return m_shaderDataManager; }
inline GLBufferManager *glBufferManager() const Q_DECL_NOEXCEPT { return m_glBufferManager; }
+ inline GLFenceManager *glFenceManager() const Q_DECL_NOEXCEPT { return m_glFenceManager; }
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; }
@@ -255,6 +257,7 @@ private:
ParameterManager *m_parameterManager;
ShaderDataManager *m_shaderDataManager;
GLBufferManager *m_glBufferManager;
+ GLFenceManager *m_glFenceManager;
BufferManager *m_bufferManager;
AttributeManager *m_attributeManager;
GeometryManager *m_geometryManager;
@@ -276,97 +279,97 @@ private:
// Specializations
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT CameraManager *NodeManagers::manager<CameraLens>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT CameraManager *NodeManagers::manager<CameraLens>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT EntityManager *NodeManagers::manager<Entity>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT EntityManager *NodeManagers::manager<Entity>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT MaterialManager *NodeManagers::manager<Material>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT MaterialManager *NodeManagers::manager<Material>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT MatrixManager *NodeManagers::manager<QMatrix4x4*>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT MatrixManager *NodeManagers::manager<QMatrix4x4*>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT VAOManager *NodeManagers::manager<OpenGLVertexArrayObject>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT VAOManager *NodeManagers::manager<OpenGLVertexArrayObject>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT ShaderManager *NodeManagers::manager<Shader>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT ShaderManager *NodeManagers::manager<Shader>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT ShaderBuilderManager *NodeManagers::manager<ShaderBuilder>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT ShaderBuilderManager *NodeManagers::manager<ShaderBuilder>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT TechniqueManager *NodeManagers::manager<Technique>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT TechniqueManager *NodeManagers::manager<Technique>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT EffectManager *NodeManagers::manager<Effect>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT EffectManager *NodeManagers::manager<Effect>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT RenderPassManager *NodeManagers::manager<RenderPass>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT RenderPassManager *NodeManagers::manager<RenderPass>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT TextureManager *NodeManagers::manager<Texture>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT TextureManager *NodeManagers::manager<Texture>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT TextureDataManager *NodeManagers::manager<QTextureImageData>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT TextureDataManager *NodeManagers::manager<QTextureImageData>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT LayerManager *NodeManagers::manager<Layer>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT LayerManager *NodeManagers::manager<Layer>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT LevelOfDetailManager *NodeManagers::manager<LevelOfDetail>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT LevelOfDetailManager *NodeManagers::manager<LevelOfDetail>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT FilterKeyManager *NodeManagers::manager<FilterKey>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT FilterKeyManager *NodeManagers::manager<FilterKey>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT FrameGraphManager *NodeManagers::manager<FrameGraphNode*>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT FrameGraphManager *NodeManagers::manager<FrameGraphNode*>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT TransformManager *NodeManagers::manager<Transform>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT TransformManager *NodeManagers::manager<Transform>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT RenderTargetManager *NodeManagers::manager<RenderTarget>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT RenderTargetManager *NodeManagers::manager<RenderTarget>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT SceneManager *NodeManagers::manager<Scene>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT SceneManager *NodeManagers::manager<Scene>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT AttachmentManager *NodeManagers::manager<RenderTargetOutput>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT AttachmentManager *NodeManagers::manager<RenderTargetOutput>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT ParameterManager *NodeManagers::manager<Parameter>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT ParameterManager *NodeManagers::manager<Parameter>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT ShaderDataManager *NodeManagers::manager<ShaderData>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT ShaderDataManager *NodeManagers::manager<ShaderData>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT GLBufferManager *NodeManagers::manager<GLBuffer>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT GLBufferManager *NodeManagers::manager<GLBuffer>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT TextureImageManager *NodeManagers::manager<TextureImage>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT TextureImageManager *NodeManagers::manager<TextureImage>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT BufferManager *NodeManagers::manager<Buffer>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT BufferManager *NodeManagers::manager<Buffer>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT AttributeManager *NodeManagers::manager<Attribute>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT AttributeManager *NodeManagers::manager<Attribute>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT GeometryManager *NodeManagers::manager<Geometry>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT GeometryManager *NodeManagers::manager<Geometry>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT GeometryRendererManager *NodeManagers::manager<GeometryRenderer>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT GeometryRendererManager *NodeManagers::manager<GeometryRenderer>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT ObjectPickerManager *NodeManagers::manager<ObjectPicker>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT ObjectPickerManager *NodeManagers::manager<ObjectPicker>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT RayCasterManager *NodeManagers::manager<RayCaster>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT RayCasterManager *NodeManagers::manager<RayCaster>() const Q_DECL_NOEXCEPT;
//template<>
-//QT3DRENDERSHARED_PRIVATE_EXPORT BoundingVolumeDebugManager *NodeManagers::manager<BoundingVolumeDebug>() const Q_DECL_NOEXCEPT;
+//Q_3DRENDERSHARED_PRIVATE_EXPORT BoundingVolumeDebugManager *NodeManagers::manager<BoundingVolumeDebug>() const Q_DECL_NOEXCEPT;
template<>
LightManager *NodeManagers::manager<Light>() const Q_DECL_NOEXCEPT;
@@ -375,19 +378,19 @@ template<>
EnvironmentLightManager *NodeManagers::manager<EnvironmentLight>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT ComputeCommandManager *NodeManagers::manager<ComputeCommand>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT ComputeCommandManager *NodeManagers::manager<ComputeCommand>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT RenderStateManager *NodeManagers::manager<RenderStateNode>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT RenderStateManager *NodeManagers::manager<RenderStateNode>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT ArmatureManager *NodeManagers::manager<Armature>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT ArmatureManager *NodeManagers::manager<Armature>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT SkeletonManager *NodeManagers::manager<Skeleton>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT SkeletonManager *NodeManagers::manager<Skeleton>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT JointManager *NodeManagers::manager<Joint>() const Q_DECL_NOEXCEPT;
+Q_3DRENDERSHARED_PRIVATE_EXPORT JointManager *NodeManagers::manager<Joint>() const Q_DECL_NOEXCEPT;
} // Render
diff --git a/src/render/backend/platformsurfacefilter_p.h b/src/render/backend/platformsurfacefilter_p.h
index 425ef303e..4fb43bae1 100644
--- a/src/render/backend/platformsurfacefilter_p.h
+++ b/src/render/backend/platformsurfacefilter_p.h
@@ -108,7 +108,7 @@ private:
void markSurfaceAsValid();
};
-class QT3DRENDERSHARED_PRIVATE_EXPORT SurfaceLocker
+class Q_3DRENDERSHARED_PRIVATE_EXPORT SurfaceLocker
{
public:
explicit SurfaceLocker(QSurface *surface);
diff --git a/src/render/backend/render-backend.pri b/src/render/backend/render-backend.pri
index 352de3be5..6b60dfcda 100644
--- a/src/render/backend/render-backend.pri
+++ b/src/render/backend/render-backend.pri
@@ -11,6 +11,8 @@ HEADERS += \
$$PWD/platformsurfacefilter_p.h \
$$PWD/cameralens_p.h \
$$PWD/entity_p.h \
+ $$PWD/entityvisitor_p.h \
+ $$PWD/entityaccumulator_p.h \
$$PWD/layer_p.h \
$$PWD/levelofdetail_p.h \
$$PWD/nodefunctor_p.h \
@@ -44,6 +46,8 @@ SOURCES += \
$$PWD/platformsurfacefilter.cpp \
$$PWD/cameralens.cpp \
$$PWD/entity.cpp \
+ $$PWD/entityvisitor.cpp \
+ $$PWD/entityaccumulator.cpp \
$$PWD/layer.cpp \
$$PWD/levelofdetail.cpp \
$$PWD/transform.cpp \
diff --git a/src/render/backend/resourceaccessor_p.h b/src/render/backend/resourceaccessor_p.h
index 627efcb0d..ec53a04a2 100644
--- a/src/render/backend/resourceaccessor_p.h
+++ b/src/render/backend/resourceaccessor_p.h
@@ -83,7 +83,7 @@ public:
virtual bool accessResource(ResourceType type, Qt3DCore::QNodeId nodeId, void **handle, QMutex **lock) = 0;
};
-class QT3DRENDERSHARED_PRIVATE_EXPORT ResourceAccessor : public RenderBackendResourceAccessor
+class Q_3DRENDERSHARED_PRIVATE_EXPORT ResourceAccessor : public RenderBackendResourceAccessor
{
public:
ResourceAccessor(NodeManagers *mgr);
diff --git a/src/render/backend/trianglesvisitor_p.h b/src/render/backend/trianglesvisitor_p.h
index ee206f1c9..d05eaef09 100644
--- a/src/render/backend/trianglesvisitor_p.h
+++ b/src/render/backend/trianglesvisitor_p.h
@@ -92,7 +92,7 @@ protected:
Qt3DCore::QNodeId m_nodeId;
};
-class QT3DRENDERSHARED_PRIVATE_EXPORT CoordinateReader
+class Q_3DRENDERSHARED_PRIVATE_EXPORT CoordinateReader
{
public:
explicit CoordinateReader(NodeManagers *manager)
diff --git a/src/render/framegraph/blitframebuffer.cpp b/src/render/framegraph/blitframebuffer.cpp
index b9ff4bea3..342594baf 100644
--- a/src/render/framegraph/blitframebuffer.cpp
+++ b/src/render/framegraph/blitframebuffer.cpp
@@ -66,20 +66,26 @@ void BlitFramebuffer::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e);
if (propertyChange->propertyName() == QByteArrayLiteral("sourceRenderTarget")) {
m_sourceRenderTargetId = propertyChange->value().value<QNodeId>();
+ markDirty(AbstractRenderer::FrameGraphDirty);
} else if (propertyChange->propertyName() == QByteArrayLiteral("destinationRenderTarget")) {
m_destinationRenderTargetId = propertyChange->value().value<QNodeId>();
+ markDirty(AbstractRenderer::FrameGraphDirty);
} else if (propertyChange->propertyName() == QByteArrayLiteral("sourceRect")) {
m_sourceRect = propertyChange->value().toRect();
+ markDirty(AbstractRenderer::FrameGraphDirty);
} else if (propertyChange->propertyName() == QByteArrayLiteral("destinationRect")) {
m_destinationRect = propertyChange->value().toRect();
+ markDirty(AbstractRenderer::FrameGraphDirty);
} else if (propertyChange->propertyName() == QByteArrayLiteral("sourceAttachmentPoint")) {
m_sourceAttachmentPoint = propertyChange->value().value<Qt3DRender::QRenderTargetOutput::AttachmentPoint>();
+ markDirty(AbstractRenderer::FrameGraphDirty);
} else if (propertyChange->propertyName() == QByteArrayLiteral("destinationAttachmentPoint")) {
m_destinationAttachmentPoint = propertyChange->value().value<Qt3DRender::QRenderTargetOutput::AttachmentPoint>();
+ markDirty(AbstractRenderer::FrameGraphDirty);
} else if (propertyChange->propertyName() == QByteArrayLiteral("interpolationMethod")) {
m_interpolationMethod = propertyChange->value().value<QBlitFramebuffer::InterpolationMethod>();
+ markDirty(AbstractRenderer::FrameGraphDirty);
}
- markDirty(AbstractRenderer::AllDirty);
}
FrameGraphNode::sceneChangeEvent(e);
}
diff --git a/src/render/framegraph/cameraselectornode.cpp b/src/render/framegraph/cameraselectornode.cpp
index e21fdf02c..357611c7c 100644
--- a/src/render/framegraph/cameraselectornode.cpp
+++ b/src/render/framegraph/cameraselectornode.cpp
@@ -70,9 +70,10 @@ void CameraSelector::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
qCDebug(Render::Framegraph) << Q_FUNC_INFO;
if (e->type() == PropertyUpdated) {
QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e);
- if (propertyChange->propertyName() == QByteArrayLiteral("camera"))
+ if (propertyChange->propertyName() == QByteArrayLiteral("camera")) {
m_cameraUuid = propertyChange->value().value<QNodeId>();
- markDirty(AbstractRenderer::AllDirty);
+ markDirty(AbstractRenderer::FrameGraphDirty);
+ }
}
FrameGraphNode::sceneChangeEvent(e);
}
diff --git a/src/render/framegraph/clearbuffers.cpp b/src/render/framegraph/clearbuffers.cpp
index d730123c3..ab6225a4b 100644
--- a/src/render/framegraph/clearbuffers.cpp
+++ b/src/render/framegraph/clearbuffers.cpp
@@ -80,17 +80,21 @@ void ClearBuffers::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e);
if (propertyChange->propertyName() == QByteArrayLiteral("buffers")) {
m_type = static_cast<QClearBuffers::BufferType>(propertyChange->value().toInt());
+ markDirty(AbstractRenderer::FrameGraphDirty);
} else if (propertyChange->propertyName() == QByteArrayLiteral("clearColor")) {
m_clearColorAsColor = propertyChange->value().value<QColor>();
m_clearColor = vec4dFromColor(m_clearColorAsColor);
+ markDirty(AbstractRenderer::FrameGraphDirty);
} else if (propertyChange->propertyName() == QByteArrayLiteral("clearDepthValue")) {
m_clearDepthValue = propertyChange->value().toFloat();
+ markDirty(AbstractRenderer::FrameGraphDirty);
} else if (propertyChange->propertyName() == QByteArrayLiteral("clearStencilValue")) {
m_clearStencilValue = propertyChange->value().toInt();
+ markDirty(AbstractRenderer::FrameGraphDirty);
} else if (propertyChange->propertyName() == QByteArrayLiteral("colorBuffer")) {
m_colorBufferId = propertyChange->value().value<QNodeId>();
+ markDirty(AbstractRenderer::FrameGraphDirty);
}
- markDirty(AbstractRenderer::AllDirty);
}
FrameGraphNode::sceneChangeEvent(e);
}
diff --git a/src/render/framegraph/dispatchcompute.cpp b/src/render/framegraph/dispatchcompute.cpp
index 6ffb42e71..f7e9dcff4 100644
--- a/src/render/framegraph/dispatchcompute.cpp
+++ b/src/render/framegraph/dispatchcompute.cpp
@@ -80,13 +80,16 @@ void DispatchCompute::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
if (e->type() == Qt3DCore::PropertyUpdated) {
Qt3DCore::QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
- if (propertyChange->propertyName() == QByteArrayLiteral("workGroupX"))
+ if (propertyChange->propertyName() == QByteArrayLiteral("workGroupX")) {
m_workGroups[0] = propertyChange->value().toInt();
- else if (propertyChange->propertyName() == QByteArrayLiteral("workGroupY"))
+ markDirty(AbstractRenderer::FrameGraphDirty|AbstractRenderer::ComputeDirty);
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("workGroupY")) {
m_workGroups[1] = propertyChange->value().toInt();
- else if (propertyChange->propertyName() == QByteArrayLiteral("workGroupZ"))
+ markDirty(AbstractRenderer::FrameGraphDirty|AbstractRenderer::ComputeDirty);
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("workGroupZ")) {
m_workGroups[2] = propertyChange->value().toInt();
- markDirty(AbstractRenderer::AllDirty);
+ markDirty(AbstractRenderer::FrameGraphDirty|AbstractRenderer::ComputeDirty);
+ }
}
FrameGraphNode::sceneChangeEvent(e);
}
diff --git a/src/render/framegraph/framegraph.pri b/src/render/framegraph/framegraph.pri
index 9784a193c..b969c85e5 100644
--- a/src/render/framegraph/framegraph.pri
+++ b/src/render/framegraph/framegraph.pri
@@ -58,7 +58,13 @@ HEADERS += \
$$PWD/proximityfilter_p.h \
$$PWD/qblitframebuffer.h \
$$PWD/qblitframebuffer_p.h \
- $$PWD/blitframebuffer_p.h
+ $$PWD/blitframebuffer_p.h \
+ $$PWD/qsetfence.h \
+ $$PWD/qwaitfence.h \
+ $$PWD/qwaitfence_p.h \
+ $$PWD/qsetfence_p.h \
+ $$PWD/setfence_p.h \
+ $$PWD/waitfence_p.h
SOURCES += \
$$PWD/cameraselectornode.cpp \
@@ -100,4 +106,8 @@ SOURCES += \
$$PWD/qproximityfilter.cpp \
$$PWD/proximityfilter.cpp \
$$PWD/qblitframebuffer.cpp \
- $$PWD/blitframebuffer.cpp
+ $$PWD/blitframebuffer.cpp \
+ $$PWD/qsetfence.cpp \
+ $$PWD/qwaitfence.cpp \
+ $$PWD/setfence.cpp \
+ $$PWD/waitfence.cpp
diff --git a/src/render/framegraph/framegraphnode.cpp b/src/render/framegraph/framegraphnode.cpp
index 47e8ec91e..16f54df3b 100644
--- a/src/render/framegraph/framegraphnode.cpp
+++ b/src/render/framegraph/framegraphnode.cpp
@@ -133,19 +133,21 @@ void FrameGraphNode::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
switch (e->type()) {
case Qt3DCore::PropertyUpdated: {
- auto change = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
- if (change->propertyName() == QByteArrayLiteral("parentFrameGraphUpdated")) {
- auto newParent = change->value().value<Qt3DCore::QNodeId>();
+ Qt3DCore::QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
+ if (propertyChange->propertyName() == QByteArrayLiteral("enabled")) {
+ d_func()->m_enabled = propertyChange->value().toBool();
+ markDirty(AbstractRenderer::FrameGraphDirty);
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("parentFrameGraphUpdated")) {
+ auto newParent = propertyChange->value().value<Qt3DCore::QNodeId>();
setParentId(newParent);
- }
+ markDirty(AbstractRenderer::AllDirty);
+ }
break;
}
default:
+ markDirty(AbstractRenderer::AllDirty);
break;
}
-
- markDirty(AbstractRenderer::AllDirty);
- BackendNode::sceneChangeEvent(e);
}
void FrameGraphNode::cleanup()
diff --git a/src/render/framegraph/framegraphnode_p.h b/src/render/framegraph/framegraphnode_p.h
index 0efd391c7..6aa3b3d6d 100644
--- a/src/render/framegraph/framegraphnode_p.h
+++ b/src/render/framegraph/framegraphnode_p.h
@@ -101,7 +101,9 @@ public:
BufferCapture,
MemoryBarrier,
ProximityFilter,
- BlitFramebuffer
+ BlitFramebuffer,
+ SetFence,
+ WaitFence
};
FrameGraphNodeType nodeType() const { return m_nodeType; }
diff --git a/src/render/framegraph/layerfilternode.cpp b/src/render/framegraph/layerfilternode.cpp
index 4b6842015..f9881be0d 100644
--- a/src/render/framegraph/layerfilternode.cpp
+++ b/src/render/framegraph/layerfilternode.cpp
@@ -73,7 +73,7 @@ void LayerFilterNode::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
const auto change = qSharedPointerCast<QPropertyNodeAddedChange>(e);
if (change->propertyName() == QByteArrayLiteral("layer"))
m_layerIds.append(change->addedNodeId());
- markDirty(AbstractRenderer::LayersDirty);
+ markDirty(AbstractRenderer::FrameGraphDirty|AbstractRenderer::LayersDirty);
break;
}
@@ -81,7 +81,7 @@ void LayerFilterNode::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
const auto change = qSharedPointerCast<QPropertyNodeRemovedChange>(e);
if (change->propertyName() == QByteArrayLiteral("layer"))
m_layerIds.removeOne(change->removedNodeId());
- markDirty(AbstractRenderer::LayersDirty);
+ markDirty(AbstractRenderer::FrameGraphDirty|AbstractRenderer::LayersDirty);
break;
}
@@ -89,6 +89,7 @@ void LayerFilterNode::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
const auto change = qSharedPointerCast<QPropertyUpdatedChange>(e);
if (change->propertyName() == QByteArrayLiteral("filterMode")) {
m_filterMode = static_cast<QLayerFilter::FilterMode>(change->value().value<int>());
+ markDirty(AbstractRenderer::FrameGraphDirty|AbstractRenderer::LayersDirty);
break;
}
}
diff --git a/src/render/framegraph/memorybarrier.cpp b/src/render/framegraph/memorybarrier.cpp
index ee8f156e3..59b3071ab 100644
--- a/src/render/framegraph/memorybarrier.cpp
+++ b/src/render/framegraph/memorybarrier.cpp
@@ -68,7 +68,7 @@ void MemoryBarrier::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
Qt3DCore::QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
if (propertyChange->propertyName() == QByteArrayLiteral("waitOperations")) {
m_waitOperations = propertyChange->value().value<QMemoryBarrier::Operations>();
- markDirty(AbstractRenderer::AllDirty);
+ markDirty(AbstractRenderer::FrameGraphDirty);
}
}
FrameGraphNode::sceneChangeEvent(e);
diff --git a/src/render/framegraph/proximityfilter.cpp b/src/render/framegraph/proximityfilter.cpp
index aed19828b..cdfd7e51e 100644
--- a/src/render/framegraph/proximityfilter.cpp
+++ b/src/render/framegraph/proximityfilter.cpp
@@ -67,11 +67,13 @@ void ProximityFilter::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
qCDebug(Render::Framegraph) << Q_FUNC_INFO;
if (e->type() == Qt3DCore::PropertyUpdated) {
Qt3DCore::QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
- if (propertyChange->propertyName() == QByteArrayLiteral("entity"))
+ if (propertyChange->propertyName() == QByteArrayLiteral("entity")) {
m_entityId = propertyChange->value().value<Qt3DCore::QNodeId>();
- else if (propertyChange->propertyName() == QByteArrayLiteral("distanceThreshold"))
+ markDirty(AbstractRenderer::FrameGraphDirty);
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("distanceThreshold")) {
m_distanceThreshold = propertyChange->value().toFloat();
- markDirty(AbstractRenderer::AllDirty);
+ markDirty(AbstractRenderer::FrameGraphDirty);
+ }
}
FrameGraphNode::sceneChangeEvent(e);
}
diff --git a/src/render/framegraph/qblitframebuffer.cpp b/src/render/framegraph/qblitframebuffer.cpp
index b0a29eab8..d0e1bdbf3 100644
--- a/src/render/framegraph/qblitframebuffer.cpp
+++ b/src/render/framegraph/qblitframebuffer.cpp
@@ -64,8 +64,62 @@ namespace Qt3DRender {
\note In practice the QBlitFramebuffer node will often be used in
combination with QNoDraw since a blit should not involve issuing draw calls
for any entities.
+
+*/
+/*!
+ \enum Qt3DRender::QBlitFramebuffer::InterpolationMethod
+
+ Specifies the interpolation applied if the image is stretched.
+
+*/
+/*!
+ \property Qt3DRender::QBlitFramebuffer::destination
+
+ Specifies the destination render target. When not set, the destination
+ is assumed to be the default framebuffer (i.e. the backbuffer of
+ the current surface), if there is one.
+
+ \note the source and destination must not refer to the same render
+ target.
+*/
+/*!
+
+ \property Qt3DRender::QBlitFramebuffer::destinationAttachmentPoint
+
+ Specifies the target attachment point.
+*/
+
+/*!
+ \property Qt3DRender::QBlitFramebuffer::destinationRect
+
+ Specifies the destination rectangle. The coordinates are assumed to follow
+ the normal Qt coordinate system, meaning Y runs from top to bottom.
+*/
+
+/*!
+ \property Qt3DRender::QBlitFramebuffer::source
+
+ Specifies the source render target. When not set, the source is assumed to
+ be the default framebuffer (i.e. the backbuffer of the current surface), if
+ there is one.
+
+ \note the source and destination must not refer to the same render target.
+
+*/
+/*!
+ \property Qt3DRender::QBlitFramebuffer::sourceAttachmentPoint
+
+ Specifies the source attachment point.
+
+*/
+/*!
+ \property Qt3DRender::QBlitFramebuffer::sourceRect
+
+ Specifies the source rectangle. The coordinates are assumed to follow the
+ normal Qt coordinate system, meaning Y runs from top to bottom.
*/
+
/*!
\qmltype BlitFramebuffer
\inqmlmodule Qt3D.Render
diff --git a/src/render/framegraph/qblitframebuffer.h b/src/render/framegraph/qblitframebuffer.h
index 77b74ab53..79c216d24 100644
--- a/src/render/framegraph/qblitframebuffer.h
+++ b/src/render/framegraph/qblitframebuffer.h
@@ -51,7 +51,7 @@ namespace Qt3DRender {
class QBlitFramebufferPrivate;
class QRenderTarget;
-class QT3DRENDERSHARED_EXPORT QBlitFramebuffer : public QFrameGraphNode
+class Q_3DRENDERSHARED_EXPORT QBlitFramebuffer : public QFrameGraphNode
{
Q_OBJECT
Q_PROPERTY(Qt3DRender::QRenderTarget *source READ source WRITE setSource NOTIFY sourceChanged)
diff --git a/src/render/framegraph/qbuffercapture.h b/src/render/framegraph/qbuffercapture.h
index ab8c7d2c2..e5073a308 100644
--- a/src/render/framegraph/qbuffercapture.h
+++ b/src/render/framegraph/qbuffercapture.h
@@ -51,7 +51,7 @@ namespace Qt3DRender
class QBufferCapturePrivate;
-class QT3DRENDERSHARED_EXPORT QBufferCapture : public QFrameGraphNode
+class Q_3DRENDERSHARED_EXPORT QBufferCapture : public QFrameGraphNode
{
Q_OBJECT
public:
diff --git a/src/render/framegraph/qcameraselector.h b/src/render/framegraph/qcameraselector.h
index 9aff269ca..861948d94 100644
--- a/src/render/framegraph/qcameraselector.h
+++ b/src/render/framegraph/qcameraselector.h
@@ -49,7 +49,7 @@ namespace Qt3DRender {
class QCameraSelectorPrivate;
-class QT3DRENDERSHARED_EXPORT QCameraSelector : public QFrameGraphNode
+class Q_3DRENDERSHARED_EXPORT QCameraSelector : public QFrameGraphNode
{
Q_OBJECT
Q_PROPERTY(Qt3DCore::QEntity *camera READ camera WRITE setCamera NOTIFY cameraChanged)
diff --git a/src/render/framegraph/qclearbuffers.h b/src/render/framegraph/qclearbuffers.h
index 7077b3f24..441a83e78 100644
--- a/src/render/framegraph/qclearbuffers.h
+++ b/src/render/framegraph/qclearbuffers.h
@@ -51,7 +51,7 @@ namespace Qt3DRender {
class QClearBuffersPrivate;
-class QT3DRENDERSHARED_EXPORT QClearBuffers : public QFrameGraphNode
+class Q_3DRENDERSHARED_EXPORT QClearBuffers : public QFrameGraphNode
{
Q_OBJECT
Q_PROPERTY(BufferType buffers READ buffers WRITE setBuffers NOTIFY buffersChanged)
diff --git a/src/render/framegraph/qdispatchcompute.h b/src/render/framegraph/qdispatchcompute.h
index 417796b61..dd6efb3ec 100644
--- a/src/render/framegraph/qdispatchcompute.h
+++ b/src/render/framegraph/qdispatchcompute.h
@@ -49,7 +49,7 @@ namespace Qt3DRender {
class QDispatchComputePrivate;
-class QT3DRENDERSHARED_EXPORT QDispatchCompute : public QFrameGraphNode
+class Q_3DRENDERSHARED_EXPORT QDispatchCompute : public QFrameGraphNode
{
Q_OBJECT
Q_PROPERTY(int workGroupX READ workGroupX WRITE setWorkGroupX NOTIFY workGroupXChanged)
diff --git a/src/render/framegraph/qframegraphnode.h b/src/render/framegraph/qframegraphnode.h
index 57f4da181..826f01a1e 100644
--- a/src/render/framegraph/qframegraphnode.h
+++ b/src/render/framegraph/qframegraphnode.h
@@ -50,7 +50,7 @@ namespace Qt3DRender {
class QFrameGraphNodePrivate;
-class QT3DRENDERSHARED_EXPORT QFrameGraphNode : public Qt3DCore::QNode
+class Q_3DRENDERSHARED_EXPORT QFrameGraphNode : public Qt3DCore::QNode
{
Q_OBJECT
public:
diff --git a/src/render/framegraph/qframegraphnodecreatedchange.h b/src/render/framegraph/qframegraphnodecreatedchange.h
index f255ff406..96ca0fb38 100644
--- a/src/render/framegraph/qframegraphnodecreatedchange.h
+++ b/src/render/framegraph/qframegraphnodecreatedchange.h
@@ -47,7 +47,7 @@ namespace Qt3DRender {
class QFrameGraphNode;
class QFrameGraphNodeCreatedChangeBasePrivate;
-class QT3DRENDERSHARED_EXPORT QFrameGraphNodeCreatedChangeBase : public Qt3DCore::QNodeCreatedChangeBase
+class Q_3DRENDERSHARED_EXPORT QFrameGraphNodeCreatedChangeBase : public Qt3DCore::QNodeCreatedChangeBase
{
public:
explicit QFrameGraphNodeCreatedChangeBase(const QFrameGraphNode *node);
diff --git a/src/render/framegraph/qfrustumculling.h b/src/render/framegraph/qfrustumculling.h
index f0ed6d032..b715a9a6f 100644
--- a/src/render/framegraph/qfrustumculling.h
+++ b/src/render/framegraph/qfrustumculling.h
@@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_EXPORT QFrustumCulling : public QFrameGraphNode
+class Q_3DRENDERSHARED_EXPORT QFrustumCulling : public QFrameGraphNode
{
Q_OBJECT
public:
diff --git a/src/render/framegraph/qlayerfilter.h b/src/render/framegraph/qlayerfilter.h
index 3ccbdac54..dd628e74e 100644
--- a/src/render/framegraph/qlayerfilter.h
+++ b/src/render/framegraph/qlayerfilter.h
@@ -50,7 +50,7 @@ namespace Qt3DRender {
class QLayer;
class QLayerFilterPrivate;
-class QT3DRENDERSHARED_EXPORT QLayerFilter : public QFrameGraphNode
+class Q_3DRENDERSHARED_EXPORT QLayerFilter : public QFrameGraphNode
{
Q_OBJECT
Q_PROPERTY(FilterMode filterMode READ filterMode WRITE setFilterMode NOTIFY filterModeChanged)
diff --git a/src/render/framegraph/qmemorybarrier.h b/src/render/framegraph/qmemorybarrier.h
index 244b7ef53..29b439700 100644
--- a/src/render/framegraph/qmemorybarrier.h
+++ b/src/render/framegraph/qmemorybarrier.h
@@ -48,7 +48,7 @@ namespace Qt3DRender {
class QMemoryBarrierPrivate;
-class QT3DRENDERSHARED_EXPORT QMemoryBarrier : public QFrameGraphNode
+class Q_3DRENDERSHARED_EXPORT QMemoryBarrier : public QFrameGraphNode
{
Q_OBJECT
public:
diff --git a/src/render/framegraph/qnodraw.h b/src/render/framegraph/qnodraw.h
index 4547aeeda..3782a88fc 100644
--- a/src/render/framegraph/qnodraw.h
+++ b/src/render/framegraph/qnodraw.h
@@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_EXPORT QNoDraw : public QFrameGraphNode
+class Q_3DRENDERSHARED_EXPORT QNoDraw : public QFrameGraphNode
{
Q_OBJECT
public:
diff --git a/src/render/framegraph/qproximityfilter.h b/src/render/framegraph/qproximityfilter.h
index b101f6c09..56bcd6eaf 100644
--- a/src/render/framegraph/qproximityfilter.h
+++ b/src/render/framegraph/qproximityfilter.h
@@ -48,7 +48,7 @@ namespace Qt3DRender {
class QProximityFilterPrivate;
-class QT3DRENDERSHARED_EXPORT QProximityFilter : public QFrameGraphNode
+class Q_3DRENDERSHARED_EXPORT QProximityFilter : public QFrameGraphNode
{
Q_OBJECT
Q_PROPERTY(Qt3DCore::QEntity *entity READ entity WRITE setEntity NOTIFY entityChanged)
diff --git a/src/render/framegraph/qrendercapture.h b/src/render/framegraph/qrendercapture.h
index 119d6a6f3..8fa5d0455 100644
--- a/src/render/framegraph/qrendercapture.h
+++ b/src/render/framegraph/qrendercapture.h
@@ -47,7 +47,7 @@ namespace Qt3DRender {
class QRenderCapturePrivate;
class QRenderCaptureReplyPrivate;
-class QT3DRENDERSHARED_EXPORT QRenderCaptureReply : public QObject
+class Q_3DRENDERSHARED_EXPORT QRenderCaptureReply : public QObject
{
Q_OBJECT
Q_PROPERTY(QImage image READ image CONSTANT)
@@ -78,7 +78,7 @@ private:
friend class QRenderCapturePrivate;
};
-class QT3DRENDERSHARED_EXPORT QRenderCapture : public QFrameGraphNode
+class Q_3DRENDERSHARED_EXPORT QRenderCapture : public QFrameGraphNode
{
Q_OBJECT
public:
diff --git a/src/render/framegraph/qrenderpassfilter.h b/src/render/framegraph/qrenderpassfilter.h
index ffb305e14..9fb11757f 100644
--- a/src/render/framegraph/qrenderpassfilter.h
+++ b/src/render/framegraph/qrenderpassfilter.h
@@ -53,7 +53,7 @@ class QRenderPassFilterPrivate;
class QFilterKey;
class QParameter;
-class QT3DRENDERSHARED_EXPORT QRenderPassFilter : public QFrameGraphNode
+class Q_3DRENDERSHARED_EXPORT QRenderPassFilter : public QFrameGraphNode
{
Q_OBJECT
diff --git a/src/render/framegraph/qrenderstateset.h b/src/render/framegraph/qrenderstateset.h
index 3df86940b..b08da1ff5 100644
--- a/src/render/framegraph/qrenderstateset.h
+++ b/src/render/framegraph/qrenderstateset.h
@@ -49,7 +49,7 @@ namespace Qt3DRender {
class QRenderStateSetPrivate;
class QRenderState;
-class QT3DRENDERSHARED_EXPORT QRenderStateSet : public QFrameGraphNode
+class Q_3DRENDERSHARED_EXPORT QRenderStateSet : public QFrameGraphNode
{
Q_OBJECT
diff --git a/src/render/framegraph/qrendersurfaceselector.h b/src/render/framegraph/qrendersurfaceselector.h
index 5d0273187..73d513311 100644
--- a/src/render/framegraph/qrendersurfaceselector.h
+++ b/src/render/framegraph/qrendersurfaceselector.h
@@ -53,7 +53,7 @@ namespace Qt3DRender {
class QRenderSurfaceSelectorPrivate;
-class QT3DRENDERSHARED_EXPORT QRenderSurfaceSelector : public Qt3DRender::QFrameGraphNode
+class Q_3DRENDERSHARED_EXPORT QRenderSurfaceSelector : public Qt3DRender::QFrameGraphNode
{
Q_OBJECT
Q_PROPERTY(QObject *surface READ surface WRITE setSurface NOTIFY surfaceChanged)
diff --git a/src/render/framegraph/qrendersurfaceselector_p.h b/src/render/framegraph/qrendersurfaceselector_p.h
index 899387b98..70fdc5881 100644
--- a/src/render/framegraph/qrendersurfaceselector_p.h
+++ b/src/render/framegraph/qrendersurfaceselector_p.h
@@ -64,7 +64,7 @@ namespace Qt3DRender {
class QRenderSurfaceSelector;
-class QT3DRENDERSHARED_PRIVATE_EXPORT QRenderSurfaceSelectorPrivate : public Qt3DRender::QFrameGraphNodePrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QRenderSurfaceSelectorPrivate : public Qt3DRender::QFrameGraphNodePrivate
{
public:
QRenderSurfaceSelectorPrivate();
diff --git a/src/render/framegraph/qrendertargetselector.h b/src/render/framegraph/qrendertargetselector.h
index 5e8cd0761..c6b7b641d 100644
--- a/src/render/framegraph/qrendertargetselector.h
+++ b/src/render/framegraph/qrendertargetselector.h
@@ -52,7 +52,7 @@ namespace Qt3DRender {
class QRenderTargetSelectorPrivate;
class QRenderTarget;
-class QT3DRENDERSHARED_EXPORT QRenderTargetSelector : public QFrameGraphNode
+class Q_3DRENDERSHARED_EXPORT QRenderTargetSelector : public QFrameGraphNode
{
Q_OBJECT
Q_PROPERTY(Qt3DRender::QRenderTarget *target READ target WRITE setTarget NOTIFY targetChanged)
diff --git a/src/render/framegraph/qsetfence.cpp b/src/render/framegraph/qsetfence.cpp
new file mode 100644
index 000000000..5cb82f3db
--- /dev/null
+++ b/src/render/framegraph/qsetfence.cpp
@@ -0,0 +1,174 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** 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 "qsetfence.h"
+#include "qsetfence_p.h"
+#include <Qt3DRender/private/qframegraphnodecreatedchange_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+QSetFencePrivate::QSetFencePrivate()
+ : QFrameGraphNodePrivate()
+ , m_handleType(QSetFence::NoHandle)
+ , m_handle(QVariant())
+{
+}
+
+/*!
+ \class QSetFence
+ \brief FrameGraphNode used to insert a fence in the graphics command stream.
+
+ Fence allow to synchronosize GPU and CPU workloads. GPU commands usually
+ are non-blocking. When issued, commands are inserted in command buffers
+ which will be read at a later time by the GPU. In some cases, you want to
+ continue processing or issue specific command only when you are sure a
+ command has been executed by the hardware. Fences are a way to do so. This
+ is especially important when using 3rd party engines with Qt3D, Qt3D should
+ only access shared resources when we know the other engine command are done
+ modifying the resource.
+
+ QSetFence is a FrameGraph node that inserts a fence into the command
+ stream. It can then be used in conjunction with \l QWaitFence or by
+ extracting the underlying handle.
+
+ The handle property will be updated once the renderer has created the
+ underlying fence resource. The handle will remain valid as long as it
+ remains in the unsignaled state. Once it has reached the signaled state, it
+ will be destroyed and a new handle will be created. That means that
+ depending on how long it takes for the fence to be signaled, the same
+ handle could be used over several frames.
+
+ \since 5.13
+ */
+QSetFence::QSetFence(Qt3DCore::QNode *parent)
+ : QFrameGraphNode(*new QSetFencePrivate(), parent)
+{
+}
+
+QSetFence::~QSetFence()
+{
+}
+
+QSetFence::QSetFence(QSetFencePrivate &dd, Qt3DCore::QNode *parent)
+ : QFrameGraphNode(dd, parent)
+{
+}
+
+/*!
+ \qmlproperty HandleType SetFence::handleType
+
+ Specifies the type of handle being used. Currently only OpenGL Fence ids
+ are supported.
+*/
+/*!
+ \property QSetFence::handleType
+
+ Specifies the type of handle being used. Currently only OpenGL Fence ids
+ are supported.
+*/
+QSetFence::HandleType QSetFence::handleType() const
+{
+ Q_D(const QSetFence);
+ return d->m_handleType;
+}
+
+void QSetFencePrivate::setHandleType(QSetFence::HandleType type)
+{
+ Q_Q(QSetFence);
+ if (m_handleType != type) {
+ const bool blocked = q->blockNotifications(true);
+ m_handleType = type;
+ emit q->handleTypeChanged(type);
+ q->blockNotifications(blocked);
+ }
+}
+
+/*!
+ \qmlproperty variant AbstractFence::handle
+
+ Holds the underlying fence handle wrapped in a variant.
+*/
+/*!
+ \property QAbstractFence::handle
+
+ Holds the underlying fence handle wrapped in a QVariant.
+*/
+QVariant QSetFence::handle() const
+{
+ Q_D(const QSetFence);
+ return d->m_handle;
+}
+
+void QSetFencePrivate::setHandle(QVariant handle)
+{
+ Q_Q(QSetFence);
+ if (m_handle != handle) {
+ const bool blocked = q->blockNotifications(true);
+ m_handle = handle;
+ emit q->handleChanged(handle);
+ q->blockNotifications(blocked);
+ }
+}
+
+void QSetFence::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
+{
+ Qt3DCore::QPropertyUpdatedChangePtr e = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(change);
+ if (e->type() == Qt3DCore::PropertyUpdated) {
+ Q_D(QSetFence);
+ if (e->propertyName() == QByteArrayLiteral("handle"))
+ d->setHandle(e->value());
+ else if (e->propertyName() == QByteArrayLiteral("handleType"))
+ d->setHandleType(static_cast<Qt3DRender::QSetFence::HandleType>(e->value().toInt()));
+ }
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QSetFence::createNodeCreationChange() const
+{
+ auto creationChange = QFrameGraphNodeCreatedChangePtr<QSetFenceData>::create(this);
+ QSetFenceData &data = creationChange->data;
+ Q_UNUSED(data); // Might be of use later
+ return creationChange;
+}
+
+} // Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/qsetfence.h b/src/render/framegraph/qsetfence.h
new file mode 100644
index 000000000..4ad92ae52
--- /dev/null
+++ b/src/render/framegraph/qsetfence.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** 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/QFrameGraphNode>
+
+#ifndef QT3DRENDER_QSETFENCE_H
+#define QT3DRENDER_QSETFENCE_H
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QSetFencePrivate;
+
+class Q_3DRENDERSHARED_EXPORT QSetFence : public QFrameGraphNode
+{
+ Q_OBJECT
+ Q_PROPERTY(HandleType handleType READ handleType NOTIFY handleTypeChanged)
+ Q_PROPERTY(QVariant handle READ handle NOTIFY handleChanged)
+public:
+ enum HandleType {
+ NoHandle,
+ OpenGLFenceId
+ };
+ Q_ENUM(HandleType) // LCOV_EXCL_LINE
+
+ explicit QSetFence(Qt3DCore::QNode *parent = nullptr);
+ ~QSetFence();
+
+ HandleType handleType() const;
+ QVariant handle() const;
+
+Q_SIGNALS:
+ void handleTypeChanged(HandleType handleType);
+ void handleChanged(QVariant handle);
+
+protected:
+ explicit QSetFence(QSetFencePrivate &dd, Qt3DCore::QNode *parent = nullptr);
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override;
+
+private:
+ Q_DECLARE_PRIVATE(QSetFence)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override;
+};
+
+} // Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QSETFENCE_H
diff --git a/src/render/framegraph/qsetfence_p.h b/src/render/framegraph/qsetfence_p.h
new file mode 100644
index 000000000..026afffa5
--- /dev/null
+++ b/src/render/framegraph/qsetfence_p.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** 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_QSETFENCE_P_H
+#define QT3DRENDER_QSETFENCE_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/qsetfence.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QSetFencePrivate : public QFrameGraphNodePrivate
+{
+public:
+ QSetFencePrivate();
+ void setHandleType(QSetFence::HandleType type);
+ void setHandle(QVariant handle);
+
+ QSetFence::HandleType m_handleType;
+ QVariant m_handle;
+
+ Q_DECLARE_PUBLIC(QSetFence)
+};
+
+struct QSetFenceData
+{
+};
+
+} // Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QSETFENCE_P_H
diff --git a/src/render/framegraph/qsortpolicy.h b/src/render/framegraph/qsortpolicy.h
index d94ee3d69..67dfe6ac2 100644
--- a/src/render/framegraph/qsortpolicy.h
+++ b/src/render/framegraph/qsortpolicy.h
@@ -48,7 +48,7 @@ namespace Qt3DRender {
class QSortPolicyPrivate;
-class QT3DRENDERSHARED_EXPORT QSortPolicy : public QFrameGraphNode
+class Q_3DRENDERSHARED_EXPORT QSortPolicy : public QFrameGraphNode
{
Q_OBJECT
Q_PROPERTY(QVector<int> sortTypes READ sortTypesInt WRITE setSortTypes NOTIFY sortTypesChanged)
diff --git a/src/render/framegraph/qtechniquefilter.h b/src/render/framegraph/qtechniquefilter.h
index 243b2d6ec..9fe872915 100644
--- a/src/render/framegraph/qtechniquefilter.h
+++ b/src/render/framegraph/qtechniquefilter.h
@@ -51,7 +51,7 @@ class QTechniqueFilterPrivate;
class QFilterKey;
class QParameter;
-class QT3DRENDERSHARED_EXPORT QTechniqueFilter : public QFrameGraphNode
+class Q_3DRENDERSHARED_EXPORT QTechniqueFilter : public QFrameGraphNode
{
Q_OBJECT
public:
diff --git a/src/render/framegraph/qtechniquefilter_p.h b/src/render/framegraph/qtechniquefilter_p.h
index d25f10a79..10df8f5bf 100644
--- a/src/render/framegraph/qtechniquefilter_p.h
+++ b/src/render/framegraph/qtechniquefilter_p.h
@@ -60,7 +60,7 @@ namespace Qt3DRender {
class QTechniqueFilter;
-class QT3DRENDERSHARED_PRIVATE_EXPORT QTechniqueFilterPrivate : public QFrameGraphNodePrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QTechniqueFilterPrivate : public QFrameGraphNodePrivate
{
public :
QTechniqueFilterPrivate();
diff --git a/src/render/framegraph/qviewport.h b/src/render/framegraph/qviewport.h
index 1f6ac8310..01830be6a 100644
--- a/src/render/framegraph/qviewport.h
+++ b/src/render/framegraph/qviewport.h
@@ -50,7 +50,7 @@ namespace Qt3DRender {
class QViewportPrivate;
-class QT3DRENDERSHARED_EXPORT QViewport : public QFrameGraphNode
+class Q_3DRENDERSHARED_EXPORT QViewport : public QFrameGraphNode
{
Q_OBJECT
Q_PROPERTY(QRectF normalizedRect READ normalizedRect WRITE setNormalizedRect NOTIFY normalizedRectChanged)
diff --git a/src/render/framegraph/qwaitfence.cpp b/src/render/framegraph/qwaitfence.cpp
new file mode 100644
index 000000000..5195653ce
--- /dev/null
+++ b/src/render/framegraph/qwaitfence.cpp
@@ -0,0 +1,219 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** 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 "qwaitfence.h"
+#include "qwaitfence_p.h"
+#include <Qt3DRender/private/qframegraphnode_p.h>
+#include <Qt3DRender/private/qframegraphnodecreatedchange_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+QWaitFencePrivate::QWaitFencePrivate()
+ : QFrameGraphNodePrivate()
+ , m_handleType(QWaitFence::NoHandle)
+ , m_handle(QVariant())
+ , m_waitOnCPU(false)
+ , m_timeout(std::numeric_limits<quint64>::max())
+{
+}
+
+/*!
+ \class QWaitFence
+
+ \brief FrameGraphNode used to wait for a fence in the graphics command
+ stream to become signaled.
+
+ Fence allow to synchronosize GPU and CPU workloads. GPU commands usually
+ are non-blocking. When issued, commands are inserted in command buffers
+ which will be read at a later time by the GPU. In some cases, you want to
+ continue processing or issue specific command only when you are sure a
+ command has been executed by the hardware. Fences are a way to do so. This
+ is especially important when using 3rd party engines with Qt3D, Qt3D should
+ only access shared resources when we know the other engine command are done
+ modifying the resource.
+
+ QWaitFence is a FrameGraph node that will force to wait for it to become
+ signaled before subsequent commands are inserted into the command stream.
+ It can then be used in conjunction with \l QSetFence and contains
+ properties to configure how long it should wait and whether it should block
+ on the CPU side.
+
+ \note Qt 3D uploads GPU resources (Texture, Shaders, Buffers) before
+ issuing draw calls.
+
+ \since 5.13
+ */
+
+QWaitFence::QWaitFence(Qt3DCore::QNode *parent)
+ : QFrameGraphNode(*new QWaitFencePrivate(), parent)
+{
+}
+
+QWaitFence::~QWaitFence()
+{
+}
+
+/*!
+ \qmlproperty bool WaitFence::waitOnCPU
+
+ Specifies whether the CPU should be block while waiting for the fence to
+ become signaled. This is false by default.
+*/
+/*!
+ \property QWaitFence::waitOnCPU
+
+ Specifies whether the CPU should be block while waiting for the fence to
+ become signaled. This is false by default.
+*/
+bool QWaitFence::waitOnCPU() const
+{
+ Q_D(const QWaitFence);
+ return d->m_waitOnCPU;
+}
+
+void QWaitFence::setWaitOnCPU(bool waitOnCPU)
+{
+ Q_D(QWaitFence);
+ if (d->m_waitOnCPU == waitOnCPU)
+ return;
+ d->m_waitOnCPU = waitOnCPU;
+ emit waitOnCPUChanged(waitOnCPU);
+}
+
+/*!
+ \qmlproperty int WaitFence::timeout
+
+ Specifies the maximum amount of time in nanoseconds to wait for the fence
+ to become signaled.
+*/
+/*!
+ \property QWaitFence::timeout
+
+ Specifies the maximum amount of time in nanoseconds to wait for the fence
+ to become signaled.
+*/
+quint64 QWaitFence::timeout() const
+{
+ Q_D(const QWaitFence);
+ return d->m_timeout;
+}
+
+void QWaitFence::setTimeout(quint64 timeout)
+{
+ Q_D(QWaitFence);
+ if (d->m_timeout == timeout)
+ return;
+ d->m_timeout = timeout;
+ emit timeoutChanged(timeout);
+}
+
+QWaitFence::QWaitFence(QWaitFencePrivate &dd, Qt3DCore::QNode *parent)
+ : QFrameGraphNode(dd, parent)
+{
+}
+
+/*!
+ \qmlproperty HandleType WaitFence::handleType
+
+ Specifies the type of handle being used. Currently only OpenGL Fence ids
+ are supported.
+*/
+/*!
+ \property QWaitFence::handleType
+
+ Specifies the type of handle being used. Currently only OpenGL Fence ids
+ are supported.
+*/
+QWaitFence::HandleType QWaitFence::handleType() const
+{
+ Q_D(const QWaitFence);
+ return d->m_handleType;
+}
+
+void QWaitFence::setHandleType(QWaitFence::HandleType type)
+{
+ Q_D(QWaitFence);
+ if (d->m_handleType != type) {
+ d->m_handleType = type;
+ emit handleTypeChanged(type);
+ }
+}
+
+/*!
+ \qmlproperty variant WaitFence::handle
+
+ Holds the underlying fence handle wrapped in a variant.
+*/
+/*!
+ \property QWaitFence::handle
+
+ Holds the underlying fence handle wrapped in a QVariant.
+*/
+QVariant QWaitFence::handle() const
+{
+ Q_D(const QWaitFence);
+ return d->m_handle;
+}
+
+void QWaitFence::setHandle(QVariant handle)
+{
+ Q_D(QWaitFence);
+ if (d->m_handle != handle) {
+ d->m_handle = handle;
+ emit handleChanged(handle);
+ }
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QWaitFence::createNodeCreationChange() const
+{
+ auto creationChange = QFrameGraphNodeCreatedChangePtr<QWaitFenceData>::create(this);
+ QWaitFenceData &data = creationChange->data;
+ Q_D(const QWaitFence);
+ data.handleType = d->m_handleType;
+ data.handle = d->m_handle;
+ data.timeout = d->m_timeout;
+ data.waitOnCPU = d->m_waitOnCPU;
+ return creationChange;
+}
+
+} // Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/qwaitfence.h b/src/render/framegraph/qwaitfence.h
new file mode 100644
index 000000000..8148fde7d
--- /dev/null
+++ b/src/render/framegraph/qwaitfence.h
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** 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_QWAITFENCE_H
+#define QT3DRENDER_QWAITFENCE_H
+
+#include <Qt3DRender/QFrameGraphNode>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QWaitFencePrivate;
+
+class Q_3DRENDERSHARED_EXPORT QWaitFence : public QFrameGraphNode
+{
+ Q_OBJECT
+ Q_PROPERTY(HandleType handleType READ handleType WRITE setHandleType NOTIFY handleTypeChanged)
+ Q_PROPERTY(QVariant handle READ handle WRITE setHandle NOTIFY handleChanged)
+ Q_PROPERTY(bool waitOnCPU READ waitOnCPU WRITE setWaitOnCPU NOTIFY waitOnCPUChanged)
+ Q_PROPERTY(quint64 timeout READ timeout WRITE setTimeout NOTIFY timeoutChanged)
+
+public:
+ enum HandleType {
+ NoHandle,
+ OpenGLFenceId
+ };
+ Q_ENUM(HandleType) // LCOV_EXCL_LINE
+ explicit QWaitFence(Qt3DCore::QNode *parent = nullptr);
+ ~QWaitFence();
+
+ void setHandleType(HandleType type);
+ void setHandle(QVariant handle);
+
+ HandleType handleType() const;
+ QVariant handle() const;
+
+ bool waitOnCPU() const;
+ void setWaitOnCPU(bool waitOnCPU);
+
+ quint64 timeout() const;
+ void setTimeout(quint64 timeout);
+
+Q_SIGNALS:
+ void waitOnCPUChanged(bool waitOnCPU);
+ void timeoutChanged(quint64 timeoutChanged);
+ void handleTypeChanged(HandleType handleType);
+ void handleChanged(QVariant handle);
+
+protected:
+ explicit QWaitFence(QWaitFencePrivate &dd, Qt3DCore::QNode *parent = nullptr);
+
+private:
+ Q_DECLARE_PRIVATE(QWaitFence)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override;
+};
+
+} // Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QWAITFENCE_H
diff --git a/src/render/framegraph/qwaitfence_p.h b/src/render/framegraph/qwaitfence_p.h
new file mode 100644
index 000000000..480d69cad
--- /dev/null
+++ b/src/render/framegraph/qwaitfence_p.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** 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_QWAITFENCE_P_H
+#define QT3DRENDER_QWAITFENCE_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/qwaitfence.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QWaitFencePrivate : public QFrameGraphNodePrivate
+{
+public:
+ QWaitFencePrivate();
+
+ QWaitFence::HandleType m_handleType;
+ QVariant m_handle;
+ bool m_waitOnCPU;
+ quint64 m_timeout;
+};
+
+struct QWaitFenceData
+{
+ QWaitFence::HandleType handleType;
+ QVariant handle;
+ bool waitOnCPU;
+ quint64 timeout;
+};
+
+} // Qt3DRender
+
+QT_END_NAMESPACE
+
+
+#endif // QT3DRENDER_QWAITFENCE_P_H
diff --git a/src/render/framegraph/rendercapture.cpp b/src/render/framegraph/rendercapture.cpp
index d25a01b1f..166294889 100644
--- a/src/render/framegraph/rendercapture.cpp
+++ b/src/render/framegraph/rendercapture.cpp
@@ -76,6 +76,7 @@ void RenderCapture::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
Qt3DCore::QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
if (propertyChange->propertyName() == QByteArrayLiteral("renderCaptureRequest")) {
requestCapture(propertyChange->value().value<QRenderCaptureRequest>());
+ markDirty(AbstractRenderer::FrameGraphDirty);
}
}
FrameGraphNode::sceneChangeEvent(e);
diff --git a/src/render/framegraph/renderpassfilternode.cpp b/src/render/framegraph/renderpassfilternode.cpp
index c9277b951..e3da1e36d 100644
--- a/src/render/framegraph/renderpassfilternode.cpp
+++ b/src/render/framegraph/renderpassfilternode.cpp
@@ -97,10 +97,10 @@ void RenderPassFilter::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
const auto change = qSharedPointerCast<QPropertyNodeAddedChange>(e);
if (change->propertyName() == QByteArrayLiteral("match")) {
appendFilter(change->addedNodeId());
- markDirty(AbstractRenderer::AllDirty);
+ markDirty(AbstractRenderer::FrameGraphDirty);
} else if (change->propertyName() == QByteArrayLiteral("parameter")) {
m_parameterPack.appendParameter(change->addedNodeId());
- markDirty(AbstractRenderer::AllDirty);
+ markDirty(AbstractRenderer::FrameGraphDirty);
}
break;
}
@@ -109,10 +109,10 @@ void RenderPassFilter::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
const auto change = qSharedPointerCast<QPropertyNodeRemovedChange>(e);
if (change->propertyName() == QByteArrayLiteral("match")) {
removeFilter(change->removedNodeId());
- markDirty(AbstractRenderer::AllDirty);
+ markDirty(AbstractRenderer::FrameGraphDirty);
} else if (change->propertyName() == QByteArrayLiteral("parameter")) {
m_parameterPack.removeParameter(change->removedNodeId());
- markDirty(AbstractRenderer::AllDirty);
+ markDirty(AbstractRenderer::FrameGraphDirty);
}
break;
}
diff --git a/src/render/framegraph/rendersurfaceselector.cpp b/src/render/framegraph/rendersurfaceselector.cpp
index 7f2fd6170..16a1199b5 100644
--- a/src/render/framegraph/rendersurfaceselector.cpp
+++ b/src/render/framegraph/rendersurfaceselector.cpp
@@ -101,17 +101,22 @@ 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"))
+ if (propertyChange->propertyName() == QByteArrayLiteral("surface")) {
m_surface = surfaceFromQObject(propertyChange->value().value<QObject *>());
- else if (propertyChange->propertyName() == QByteArrayLiteral("externalRenderTargetSize"))
+ markDirty(AbstractRenderer::FrameGraphDirty);
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("externalRenderTargetSize")) {
setRenderTargetSize(propertyChange->value().toSize());
- else if (propertyChange->propertyName() == QByteArrayLiteral("width"))
+ markDirty(AbstractRenderer::FrameGraphDirty);
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("width")) {
m_width = propertyChange->value().toInt();
- else if (propertyChange->propertyName() == QByteArrayLiteral("height"))
+ markDirty(AbstractRenderer::FrameGraphDirty);
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("height")) {
m_height = propertyChange->value().toInt();
- else if (propertyChange->propertyName() == QByteArrayLiteral("surfacePixelRatio"))
+ markDirty(AbstractRenderer::FrameGraphDirty);
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("surfacePixelRatio")) {
m_devicePixelRatio = propertyChange->value().toFloat();
- markDirty(AbstractRenderer::AllDirty);
+ markDirty(AbstractRenderer::FrameGraphDirty);
+ }
}
FrameGraphNode::sceneChangeEvent(e);
}
diff --git a/src/render/framegraph/rendertargetselectornode.cpp b/src/render/framegraph/rendertargetselectornode.cpp
index 4b6e2da84..615608bd2 100644
--- a/src/render/framegraph/rendertargetselectornode.cpp
+++ b/src/render/framegraph/rendertargetselectornode.cpp
@@ -73,11 +73,13 @@ void RenderTargetSelector::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
qCDebug(Render::Framegraph) << Q_FUNC_INFO;
if (e->type() == PropertyUpdated) {
QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e);
- if (propertyChange->propertyName() == QByteArrayLiteral("target"))
+ if (propertyChange->propertyName() == QByteArrayLiteral("target")) {
m_renderTargetUuid = propertyChange->value().value<QNodeId>();
- else if (propertyChange->propertyName() == QByteArrayLiteral("outputs"))
+ markDirty(AbstractRenderer::FrameGraphDirty);
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("outputs")) {
m_outputs = propertyChange->value().value<QVector<Qt3DRender::QRenderTargetOutput::AttachmentPoint> >();
- markDirty(AbstractRenderer::AllDirty);
+ markDirty(AbstractRenderer::FrameGraphDirty);
+ }
}
FrameGraphNode::sceneChangeEvent(e);
}
diff --git a/src/render/framegraph/setfence.cpp b/src/render/framegraph/setfence.cpp
new file mode 100644
index 000000000..b2e995b25
--- /dev/null
+++ b/src/render/framegraph/setfence.cpp
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** 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 "setfence_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+SetFence::SetFence()
+ : FrameGraphNode(FrameGraphNode::SetFence, QBackendNode::ReadWrite)
+{
+}
+
+SetFence::~SetFence()
+{
+}
+
+void SetFence::setHandle(const QVariant &handle)
+{
+ auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
+ change->setDeliveryFlags(Qt3DCore::QSceneChange::Nodes);
+ change->setPropertyName("handle");
+ change->setValue(handle);
+ notifyObservers(change);
+}
+
+void SetFence::setHandleType(QSetFence::HandleType type)
+{
+ auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
+ change->setDeliveryFlags(Qt3DCore::QSceneChange::Nodes);
+ change->setPropertyName("handleType");
+ change->setValue(QVariant::fromValue(type));
+ notifyObservers(change);
+}
+
+} // namespace Render
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/setfence_p.h b/src/render/framegraph/setfence_p.h
new file mode 100644
index 000000000..31072581c
--- /dev/null
+++ b/src/render/framegraph/setfence_p.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** 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_SETFENCE_P_H
+#define QT3DRENDER_RENDER_SETFENCE_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/qsetfence.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+class Q_AUTOTEST_EXPORT SetFence : public FrameGraphNode
+{
+public:
+ SetFence();
+ ~SetFence();
+
+ // Called by a job
+ void setHandle(const QVariant &handle);
+ void setHandleType(QSetFence::HandleType type);
+};
+
+} // namespace Render
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_SETFENCE_P_H
diff --git a/src/render/framegraph/sortpolicy.cpp b/src/render/framegraph/sortpolicy.cpp
index 9631ebeab..b81d1f6cb 100644
--- a/src/render/framegraph/sortpolicy.cpp
+++ b/src/render/framegraph/sortpolicy.cpp
@@ -61,9 +61,9 @@ void SortPolicy::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
auto sortTypesInt = propertyChange->value().value<QVector<int>>();
m_sortTypes.clear();
transformVector(sortTypesInt, m_sortTypes);
+ markDirty(AbstractRenderer::FrameGraphDirty);
}
}
- markDirty(AbstractRenderer::AllDirty);
FrameGraphNode::sceneChangeEvent(e);
}
diff --git a/src/render/framegraph/statesetnode.cpp b/src/render/framegraph/statesetnode.cpp
index 2ffbb70c7..96551684e 100644
--- a/src/render/framegraph/statesetnode.cpp
+++ b/src/render/framegraph/statesetnode.cpp
@@ -84,7 +84,7 @@ void StateSetNode::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
const auto change = qSharedPointerCast<QPropertyNodeAddedChange>(e);
if (change->propertyName() == QByteArrayLiteral("renderState")) {
addRenderState(change->addedNodeId());
- markDirty(AbstractRenderer::AllDirty);
+ markDirty(AbstractRenderer::FrameGraphDirty);
}
break;
}
@@ -93,7 +93,7 @@ void StateSetNode::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
const auto propertyChange = qSharedPointerCast<QPropertyNodeRemovedChange>(e);
if (propertyChange->propertyName() == QByteArrayLiteral("renderState")) {
removeRenderState(propertyChange->removedNodeId());
- markDirty(AbstractRenderer::AllDirty);
+ markDirty(AbstractRenderer::FrameGraphDirty);
}
break;
}
diff --git a/src/render/framegraph/techniquefilternode.cpp b/src/render/framegraph/techniquefilternode.cpp
index 59f49af02..8816984ee 100644
--- a/src/render/framegraph/techniquefilternode.cpp
+++ b/src/render/framegraph/techniquefilternode.cpp
@@ -96,10 +96,10 @@ void TechniqueFilter::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
const auto change = qSharedPointerCast<QPropertyNodeAddedChange>(e);
if (change->propertyName() == QByteArrayLiteral("matchAll")) {
appendFilter(change->addedNodeId());
- markDirty(AbstractRenderer::AllDirty);
+ markDirty(AbstractRenderer::FrameGraphDirty);
} else if (change->propertyName() == QByteArrayLiteral("parameter")) {
m_parameterPack.appendParameter(change->addedNodeId());
- markDirty(AbstractRenderer::AllDirty);
+ markDirty(AbstractRenderer::FrameGraphDirty);
}
break;
}
@@ -108,10 +108,10 @@ void TechniqueFilter::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
const auto change = qSharedPointerCast<QPropertyNodeRemovedChange>(e);
if (change->propertyName() == QByteArrayLiteral("matchAll")) {
removeFilter(change->removedNodeId());
- markDirty(AbstractRenderer::AllDirty);
+ markDirty(AbstractRenderer::FrameGraphDirty);
} else if (change->propertyName() == QByteArrayLiteral("parameter")) {
m_parameterPack.removeParameter(change->removedNodeId());
- markDirty(AbstractRenderer::AllDirty);
+ markDirty(AbstractRenderer::FrameGraphDirty);
}
break;
}
diff --git a/src/render/framegraph/viewportnode.cpp b/src/render/framegraph/viewportnode.cpp
index bed87a13f..b3b53b0f9 100644
--- a/src/render/framegraph/viewportnode.cpp
+++ b/src/render/framegraph/viewportnode.cpp
@@ -128,10 +128,11 @@ void ViewportNode::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
setYMin(normalizedRect.y());
setXMax(normalizedRect.width());
setYMax(normalizedRect.height());
+ markDirty(AbstractRenderer::FrameGraphDirty);
} else if (propertyChange->propertyName() == QByteArrayLiteral("gamma")) {
setGamma(propertyChange->value().toFloat());
+ markDirty(AbstractRenderer::FrameGraphDirty);
}
- markDirty(AbstractRenderer::AllDirty);
}
FrameGraphNode::sceneChangeEvent(e);
}
diff --git a/src/render/framegraph/waitfence.cpp b/src/render/framegraph/waitfence.cpp
new file mode 100644
index 000000000..9480fb7a0
--- /dev/null
+++ b/src/render/framegraph/waitfence.cpp
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** 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 "waitfence_p.h"
+#include <Qt3DRender/private/qwaitfence_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.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 {
+
+namespace Render {
+
+WaitFence::WaitFence()
+ : FrameGraphNode(FrameGraphNode::WaitFence)
+{
+ m_data.handleType = QWaitFence::NoHandle;
+ m_data.waitOnCPU = false;
+ m_data.timeout = std::numeric_limits<quint64>::max();
+}
+
+WaitFence::~WaitFence()
+{
+}
+
+void WaitFence::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
+{
+ if (e->type() == Qt3DCore::PropertyUpdated) {
+ Qt3DCore::QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
+ if (propertyChange->propertyName() == QByteArrayLiteral("handle")) {
+ m_data.handle = propertyChange->value();
+ markDirty(AbstractRenderer::FrameGraphDirty);
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("handleType")) {
+ m_data.handleType = static_cast<QWaitFence::HandleType>(propertyChange->value().toInt());
+ markDirty(AbstractRenderer::FrameGraphDirty);
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("timeout")) {
+ m_data.timeout = propertyChange->value().value<quint64>();
+ markDirty(AbstractRenderer::FrameGraphDirty);
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("waitOnCPU")) {
+ m_data.waitOnCPU = propertyChange->value().toBool();
+ markDirty(AbstractRenderer::FrameGraphDirty);
+ }
+ }
+ FrameGraphNode::sceneChangeEvent(e);
+}
+
+void WaitFence::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
+{
+ FrameGraphNode::initializeFromPeer(change);
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QWaitFenceData>>(change);
+ const QWaitFenceData &data = typedChange->data;
+ m_data = data;
+}
+
+} // namespace Render
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/waitfence_p.h b/src/render/framegraph/waitfence_p.h
new file mode 100644
index 000000000..dd48e0efa
--- /dev/null
+++ b/src/render/framegraph/waitfence_p.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** 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_WAITFENCE_P_H
+#define QT3DRENDER_RENDER_WAITFENCE_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/qwaitfence.h>
+#include <Qt3DRender/private/framegraphnode_p.h>
+#include <Qt3DRender/private/qwaitfence_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+class Q_AUTOTEST_EXPORT WaitFence : public FrameGraphNode
+{
+public:
+ WaitFence();
+ ~WaitFence();
+
+ inline QWaitFenceData data() const { return m_data; }
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) override;
+
+private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) override;
+
+ QWaitFenceData m_data;
+};
+
+} // namespace Render
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_WAITFENCE_P_H
diff --git a/src/render/frontend/qabstractfunctor.cpp b/src/render/frontend/qabstractfunctor.cpp
index 4be1da595..698c3a291 100644
--- a/src/render/frontend/qabstractfunctor.cpp
+++ b/src/render/frontend/qabstractfunctor.cpp
@@ -58,8 +58,15 @@ namespace Qt3DRender {
*/
/*!
\fn qintptr Qt3DRender::QAbstractFunctor::id() const
+
+ Returns a pointer to the id of the functor.
*/
/*!
+ \fn qintptr Qt3DRender::functorTypeId()
+
+ Returns a pointer to the type id of the functor.
+*/
+/*!
\macro QT3D_FUNCTOR(Class)
\relates Qt3DRender::QAbstractFunctor
diff --git a/src/render/frontend/qabstractfunctor.h b/src/render/frontend/qabstractfunctor.h
index e28535041..45492e141 100644
--- a/src/render/frontend/qabstractfunctor.h
+++ b/src/render/frontend/qabstractfunctor.h
@@ -73,7 +73,7 @@ qintptr functorTypeId()
}
-class QT3DRENDERSHARED_EXPORT QAbstractFunctor
+class Q_3DRENDERSHARED_EXPORT QAbstractFunctor
{
public:
QAbstractFunctor() = default;
diff --git a/src/render/frontend/qcamera.h b/src/render/frontend/qcamera.h
index e31615741..7d717972e 100644
--- a/src/render/frontend/qcamera.h
+++ b/src/render/frontend/qcamera.h
@@ -58,7 +58,7 @@ namespace Qt3DRender {
class QCameraPrivate;
-class QT3DRENDERSHARED_EXPORT QCamera : public Qt3DCore::QEntity
+class Q_3DRENDERSHARED_EXPORT QCamera : public Qt3DCore::QEntity
{
Q_OBJECT
// CameraLens
diff --git a/src/render/frontend/qcamera_p.h b/src/render/frontend/qcamera_p.h
index 1e8464d05..00d0bfd80 100644
--- a/src/render/frontend/qcamera_p.h
+++ b/src/render/frontend/qcamera_p.h
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_PRIVATE_EXPORT QCameraPrivate : public Qt3DCore::QEntityPrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QCameraPrivate : public Qt3DCore::QEntityPrivate
{
public:
QCameraPrivate();
diff --git a/src/render/frontend/qcameralens.h b/src/render/frontend/qcameralens.h
index d478561ee..da7b426e1 100644
--- a/src/render/frontend/qcameralens.h
+++ b/src/render/frontend/qcameralens.h
@@ -53,7 +53,7 @@ namespace Qt3DRender {
class QCameraLensPrivate;
-class QT3DRENDERSHARED_EXPORT QCameraLens : public Qt3DCore::QComponent
+class Q_3DRENDERSHARED_EXPORT QCameraLens : public Qt3DCore::QComponent
{
Q_OBJECT
Q_PROPERTY(ProjectionType projectionType READ projectionType WRITE setProjectionType NOTIFY projectionTypeChanged)
diff --git a/src/render/frontend/qcameralens_p.h b/src/render/frontend/qcameralens_p.h
index 0ec197945..111ab6522 100644
--- a/src/render/frontend/qcameralens_p.h
+++ b/src/render/frontend/qcameralens_p.h
@@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_PRIVATE_EXPORT QCameraLensPrivate : public Qt3DCore::QComponentPrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QCameraLensPrivate : public Qt3DCore::QComponentPrivate
{
public:
QCameraLensPrivate();
diff --git a/src/render/frontend/qcomputecommand.cpp b/src/render/frontend/qcomputecommand.cpp
index 5cb72a6ce..8b176cd4f 100644
--- a/src/render/frontend/qcomputecommand.cpp
+++ b/src/render/frontend/qcomputecommand.cpp
@@ -39,6 +39,7 @@
#include "qcomputecommand.h"
#include "qcomputecommand_p.h"
+#include <Qt3DCore/qpropertyupdatedchange.h>
QT_BEGIN_NAMESPACE
@@ -75,12 +76,14 @@ namespace Qt3DRender {
The compute shader is specified in the Material component of the same entity the
ComputeCommand is added to. The workGroupX, workGroupY and workGroupZ properties
specify the work group sizes for the compute shader invocation. DispatchCompute
- node needs to be present in the FrameGraph to actually issue the commands.
+ node needs to be present in the FrameGraph to actually issue the commands. The execution behavior
+ of the compute command can be controlled with the run type property.
- \note If the rendering policy is set to RenderSettings.OnDemand and there are no changes to the
- scene, the ComputeCommand will not be invoked repeatedly.
- The RenderSettings.Always render policy must be set for the ComputeCommand to be
- repeatedly invoked if there are no other changes to the scene that triggers rendering a new
+ \note If the rendering policy is set to RenderSettings.OnDemand, the run
+ type is set to Continuous and there are no changes to the scene, the
+ ComputeCommand will not be invoked repeatedly. The RenderSettings.Always
+ render policy must be set for the ComputeCommand to be repeatedly invoked
+ if there are no other changes to the scene that triggers rendering a new
frame.
*/
@@ -90,6 +93,19 @@ namespace Qt3DRender {
*/
/*!
+ \qmlproperty QComputeCommand::runType
+
+ Specifies whether the compute command should be performed every frame or
+ manually triggered.
+
+ \value Continuous Compute command is executed everyframe. This is the
+ default.
+
+ \value Manual CompouteCommand is executed for a given number of frames and
+ then the component disables itself.
+ */
+
+/*!
\qmlproperty int ComputeCommand::workGroupY
Specifies Y workgroup size.
*/
@@ -114,12 +130,36 @@ namespace Qt3DRender {
Specifies Z workgroup size.
*/
+/*!
+ \property QComputeCommand::runType
+
+ Specifies whether the compute command should be performed every frame or
+ manually triggered.
+
+ If set to Continuous, Compute command is executed everyframe. This is the
+ default.
+
+ If set to Manual CompouteCommand is executed for a given number of frames
+ and then the component disables itself.
+ */
+
QComputeCommandPrivate::QComputeCommandPrivate()
: Qt3DCore::QComponentPrivate()
, m_workGroupX(1)
, m_workGroupY(1)
, m_workGroupZ(1)
+ , m_runType(QComputeCommand::Continuous)
+ , m_frameCount(0)
+{
+}
+
+void QComputeCommandPrivate::setFrameCount(int frameCount)
{
+ m_frameCount = frameCount;
+ const auto propertyChange = Qt3DCore::QPropertyUpdatedChangePtr::create(m_id);
+ propertyChange->setPropertyName("frameCount");
+ propertyChange->setValue(m_frameCount);
+ notifyObservers(propertyChange);
}
/*!
@@ -154,6 +194,12 @@ int QComputeCommand::workGroupZ() const
return d->m_workGroupZ;
}
+QComputeCommand::RunType QComputeCommand::runType() const
+{
+ Q_D(const QComputeCommand);
+ return d->m_runType;
+}
+
/*!
Sets the workgroup for the first dimension to \a workGroupX.
*/
@@ -190,6 +236,50 @@ void QComputeCommand::setWorkGroupZ(int workGroupZ)
}
}
+void QComputeCommand::setRunType(QComputeCommand::RunType runType)
+{
+ Q_D(QComputeCommand);
+ if (d->m_runType != runType) {
+ d->m_runType = runType;
+ emit runTypeChanged();
+ }
+}
+
+/*!
+ When the run type is set to Manual, calling trigger will make the compute
+ command be executed for the next \a frameCount frames. Upon completion of
+ the execution, the enabled property will be set to false.
+ */
+void QComputeCommand::trigger(int frameCount)
+{
+ if (isEnabled())
+ qWarning() << Q_FUNC_INFO << "is triggered while it hasn't finished executing";
+
+ Q_D(QComputeCommand);
+ d->setFrameCount(frameCount);
+ setEnabled(true);
+}
+
+/*!
+ When the run type is set to Manual, calling trigger will make the compute
+ command be executed for the next \a frameCount frames. Upon completion of
+ the execution, the enabled property will be set to false. The size of the
+ workgroup previously set will be overridden with \a workGroupX, \a
+ workGroupY, \a workGroupZ.
+ */
+void QComputeCommand::trigger(int workGroupX, int workGroupY, int workGroupZ, int frameCount)
+{
+ if (isEnabled())
+ qWarning() << Q_FUNC_INFO << "is triggered while it hasn't finished executing";
+
+ setWorkGroupX(workGroupX);
+ setWorkGroupY(workGroupY);
+ setWorkGroupZ(workGroupZ);
+ Q_D(QComputeCommand);
+ d->setFrameCount(frameCount);
+ setEnabled(true);
+}
+
Qt3DCore::QNodeCreatedChangeBasePtr QComputeCommand::createNodeCreationChange() const
{
auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QComputeCommandData>::create(this);
@@ -198,6 +288,8 @@ Qt3DCore::QNodeCreatedChangeBasePtr QComputeCommand::createNodeCreationChange()
data.workGroupX = d->m_workGroupX;
data.workGroupY = d->m_workGroupY;
data.workGroupZ = d->m_workGroupZ;
+ data.runType = d->m_runType;
+ data.frameCount = d->m_frameCount;
return creationChange;
}
diff --git a/src/render/frontend/qcomputecommand.h b/src/render/frontend/qcomputecommand.h
index c31082197..b71007ba0 100644
--- a/src/render/frontend/qcomputecommand.h
+++ b/src/render/frontend/qcomputecommand.h
@@ -49,30 +49,43 @@ namespace Qt3DRender {
class QComputeCommandPrivate;
-class QT3DRENDERSHARED_EXPORT QComputeCommand : public Qt3DCore::QComponent
+class Q_3DRENDERSHARED_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)
+ Q_PROPERTY(RunType runType READ runType WRITE setRunType NOTIFY runTypeChanged REVISION 13)
public:
+ enum RunType {
+ Continuous = 0,
+ Manual
+ };
+ Q_ENUM(RunType)
+
explicit QComputeCommand(Qt3DCore::QNode *parent = nullptr);
~QComputeCommand();
int workGroupX() const;
int workGroupY() const;
int workGroupZ() const;
+ RunType runType() const;
public Q_SLOTS:
void setWorkGroupX(int workGroupX);
void setWorkGroupY(int workGroupY);
void setWorkGroupZ(int workGroupZ);
+ Q_REVISION(13) void setRunType(RunType runType);
+
+ Q_REVISION(13) void trigger(int frameCount = 1);
+ Q_REVISION(13) void trigger(int workGroupX, int workGroupY, int workGroupZ, int frameCount = 1);
Q_SIGNALS:
void workGroupXChanged();
void workGroupYChanged();
void workGroupZChanged();
+ void runTypeChanged();
private:
Q_DECLARE_PRIVATE(QComputeCommand)
diff --git a/src/render/frontend/qcomputecommand_p.h b/src/render/frontend/qcomputecommand_p.h
index 874edb1fc..0a614325b 100644
--- a/src/render/frontend/qcomputecommand_p.h
+++ b/src/render/frontend/qcomputecommand_p.h
@@ -52,13 +52,14 @@
//
#include <Qt3DCore/private/qcomponent_p.h>
+#include <Qt3DRender/qcomputecommand.h>
#include <Qt3DRender/private/qt3drender_global_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_PRIVATE_EXPORT QComputeCommandPrivate : public Qt3DCore::QComponentPrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QComputeCommandPrivate : public Qt3DCore::QComponentPrivate
{
public:
QComputeCommandPrivate();
@@ -66,6 +67,10 @@ public:
int m_workGroupX;
int m_workGroupY;
int m_workGroupZ;
+ QComputeCommand::RunType m_runType;
+ int m_frameCount;
+
+ void setFrameCount(int frameCount);
};
struct QComputeCommandData
@@ -73,6 +78,8 @@ struct QComputeCommandData
int workGroupX;
int workGroupY;
int workGroupZ;
+ QComputeCommand::RunType runType;
+ int frameCount;
};
} // Qt3DRender
diff --git a/src/render/frontend/qlayer.h b/src/render/frontend/qlayer.h
index 27910f190..4900f30e0 100644
--- a/src/render/frontend/qlayer.h
+++ b/src/render/frontend/qlayer.h
@@ -50,7 +50,7 @@ namespace Qt3DRender {
class QLayerPrivate;
-class QT3DRENDERSHARED_EXPORT QLayer : public Qt3DCore::QComponent
+class Q_3DRENDERSHARED_EXPORT QLayer : public Qt3DCore::QComponent
{
Q_OBJECT
Q_PROPERTY(bool recursive READ recursive WRITE setRecursive NOTIFY recursiveChanged)
diff --git a/src/render/frontend/qlayer_p.h b/src/render/frontend/qlayer_p.h
index 1c01955f7..3a1fd7f61 100644
--- a/src/render/frontend/qlayer_p.h
+++ b/src/render/frontend/qlayer_p.h
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_PRIVATE_EXPORT QLayerPrivate : public Qt3DCore::QComponentPrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QLayerPrivate : public Qt3DCore::QComponentPrivate
{
public:
QLayerPrivate();
diff --git a/src/render/frontend/qlevelofdetail.h b/src/render/frontend/qlevelofdetail.h
index fb74659dd..308a4d3c0 100644
--- a/src/render/frontend/qlevelofdetail.h
+++ b/src/render/frontend/qlevelofdetail.h
@@ -53,7 +53,7 @@ namespace Qt3DRender {
class QCamera;
class QLevelOfDetailPrivate;
-class QT3DRENDERSHARED_EXPORT QLevelOfDetail : public Qt3DCore::QComponent
+class Q_3DRENDERSHARED_EXPORT QLevelOfDetail : public Qt3DCore::QComponent
{
Q_OBJECT
Q_PROPERTY(Qt3DRender::QCamera *camera READ camera WRITE setCamera NOTIFY cameraChanged)
diff --git a/src/render/frontend/qlevelofdetail_p.h b/src/render/frontend/qlevelofdetail_p.h
index 136d2ffa3..7b409e4ca 100644
--- a/src/render/frontend/qlevelofdetail_p.h
+++ b/src/render/frontend/qlevelofdetail_p.h
@@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_PRIVATE_EXPORT QLevelOfDetailPrivate : public Qt3DCore::QComponentPrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QLevelOfDetailPrivate : public Qt3DCore::QComponentPrivate
{
public:
QLevelOfDetailPrivate();
diff --git a/src/render/frontend/qlevelofdetailboundingsphere.h b/src/render/frontend/qlevelofdetailboundingsphere.h
index 43ba422a8..81d49d04e 100644
--- a/src/render/frontend/qlevelofdetailboundingsphere.h
+++ b/src/render/frontend/qlevelofdetailboundingsphere.h
@@ -51,7 +51,7 @@ namespace Qt3DRender {
class QLevelOfDetailBoundingSpherePrivate;
-class QT3DRENDERSHARED_EXPORT QLevelOfDetailBoundingSphere
+class Q_3DRENDERSHARED_EXPORT QLevelOfDetailBoundingSphere
{
Q_GADGET
Q_PROPERTY(QVector3D center READ center CONSTANT)
diff --git a/src/render/frontend/qlevelofdetailswitch.h b/src/render/frontend/qlevelofdetailswitch.h
index 55c7d24c1..1615d16e6 100644
--- a/src/render/frontend/qlevelofdetailswitch.h
+++ b/src/render/frontend/qlevelofdetailswitch.h
@@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_EXPORT QLevelOfDetailSwitch : public QLevelOfDetail
+class Q_3DRENDERSHARED_EXPORT QLevelOfDetailSwitch : public QLevelOfDetail
{
Q_OBJECT
diff --git a/src/render/frontend/qpickingsettings.cpp b/src/render/frontend/qpickingsettings.cpp
index 66d3fc912..84e61e141 100644
--- a/src/render/frontend/qpickingsettings.cpp
+++ b/src/render/frontend/qpickingsettings.cpp
@@ -199,6 +199,9 @@ void QPickingSettings::setPickMethod(QPickingSettings::PickMethod pickMethod)
* \value NearestPick Only the nearest entity to picking ray origin intersected by the picking ray
* is picked (default).
* \value AllPicks All entities that intersect the picking ray are picked.
+ * \value PriorityPick Selects the entity whose object picker has the highest
+ * value. If several object pickers have the same priority, the closest one on
+ * the ray is selected.
*
* \sa Qt3DRender::QPickEvent
*/
@@ -211,6 +214,7 @@ void QPickingSettings::setPickMethod(QPickingSettings::PickMethod pickMethod)
\list
\li PickingSettings.NearestPick
\li PickingSettings.AllPicks
+ \li PickingSettings.NearestPriorityPick
\endlist
\sa Qt3DRender::QPickingSettings::PickResultMode
@@ -225,6 +229,10 @@ void QPickingSettings::setPickMethod(QPickingSettings::PickMethod pickMethod)
When setting the pick method to AllPicks, events will be triggered for all the
entities with a QObjectPicker along the ray.
+ When setting the pick method to NearestPriorityPick, events will be
+ triggered for the nearest highest priority picker. This can be used when a
+ given element should always be selected even if others are in front of it.
+
If a QObjectPicker is assigned to an entity with multiple children, an event will
be triggered for each child entity that intersects the ray.
*/
diff --git a/src/render/frontend/qpickingsettings.h b/src/render/frontend/qpickingsettings.h
index 9c8a2c856..11384414b 100644
--- a/src/render/frontend/qpickingsettings.h
+++ b/src/render/frontend/qpickingsettings.h
@@ -51,7 +51,7 @@ class QPickingSettingsPrivate;
// TO DO: Qt 6 -> Make this a QObject
-class QT3DRENDERSHARED_EXPORT QPickingSettings : public Qt3DCore::QNode
+class Q_3DRENDERSHARED_EXPORT QPickingSettings : public Qt3DCore::QNode
{
Q_OBJECT
Q_PROPERTY(PickMethod pickMethod READ pickMethod WRITE setPickMethod NOTIFY pickMethodChanged)
@@ -73,7 +73,8 @@ public:
enum PickResultMode {
NearestPick,
- AllPicks
+ AllPicks,
+ NearestPriorityPick
};
Q_ENUM(PickResultMode) // LCOV_EXCL_LINE
diff --git a/src/render/frontend/qpickingsettings_p.h b/src/render/frontend/qpickingsettings_p.h
index 780a8b677..73f48c06e 100644
--- a/src/render/frontend/qpickingsettings_p.h
+++ b/src/render/frontend/qpickingsettings_p.h
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_PRIVATE_EXPORT QPickingSettingsPrivate : public Qt3DCore::QNodePrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QPickingSettingsPrivate : public Qt3DCore::QNodePrivate
{
public:
QPickingSettingsPrivate();
diff --git a/src/render/frontend/qrenderaspect.cpp b/src/render/frontend/qrenderaspect.cpp
index ae84599e8..14fbe1754 100644
--- a/src/render/frontend/qrenderaspect.cpp
+++ b/src/render/frontend/qrenderaspect.cpp
@@ -88,6 +88,8 @@
#include <Qt3DRender/qproximityfilter.h>
#include <Qt3DRender/qshaderprogrambuilder.h>
#include <Qt3DRender/qblitframebuffer.h>
+#include <Qt3DRender/qsetfence.h>
+#include <Qt3DRender/qwaitfence.h>
#include <Qt3DCore/qarmature.h>
#include <Qt3DCore/qjoint.h>
#include <Qt3DCore/qskeletonloader.h>
@@ -150,6 +152,8 @@
#include <Qt3DRender/private/joint_p.h>
#include <Qt3DRender/private/loadskeletonjob_p.h>
#include <Qt3DRender/private/proximityfilter_p.h>
+#include <Qt3DRender/private/setfence_p.h>
+#include <Qt3DRender/private/waitfence_p.h>
#include <private/qrenderpluginfactory_p.h>
#include <private/qrenderplugin_p.h>
@@ -298,6 +302,8 @@ void QRenderAspectPrivate::registerBackendTypes()
q->registerBackendType<QMemoryBarrier>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::MemoryBarrier, QMemoryBarrier> >::create(m_renderer));
q->registerBackendType<QProximityFilter>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::ProximityFilter, QProximityFilter> >::create(m_renderer));
q->registerBackendType<QBlitFramebuffer>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::BlitFramebuffer, QBlitFramebuffer> >::create(m_renderer));
+ q->registerBackendType<QSetFence>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::SetFence, QSetFence> >::create(m_renderer));
+ q->registerBackendType<QWaitFence>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::WaitFence, QWaitFence> >::create(m_renderer));
// Picking
q->registerBackendType<QObjectPicker>(QSharedPointer<Render::NodeFunctor<Render::ObjectPicker, Render::ObjectPickerManager> >::create(m_renderer));
@@ -368,6 +374,8 @@ void QRenderAspectPrivate::unregisterBackendTypes()
unregisterBackendType<QRenderCapture>();
unregisterBackendType<QBufferCapture>();
unregisterBackendType<QMemoryBarrier>();
+ unregisterBackendType<QSetFence>();
+ unregisterBackendType<QWaitFence>();
// Picking
unregisterBackendType<QObjectPicker>();
@@ -509,11 +517,8 @@ QVector<Qt3DCore::QAspectJobPtr> QRenderAspect::jobsToExecute(qint64 time)
const QVector<QAspectJobPtr> geometryJobs = d->createGeometryRendererJobs();
jobs.append(geometryJobs);
-
- // Add all jobs to queue
- // Note: the getter is also responsible for returning a job ready to run
- jobs.append(d->m_renderer->pickBoundingVolumeJob());
- jobs.append(d->m_renderer->rayCastingJob());
+ const QVector<QAspectJobPtr> preRenderingJobs = d->m_renderer->preRenderingJobs();
+ jobs.append(preRenderingJobs);
// Don't spawn any rendering jobs, if the renderer decides to skip this frame
// Note: this only affects rendering jobs (jobs that load buffers,
diff --git a/src/render/frontend/qrenderaspect.h b/src/render/frontend/qrenderaspect.h
index bde60c9e2..5571988a7 100644
--- a/src/render/frontend/qrenderaspect.h
+++ b/src/render/frontend/qrenderaspect.h
@@ -65,7 +65,7 @@ class QRenderAspectPrivate;
class QRenderAspectTester;
#endif
-class QT3DRENDERSHARED_EXPORT QRenderAspect : public Qt3DCore::QAbstractAspect
+class Q_3DRENDERSHARED_EXPORT QRenderAspect : public Qt3DCore::QAbstractAspect
{
Q_OBJECT
public:
diff --git a/src/render/frontend/qrenderaspect_p.h b/src/render/frontend/qrenderaspect_p.h
index 26ca091f6..4a091e164 100644
--- a/src/render/frontend/qrenderaspect_p.h
+++ b/src/render/frontend/qrenderaspect_p.h
@@ -75,7 +75,7 @@ namespace Render {
class OffscreenSurfaceHelper;
}
-class QT3DRENDERSHARED_PRIVATE_EXPORT QRenderAspectPrivate : public Qt3DCore::QAbstractAspectPrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QRenderAspectPrivate : public Qt3DCore::QAbstractAspectPrivate
{
public:
QRenderAspectPrivate(QRenderAspect::RenderType type);
diff --git a/src/render/frontend/qrenderplugin_p.h b/src/render/frontend/qrenderplugin_p.h
index 5144448c1..c34dabefc 100644
--- a/src/render/frontend/qrenderplugin_p.h
+++ b/src/render/frontend/qrenderplugin_p.h
@@ -64,7 +64,7 @@ namespace Render {
class AbstractRenderer;
-class QT3DRENDERSHARED_PRIVATE_EXPORT QRenderPlugin
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QRenderPlugin
{
public:
virtual bool registerBackendTypes(QRenderAspect *aspect, AbstractRenderer *renderer) = 0;
diff --git a/src/render/frontend/qrenderpluginfactory_p.h b/src/render/frontend/qrenderpluginfactory_p.h
index 9cffd500a..26e856613 100644
--- a/src/render/frontend/qrenderpluginfactory_p.h
+++ b/src/render/frontend/qrenderpluginfactory_p.h
@@ -59,7 +59,7 @@ namespace Render {
class QRenderPlugin;
-class QT3DRENDERSHARED_PRIVATE_EXPORT QRenderPluginFactory
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QRenderPluginFactory
{
public:
static QStringList keys(const QString &pluginPath = QString());
diff --git a/src/render/frontend/qrenderpluginfactoryif_p.h b/src/render/frontend/qrenderpluginfactoryif_p.h
index d5f0008d2..249552b32 100644
--- a/src/render/frontend/qrenderpluginfactoryif_p.h
+++ b/src/render/frontend/qrenderpluginfactoryif_p.h
@@ -64,7 +64,7 @@ namespace Render {
class QRenderPlugin;
-class QT3DRENDERSHARED_PRIVATE_EXPORT QRenderPluginFactoryIf : public QObject
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QRenderPluginFactoryIf : public QObject
{
Q_OBJECT
public:
diff --git a/src/render/frontend/qrendersettings.h b/src/render/frontend/qrendersettings.h
index b759ebd88..9d2baa58b 100644
--- a/src/render/frontend/qrendersettings.h
+++ b/src/render/frontend/qrendersettings.h
@@ -51,7 +51,7 @@ namespace Qt3DRender {
class QFrameGraphNode;
class QRenderSettingsPrivate;
-class QT3DRENDERSHARED_EXPORT QRenderSettings : public Qt3DCore::QComponent
+class Q_3DRENDERSHARED_EXPORT QRenderSettings : public Qt3DCore::QComponent
{
Q_OBJECT
diff --git a/src/render/frontend/qrendersettings_p.h b/src/render/frontend/qrendersettings_p.h
index 60ebd0f0d..f91397bd2 100644
--- a/src/render/frontend/qrendersettings_p.h
+++ b/src/render/frontend/qrendersettings_p.h
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_PRIVATE_EXPORT QRenderSettingsPrivate : public Qt3DCore::QComponentPrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QRenderSettingsPrivate : public Qt3DCore::QComponentPrivate
{
public:
QRenderSettingsPrivate();
diff --git a/src/render/frontend/qrendertarget.h b/src/render/frontend/qrendertarget.h
index 69bed5aa5..9faf113da 100644
--- a/src/render/frontend/qrendertarget.h
+++ b/src/render/frontend/qrendertarget.h
@@ -50,7 +50,7 @@ namespace Qt3DRender {
class QRenderTargetPrivate;
class QRenderTargetOutput;
-class QT3DRENDERSHARED_EXPORT QRenderTarget : public Qt3DCore::QComponent
+class Q_3DRENDERSHARED_EXPORT QRenderTarget : public Qt3DCore::QComponent
{
Q_OBJECT
public:
diff --git a/src/render/frontend/qrendertarget_p.h b/src/render/frontend/qrendertarget_p.h
index f1035e846..b08477478 100644
--- a/src/render/frontend/qrendertarget_p.h
+++ b/src/render/frontend/qrendertarget_p.h
@@ -61,7 +61,7 @@ namespace Qt3DRender {
class QRenderTargetOutput;
class QRenderTarget;
-class QT3DRENDERSHARED_PRIVATE_EXPORT QRenderTargetPrivate : public Qt3DCore::QComponentPrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QRenderTargetPrivate : public Qt3DCore::QComponentPrivate
{
public:
QRenderTargetPrivate();
diff --git a/src/render/frontend/qrendertargetoutput.h b/src/render/frontend/qrendertargetoutput.h
index 2eb99df3c..a582c26f0 100644
--- a/src/render/frontend/qrendertargetoutput.h
+++ b/src/render/frontend/qrendertargetoutput.h
@@ -51,7 +51,7 @@ namespace Qt3DRender {
class QAbstractTexture;
class QRenderTargetOutputPrivate;
-class QT3DRENDERSHARED_EXPORT QRenderTargetOutput : public Qt3DCore::QNode
+class Q_3DRENDERSHARED_EXPORT QRenderTargetOutput : public Qt3DCore::QNode
{
Q_OBJECT
Q_PROPERTY(AttachmentPoint attachmentPoint READ attachmentPoint WRITE setAttachmentPoint NOTIFY attachmentPointChanged)
diff --git a/src/render/frontend/qrendertargetoutput_p.h b/src/render/frontend/qrendertargetoutput_p.h
index df855f184..e16a5eeb0 100644
--- a/src/render/frontend/qrendertargetoutput_p.h
+++ b/src/render/frontend/qrendertargetoutput_p.h
@@ -61,7 +61,7 @@ namespace Qt3DRender {
class QAbstractTexture;
-class QT3DRENDERSHARED_PRIVATE_EXPORT QRenderTargetOutputPrivate : public Qt3DCore::QNodePrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QRenderTargetOutputPrivate : public Qt3DCore::QNodePrivate
{
public:
QRenderTargetOutputPrivate();
diff --git a/src/render/frontend/sphere_p.h b/src/render/frontend/sphere_p.h
index 14b6f1414..10cf92091 100644
--- a/src/render/frontend/sphere_p.h
+++ b/src/render/frontend/sphere_p.h
@@ -64,7 +64,7 @@ namespace Qt3DRender {
namespace Render {
-class QT3DRENDERSHARED_PRIVATE_EXPORT Sphere : public RayCasting::BoundingSphere
+class Q_3DRENDERSHARED_PRIVATE_EXPORT Sphere : public RayCasting::BoundingSphere
{
public:
inline Sphere(Qt3DCore::QNodeId i = Qt3DCore::QNodeId())
@@ -158,7 +158,7 @@ inline bool intersects(const Sphere &a, const Sphere &b)
}
#ifndef QT_NO_DEBUG_STREAM
-QT3DRENDERSHARED_EXPORT QDebug operator<<(QDebug dbg, const Sphere &sphere);
+Q_3DRENDERSHARED_EXPORT QDebug operator<<(QDebug dbg, const Sphere &sphere);
#endif
} // Render
diff --git a/src/render/geometry/attribute.cpp b/src/render/geometry/attribute.cpp
index 6c8c0113a..bc6b27851 100644
--- a/src/render/geometry/attribute.cpp
+++ b/src/render/geometry/attribute.cpp
@@ -100,6 +100,17 @@ void Attribute::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &ch
m_attributeDirty = true;
}
+/*!
+ \fn Qt3DRender::QAttribute::dataSizeChanged(uint vertexSize)
+
+ The signal is emitted with \a vertexSize when the dataSize changes.
+
+*/
+/*!
+ \fn Qt3DRender::QAttribute::dataTypeChanged(Qt3DRender::QAttribute::VertexBaseType vertexBaseType)
+
+ The signal is emitted with \a vertexBaseType when the dataType changed.
+*/
void Attribute::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
switch (e->type()) {
diff --git a/src/render/geometry/geometry.cpp b/src/render/geometry/geometry.cpp
index d87b4d8eb..4ee02a74d 100644
--- a/src/render/geometry/geometry.cpp
+++ b/src/render/geometry/geometry.cpp
@@ -53,8 +53,10 @@ namespace Qt3DRender {
namespace Render {
Geometry::Geometry()
- : BackendNode(ReadOnly)
+ : BackendNode(ReadWrite)
, m_geometryDirty(false)
+ , m_shouldNotifyMinExtentChanged(false)
+ , m_shouldNotifyMaxExtentChanged(false)
{
}
@@ -68,6 +70,10 @@ void Geometry::cleanup()
m_attributes.clear();
m_geometryDirty = false;
m_boundingPositionAttribute = Qt3DCore::QNodeId();
+ m_min = QVector3D();
+ m_max = QVector3D();
+ m_shouldNotifyMinExtentChanged = false;
+ m_shouldNotifyMaxExtentChanged = false;
}
void Geometry::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
@@ -122,6 +128,37 @@ void Geometry::unsetDirty()
m_geometryDirty = false;
}
+// Called from calcboundingvolumejob (in a QtConcurrent thead (can't send
+// update changes from such a thread))
+void Geometry::updateExtent(const QVector3D &min, const QVector3D &max)
+{
+ // Send notification to frontend
+ if (m_min != min) {
+ m_min = min;
+ m_shouldNotifyMinExtentChanged = true;
+ }
+
+ if (m_max != max) {
+ m_max = max;
+ m_shouldNotifyMaxExtentChanged = true;
+ }
+}
+
+// Called from calcboundingvolumejob after all bounding volumes have been
+// updated (in an aspect thread)
+void Geometry::notifyExtentChanged()
+{
+ if (m_shouldNotifyMinExtentChanged || m_shouldNotifyMaxExtentChanged) {
+ auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
+ change->setDeliveryFlags(Qt3DCore::QSceneChange::Nodes);
+ change->setPropertyName("extent");
+ change->setValue(QVariant::fromValue(QPair<QVector3D, QVector3D>(m_min, m_max)));
+ notifyObservers(change);
+ m_shouldNotifyMinExtentChanged = false;
+ m_shouldNotifyMaxExtentChanged = false;
+ }
+}
+
} // namespace Render
} // namespace Qt3DRender
diff --git a/src/render/geometry/geometry_p.h b/src/render/geometry/geometry_p.h
index b158648ad..e66524787 100644
--- a/src/render/geometry/geometry_p.h
+++ b/src/render/geometry/geometry_p.h
@@ -75,12 +75,22 @@ public:
inline Qt3DCore::QNodeId boundingPositionAttribute() const { return m_boundingPositionAttribute; }
void unsetDirty();
+ inline QVector3D min() const { return m_min; }
+ inline QVector3D max() const { return m_max; }
+
+ void updateExtent(const QVector3D &min, const QVector3D &max);
+ void notifyExtentChanged();
+
private:
void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) final;
QVector<Qt3DCore::QNodeId> m_attributes;
bool m_geometryDirty;
Qt3DCore::QNodeId m_boundingPositionAttribute;
+ QVector3D m_min;
+ QVector3D m_max;
+ bool m_shouldNotifyMinExtentChanged;
+ bool m_shouldNotifyMaxExtentChanged;
};
} // namespace Render
diff --git a/src/render/geometry/qattribute.h b/src/render/geometry/qattribute.h
index 13a0319b5..526a77a59 100644
--- a/src/render/geometry/qattribute.h
+++ b/src/render/geometry/qattribute.h
@@ -53,7 +53,7 @@ class QAttributePrivate;
typedef QSharedPointer<QBuffer> QBufferPtr;
-class QT3DRENDERSHARED_EXPORT QAttribute : public Qt3DCore::QNode
+class Q_3DRENDERSHARED_EXPORT QAttribute : public Qt3DCore::QNode
{
Q_OBJECT
Q_PROPERTY(Qt3DRender::QBuffer *buffer READ buffer WRITE setBuffer NOTIFY bufferChanged)
diff --git a/src/render/geometry/qattribute_p.h b/src/render/geometry/qattribute_p.h
index d3385345a..8355a042b 100644
--- a/src/render/geometry/qattribute_p.h
+++ b/src/render/geometry/qattribute_p.h
@@ -62,7 +62,7 @@ namespace Qt3DRender {
class QAttribute;
-class QT3DRENDERSHARED_PRIVATE_EXPORT QAttributePrivate : public Qt3DCore::QNodePrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QAttributePrivate : public Qt3DCore::QNodePrivate
{
public:
Q_DECLARE_PUBLIC(QAttribute)
diff --git a/src/render/geometry/qbuffer.h b/src/render/geometry/qbuffer.h
index f04c98a11..1bd1aa8fd 100644
--- a/src/render/geometry/qbuffer.h
+++ b/src/render/geometry/qbuffer.h
@@ -53,7 +53,7 @@ class QBufferPrivate;
class QBufferDataGenerator;
typedef QSharedPointer<QBufferDataGenerator> QBufferDataGeneratorPtr;
-class QT3DRENDERSHARED_EXPORT QBuffer : public Qt3DCore::QNode
+class Q_3DRENDERSHARED_EXPORT QBuffer : public Qt3DCore::QNode
{
Q_OBJECT
Q_PROPERTY(BufferType type READ type WRITE setType NOTIFY typeChanged)
diff --git a/src/render/geometry/qbuffer_p.h b/src/render/geometry/qbuffer_p.h
index a342518e0..7a0ffdfb9 100644
--- a/src/render/geometry/qbuffer_p.h
+++ b/src/render/geometry/qbuffer_p.h
@@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_EXPORT QBufferPrivate : public Qt3DCore::QNodePrivate
+class Q_3DRENDERSHARED_EXPORT QBufferPrivate : public Qt3DCore::QNodePrivate
{
public:
Q_DECLARE_PUBLIC(QBuffer)
diff --git a/src/render/geometry/qbufferdatagenerator.h b/src/render/geometry/qbufferdatagenerator.h
index 004eb26eb..aea6eaef5 100644
--- a/src/render/geometry/qbufferdatagenerator.h
+++ b/src/render/geometry/qbufferdatagenerator.h
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_EXPORT QBufferDataGenerator : public QAbstractFunctor
+class Q_3DRENDERSHARED_EXPORT QBufferDataGenerator : public QAbstractFunctor
{
public:
virtual ~QBufferDataGenerator() {}
diff --git a/src/render/geometry/qgeometry.cpp b/src/render/geometry/qgeometry.cpp
index c49dde822..ec80e2657 100644
--- a/src/render/geometry/qgeometry.cpp
+++ b/src/render/geometry/qgeometry.cpp
@@ -153,6 +153,28 @@ QGeometry::QGeometry(QGeometryPrivate &dd, QNode *parent)
{
}
+void QGeometry::sceneChangeEvent(const QSceneChangePtr &change)
+{
+ Q_D(QGeometry);
+ QPropertyUpdatedChangePtr e = qSharedPointerCast<QPropertyUpdatedChange>(change);
+ if (e->type() == PropertyUpdated) {
+ const bool blocked = blockNotifications(true);
+ if (e->propertyName() == QByteArrayLiteral("extent")) {
+ const QPair<QVector3D, QVector3D> extent = e->value().value<QPair<QVector3D, QVector3D>>();
+
+ if (extent.first != d->m_minExtent) {
+ d->m_minExtent = extent.first;
+ emit minExtentChanged(extent.first);
+ }
+ if (extent.second != d->m_maxExtent) {
+ d->m_maxExtent = extent.second;
+ emit maxExtentChanged(d->m_maxExtent);
+ }
+ }
+ blockNotifications(blocked);
+ }
+}
+
/*!
\fn void Qt3DRender::QGeometry::addAttribute(Qt3DRender::QAttribute *attribute)
Adds an \a attribute to this geometry.
@@ -216,6 +238,40 @@ QAttribute *QGeometry::boundingVolumePositionAttribute() const
}
/*!
+ \qmlproperty vector3d Geometry::minExtent
+
+ Holds the vertex with the lowest x, y, z position values.
+ */
+
+/*!
+ \property QGeometry::minExtent
+
+ Holds the vertex with the lowest x, y, z position values.
+ */
+QVector3D QGeometry::minExtent() const
+{
+ Q_D(const QGeometry);
+ return d->m_minExtent;
+}
+
+/*!
+ \qmlproperty vector3d Geometry::maxExtent
+
+ Holds the vertex with the highest x, y, z position values.
+ */
+
+/*!
+ \property QGeometry::maxExtent
+
+ Holds the vertex with the highest x, y, z position values.
+ */
+QVector3D QGeometry::maxExtent() const
+{
+ Q_D(const QGeometry);
+ return d->m_maxExtent;
+}
+
+/*!
Returns the list of attributes in this geometry.
*/
QVector<QAttribute *> QGeometry::attributes() const
diff --git a/src/render/geometry/qgeometry.h b/src/render/geometry/qgeometry.h
index 0e6f7d68e..cae637f1f 100644
--- a/src/render/geometry/qgeometry.h
+++ b/src/render/geometry/qgeometry.h
@@ -50,10 +50,12 @@ namespace Qt3DRender {
class QAttribute;
class QGeometryPrivate;
-class QT3DRENDERSHARED_EXPORT QGeometry : public Qt3DCore::QNode
+class Q_3DRENDERSHARED_EXPORT QGeometry : public Qt3DCore::QNode
{
Q_OBJECT
Q_PROPERTY(Qt3DRender::QAttribute *boundingVolumePositionAttribute READ boundingVolumePositionAttribute WRITE setBoundingVolumePositionAttribute NOTIFY boundingVolumePositionAttributeChanged)
+ Q_PROPERTY(QVector3D minExtent READ minExtent NOTIFY minExtentChanged REVISION 13)
+ Q_PROPERTY(QVector3D maxExtent READ maxExtent NOTIFY maxExtentChanged REVISION 13)
public:
explicit QGeometry(Qt3DCore::QNode *parent = nullptr);
~QGeometry();
@@ -63,15 +65,19 @@ public:
Q_INVOKABLE void removeAttribute(Qt3DRender::QAttribute *attribute);
QAttribute *boundingVolumePositionAttribute() const;
+ QVector3D minExtent() const;
+ QVector3D maxExtent() const;
public Q_SLOTS:
void setBoundingVolumePositionAttribute(QAttribute *boundingVolumePositionAttribute);
Q_SIGNALS:
void boundingVolumePositionAttributeChanged(QAttribute *boundingVolumePositionAttribute);
-
+ Q_REVISION(13) void minExtentChanged(const QVector3D &minExtent);
+ Q_REVISION(13) void maxExtentChanged(const QVector3D &maxExtent);
protected:
explicit QGeometry(QGeometryPrivate &dd, Qt3DCore::QNode *parent = nullptr);
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override;
private:
Q_DECLARE_PRIVATE(QGeometry)
diff --git a/src/render/geometry/qgeometry_p.h b/src/render/geometry/qgeometry_p.h
index e07b9ff0d..94f71d780 100644
--- a/src/render/geometry/qgeometry_p.h
+++ b/src/render/geometry/qgeometry_p.h
@@ -53,12 +53,13 @@
#include <Qt3DRender/private/qt3drender_global_p.h>
#include <Qt3DCore/private/qnode_p.h>
+#include <QVector3D>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_PRIVATE_EXPORT QGeometryPrivate : public Qt3DCore::QNodePrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QGeometryPrivate : public Qt3DCore::QNodePrivate
{
public:
Q_DECLARE_PUBLIC(QGeometry)
@@ -68,6 +69,8 @@ public:
QVector<QAttribute *> m_attributes;
QAttribute *m_boundingVolumePositionAttribute;
+ QVector3D m_minExtent;
+ QVector3D m_maxExtent;
};
struct QGeometryData
diff --git a/src/render/geometry/qgeometryfactory.h b/src/render/geometry/qgeometryfactory.h
index 2e4d5c821..92acbc67d 100644
--- a/src/render/geometry/qgeometryfactory.h
+++ b/src/render/geometry/qgeometryfactory.h
@@ -50,7 +50,7 @@ namespace Qt3DRender {
class QGeometry;
-class QT3DRENDERSHARED_EXPORT QGeometryFactory : public QAbstractFunctor
+class Q_3DRENDERSHARED_EXPORT QGeometryFactory : public QAbstractFunctor
{
public:
virtual ~QGeometryFactory();
diff --git a/src/render/geometry/qgeometryrenderer.h b/src/render/geometry/qgeometryrenderer.h
index 85bab9fc6..81bd1ff67 100644
--- a/src/render/geometry/qgeometryrenderer.h
+++ b/src/render/geometry/qgeometryrenderer.h
@@ -53,7 +53,7 @@ class QGeometryFactory;
typedef QSharedPointer<QGeometryFactory> QGeometryFactoryPtr;
-class QT3DRENDERSHARED_EXPORT QGeometryRenderer : public Qt3DCore::QComponent
+class Q_3DRENDERSHARED_EXPORT QGeometryRenderer : public Qt3DCore::QComponent
{
Q_OBJECT
Q_PROPERTY(int instanceCount READ instanceCount WRITE setInstanceCount NOTIFY instanceCountChanged)
diff --git a/src/render/geometry/qgeometryrenderer_p.h b/src/render/geometry/qgeometryrenderer_p.h
index 8096b4a6b..32ca334e3 100644
--- a/src/render/geometry/qgeometryrenderer_p.h
+++ b/src/render/geometry/qgeometryrenderer_p.h
@@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_PRIVATE_EXPORT QGeometryRendererPrivate : public Qt3DCore::QComponentPrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QGeometryRendererPrivate : public Qt3DCore::QComponentPrivate
{
public:
QGeometryRendererPrivate();
diff --git a/src/render/geometry/qmesh.h b/src/render/geometry/qmesh.h
index a7b2747f7..458a21fa4 100644
--- a/src/render/geometry/qmesh.h
+++ b/src/render/geometry/qmesh.h
@@ -54,7 +54,7 @@ class QMeshPrivate;
* @brief Simple static mesh
*
*/
-class QT3DRENDERSHARED_EXPORT QMesh : public QGeometryRenderer
+class Q_3DRENDERSHARED_EXPORT QMesh : public QGeometryRenderer
{
Q_OBJECT
Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
diff --git a/src/render/geometry/qmesh_p.h b/src/render/geometry/qmesh_p.h
index 2d03e7862..4a4ff4979 100644
--- a/src/render/geometry/qmesh_p.h
+++ b/src/render/geometry/qmesh_p.h
@@ -69,7 +69,7 @@ namespace Render {
class NodeManagers;
}
-class QT3DRENDERSHARED_PRIVATE_EXPORT QMeshPrivate : public QGeometryRendererPrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QMeshPrivate : public QGeometryRendererPrivate
{
public:
QMeshPrivate();
diff --git a/src/render/io/qaxisalignedboundingbox_p.h b/src/render/io/qaxisalignedboundingbox_p.h
index 7a88190b7..c77fa1147 100644
--- a/src/render/io/qaxisalignedboundingbox_p.h
+++ b/src/render/io/qaxisalignedboundingbox_p.h
@@ -86,7 +86,7 @@ public:
bool isNull() const { return m_center.isNull() && m_radii.isNull(); }
- void QT3DRENDERSHARED_PRIVATE_EXPORT update(const QVector<QVector3D> &points);
+ void Q_3DRENDERSHARED_PRIVATE_EXPORT update(const QVector<QVector3D> &points);
inline QVector3D center() const { return m_center; }
inline QVector3D radii() const { return m_radii; }
diff --git a/src/render/io/qgeometryloaderfactory_p.h b/src/render/io/qgeometryloaderfactory_p.h
index 6e0044c4a..b4f2be2b5 100644
--- a/src/render/io/qgeometryloaderfactory_p.h
+++ b/src/render/io/qgeometryloaderfactory_p.h
@@ -65,7 +65,7 @@ namespace Qt3DRender {
class QGeometryLoaderInterface;
-class QT3DRENDERSHARED_PRIVATE_EXPORT QGeometryLoaderFactory : public QObject, public QFactoryInterface
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QGeometryLoaderFactory : public QObject, public QFactoryInterface
{
Q_OBJECT
Q_INTERFACES(QFactoryInterface)
diff --git a/src/render/io/qgeometryloaderinterface_p.h b/src/render/io/qgeometryloaderinterface_p.h
index 22d4f8bea..36928445f 100644
--- a/src/render/io/qgeometryloaderinterface_p.h
+++ b/src/render/io/qgeometryloaderinterface_p.h
@@ -63,7 +63,7 @@ namespace Qt3DRender {
class QGeometry;
-class QT3DRENDERSHARED_PRIVATE_EXPORT QGeometryLoaderInterface : public QObject
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QGeometryLoaderInterface : public QObject
{
public:
virtual QGeometry *geometry() const = 0;
diff --git a/src/render/io/qsceneexporter_p.h b/src/render/io/qsceneexporter_p.h
index 3c8b92c77..7b92a0ff3 100644
--- a/src/render/io/qsceneexporter_p.h
+++ b/src/render/io/qsceneexporter_p.h
@@ -67,7 +67,7 @@ namespace Qt3DRender {
Q_DECLARE_LOGGING_CATEGORY(SceneParsers)
-class QT3DRENDERSHARED_PRIVATE_EXPORT QSceneExporter : public QObject
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QSceneExporter : public QObject
{
Q_OBJECT
Q_PROPERTY(QStringList errors READ errors NOTIFY errorsChanged)
diff --git a/src/render/io/qsceneexportfactory_p.h b/src/render/io/qsceneexportfactory_p.h
index 5ff6149f4..fbb278ebe 100644
--- a/src/render/io/qsceneexportfactory_p.h
+++ b/src/render/io/qsceneexportfactory_p.h
@@ -61,7 +61,7 @@ namespace Qt3DRender {
class QSceneExporter;
-class QT3DRENDERSHARED_PRIVATE_EXPORT QSceneExportFactory
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QSceneExportFactory
{
public:
static QStringList keys(const QString &pluginPath = QString());
diff --git a/src/render/io/qsceneexportplugin_p.h b/src/render/io/qsceneexportplugin_p.h
index 3515cd425..dcc1c7769 100644
--- a/src/render/io/qsceneexportplugin_p.h
+++ b/src/render/io/qsceneexportplugin_p.h
@@ -65,7 +65,7 @@ namespace Qt3DRender {
class QSceneExporter;
-class QT3DRENDERSHARED_PRIVATE_EXPORT QSceneExportPlugin : public QObject
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QSceneExportPlugin : public QObject
{
Q_OBJECT
public:
diff --git a/src/render/io/qsceneimporter_p.h b/src/render/io/qsceneimporter_p.h
index 8f83231c3..910a7fc66 100644
--- a/src/render/io/qsceneimporter_p.h
+++ b/src/render/io/qsceneimporter_p.h
@@ -67,7 +67,7 @@ namespace Qt3DRender {
Q_DECLARE_LOGGING_CATEGORY(SceneParsers)
-class QT3DRENDERSHARED_PRIVATE_EXPORT QSceneImporter : public QObject
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QSceneImporter : public QObject
{
Q_OBJECT
Q_PROPERTY(ParserStatus status READ status NOTIFY statusChanged)
diff --git a/src/render/io/qsceneimportfactory_p.h b/src/render/io/qsceneimportfactory_p.h
index c66937fa1..8409ea96d 100644
--- a/src/render/io/qsceneimportfactory_p.h
+++ b/src/render/io/qsceneimportfactory_p.h
@@ -60,7 +60,7 @@ namespace Qt3DRender {
class QSceneImporter;
-class QT3DRENDERSHARED_PRIVATE_EXPORT QSceneImportFactory
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QSceneImportFactory
{
public:
static QStringList keys(const QString &pluginPath = QString());
diff --git a/src/render/io/qsceneimportplugin_p.h b/src/render/io/qsceneimportplugin_p.h
index 01ab84060..a24d1fa3e 100644
--- a/src/render/io/qsceneimportplugin_p.h
+++ b/src/render/io/qsceneimportplugin_p.h
@@ -65,7 +65,7 @@ namespace Qt3DRender {
class QSceneImporter;
-class QT3DRENDERSHARED_PRIVATE_EXPORT QSceneImportPlugin : public QObject
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QSceneImportPlugin : public QObject
{
Q_OBJECT
public:
diff --git a/src/render/io/qsceneloader.h b/src/render/io/qsceneloader.h
index c69a4ad98..4cb743333 100644
--- a/src/render/io/qsceneloader.h
+++ b/src/render/io/qsceneloader.h
@@ -51,7 +51,7 @@ namespace Qt3DRender {
class QSceneLoaderPrivate;
-class QT3DRENDERSHARED_EXPORT QSceneLoader : public Qt3DCore::QComponent
+class Q_3DRENDERSHARED_EXPORT QSceneLoader : public Qt3DCore::QComponent
{
Q_OBJECT
Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
diff --git a/src/render/io/qsceneloader_p.h b/src/render/io/qsceneloader_p.h
index 45a6a1a4e..50745c66f 100644
--- a/src/render/io/qsceneloader_p.h
+++ b/src/render/io/qsceneloader_p.h
@@ -61,7 +61,7 @@ namespace Qt3DRender {
class QSceneImporter;
-class QT3DRENDERSHARED_PRIVATE_EXPORT QSceneLoaderPrivate : public Qt3DCore::QComponentPrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QSceneLoaderPrivate : public Qt3DCore::QComponentPrivate
{
public:
QSceneLoaderPrivate();
diff --git a/src/render/io/qurlhelper_p.h b/src/render/io/qurlhelper_p.h
index c9c4cfd9b..d816d5d31 100644
--- a/src/render/io/qurlhelper_p.h
+++ b/src/render/io/qurlhelper_p.h
@@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_EXPORT QUrlHelper
+class Q_3DRENDERSHARED_EXPORT QUrlHelper
{
public:
static QString urlToLocalFileOrQrc(const QUrl &url);
diff --git a/src/render/jobs/calcboundingvolumejob.cpp b/src/render/jobs/calcboundingvolumejob.cpp
index 66d59f812..113dc34ce 100644
--- a/src/render/jobs/calcboundingvolumejob.cpp
+++ b/src/render/jobs/calcboundingvolumejob.cpp
@@ -51,6 +51,7 @@
#include <Qt3DRender/private/buffer_p.h>
#include <Qt3DRender/private/sphere_p.h>
#include <Qt3DRender/private/buffervisitor_p.h>
+#include <Qt3DRender/private/entityaccumulator_p.h>
#include <QtCore/qmath.h>
#if QT_CONFIG(concurrent)
@@ -65,23 +66,14 @@ namespace Render {
namespace {
-void calculateLocalBoundingVolume(NodeManagers *manager, Entity *node);
-
-struct UpdateBoundFunctor {
- NodeManagers *manager;
-
- void operator ()(Qt3DRender::Render::Entity *node)
- {
- calculateLocalBoundingVolume(manager, node);
- }
-};
-
class BoundingVolumeCalculator
{
public:
BoundingVolumeCalculator(NodeManagers *manager) : m_manager(manager) { }
const Sphere& result() { return m_volume; }
+ const QVector3D min() const { return m_min; }
+ const QVector3D max() const { return m_max; }
bool apply(Qt3DRender::Render::Attribute *positionAttribute,
Qt3DRender::Render::Attribute *indexAttribute,
@@ -95,6 +87,9 @@ public:
return false;
}
+ m_min = QVector3D(findExtremePoints.xMin, findExtremePoints.yMin, findExtremePoints.zMin);
+ m_max = QVector3D(findExtremePoints.xMax, findExtremePoints.yMax, findExtremePoints.zMax);
+
// Calculate squared distance for the pairs of points
const float xDist2 = (findExtremePoints.xMaxPt - findExtremePoints.xMinPt).lengthSquared();
const float yDist2 = (findExtremePoints.yMaxPt - findExtremePoints.yMinPt).lengthSquared();
@@ -127,6 +122,8 @@ public:
private:
Sphere m_volume;
NodeManagers *m_manager;
+ QVector3D m_min;
+ QVector3D m_max;
class FindExtremePoints : public Buffer3fVisitor
{
@@ -191,17 +188,20 @@ private:
};
};
-void calculateLocalBoundingVolume(NodeManagers *manager, Entity *node)
+QVector<Geometry *> calculateLocalBoundingVolume(NodeManagers *manager, Entity *node)
{
// The Bounding volume will only be computed if the position Buffer
// isDirty
+ QVector<Geometry *> updatedGeometries;
+
if (!node->isTreeEnabled())
- return;
+ return updatedGeometries;
GeometryRenderer *gRenderer = node->renderComponent<GeometryRenderer>();
+ GeometryManager *geometryManager = manager->geometryManager();
if (gRenderer && gRenderer->primitiveType() != QGeometryRenderer::Patches) {
- Geometry *geom = manager->lookupResource<Geometry, GeometryManager>(gRenderer->geometryId());
+ Geometry *geom = geometryManager->lookupResource(gRenderer->geometryId());
if (geom) {
int drawVertexCount = gRenderer->vertexCount(); // may be 0, gets changed below if so
@@ -224,14 +224,14 @@ void calculateLocalBoundingVolume(NodeManagers *manager, Entity *node)
|| positionAttribute->vertexBaseType() != QAttribute::Float
|| positionAttribute->vertexSize() < 3) {
qWarning("calculateLocalBoundingVolume: Position attribute not suited for bounding volume computation");
- return;
+ return updatedGeometries;
}
Buffer *buf = manager->lookupResource<Buffer, BufferManager>(positionAttribute->bufferId());
// No point in continuing if the positionAttribute doesn't have a suitable buffer
if (!buf) {
qWarning("calculateLocalBoundingVolume: Position attribute not referencing a valid buffer");
- return;
+ return updatedGeometries;
}
// Check if there is an index attribute.
@@ -259,7 +259,7 @@ void calculateLocalBoundingVolume(NodeManagers *manager, Entity *node)
std::end(validIndexTypes),
indexAttribute->vertexBaseType()) == std::end(validIndexTypes)) {
qWarning() << "calculateLocalBoundingVolume: Unsupported index attribute type" << indexAttribute->name() << indexAttribute->vertexBaseType();
- return;
+ return updatedGeometries;
}
break;
@@ -287,25 +287,38 @@ void calculateLocalBoundingVolume(NodeManagers *manager, Entity *node)
node->localBoundingVolume()->setCenter(reader.result().center());
node->localBoundingVolume()->setRadius(reader.result().radius());
node->unsetBoundingVolumeDirty();
+
+ // Record min/max vertex in Geometry
+ geom->updateExtent(reader.min(), reader.max());
+ // Mark geometry as requiring a call to update its frontend
+ updatedGeometries.push_back(geom);
}
}
}
}
-#if QT_CONFIG(concurrent)
- const QVector<Qt3DRender::Render::Entity *> children = node->children();
- if (children.size() > 1) {
- UpdateBoundFunctor functor;
- functor.manager = manager;
- QtConcurrent::blockingMap(children, functor);
- } else
-#endif
+ return updatedGeometries;
+}
+
+struct UpdateBoundFunctor
+{
+ NodeManagers *manager;
+
+ // This define is required to work with QtConcurrent
+ typedef QVector<Geometry *> result_type;
+ QVector<Geometry *> operator ()(Qt3DRender::Render::Entity *node)
{
- const auto children = node->children();
- for (Entity *child : children)
- calculateLocalBoundingVolume(manager, child);
+ return calculateLocalBoundingVolume(manager, node);
}
-}
+};
+
+struct ReduceUpdateBoundFunctor
+{
+ void operator ()(QVector<Geometry *> &result, const QVector<Geometry *> &values)
+ {
+ result += values;
+ }
+};
} // anonymous
@@ -318,7 +331,30 @@ CalculateBoundingVolumeJob::CalculateBoundingVolumeJob()
void CalculateBoundingVolumeJob::run()
{
- calculateLocalBoundingVolume(m_manager, m_node);
+ EntityAccumulator accumulator([](Entity *entity) {
+ return !entity->componentUuid<GeometryRenderer>().isNull();
+ }, m_manager);
+ auto entities = accumulator.apply(m_node);
+
+ QVector<Geometry *> updatedGeometries;
+ updatedGeometries.reserve(entities.size());
+
+#if QT_CONFIG(concurrent)
+ if (entities.size() > 1) {
+ UpdateBoundFunctor functor;
+ functor.manager = m_manager;
+ ReduceUpdateBoundFunctor reduceFunctor;
+ updatedGeometries += QtConcurrent::blockingMappedReduced<decltype(updatedGeometries)>(entities, functor, reduceFunctor);
+ } else
+#endif
+ {
+ for (Entity *child : entities)
+ updatedGeometries += calculateLocalBoundingVolume(m_manager, child);
+ }
+
+ // Send extent updates to frontend
+ for (Geometry *geometry : updatedGeometries)
+ geometry->notifyExtentChanged();
}
void CalculateBoundingVolumeJob::setRoot(Entity *node)
diff --git a/src/render/jobs/calcboundingvolumejob_p.h b/src/render/jobs/calcboundingvolumejob_p.h
index 41a8bd6c1..3b62c83cd 100644
--- a/src/render/jobs/calcboundingvolumejob_p.h
+++ b/src/render/jobs/calcboundingvolumejob_p.h
@@ -65,7 +65,7 @@ namespace Render {
class NodeManagers;
class Entity;
-class QT3DRENDERSHARED_PRIVATE_EXPORT CalculateBoundingVolumeJob : public Qt3DCore::QAspectJob
+class Q_3DRENDERSHARED_PRIVATE_EXPORT CalculateBoundingVolumeJob : public Qt3DCore::QAspectJob
{
public:
explicit CalculateBoundingVolumeJob();
diff --git a/src/render/jobs/computefilteredboundingvolumejob.cpp b/src/render/jobs/computefilteredboundingvolumejob.cpp
index d8a7b5094..02852685c 100644
--- a/src/render/jobs/computefilteredboundingvolumejob.cpp
+++ b/src/render/jobs/computefilteredboundingvolumejob.cpp
@@ -44,6 +44,8 @@
#include <Qt3DRender/private/renderlogging_p.h>
#include <Qt3DRender/private/sphere_p.h>
#include <Qt3DRender/private/job_common_p.h>
+#include <Qt3DRender/private/managers_p.h>
+#include <Qt3DRender/private/nodemanagers_p.h>
#include <QThread>
@@ -54,16 +56,18 @@ namespace Render {
namespace {
-void expandWorldBoundingVolume(Qt3DRender::Render::Sphere *sphere,
+void expandWorldBoundingVolume(NodeManagers *manager,
+ Qt3DRender::Render::Sphere *sphere,
Qt3DRender::Render::Entity *node,
Qt3DRender::Render::Entity *excludeSubTree)
{
Qt3DRender::Render::Sphere childSphere(*node->worldBoundingVolume());
// Go to the nodes that have the most depth
- const auto children = node->children();
- for (Entity *c : children) {
- if (c != excludeSubTree)
- expandWorldBoundingVolume(&childSphere, c, excludeSubTree);
+ const auto childrenHandles = node->childrenHandles();
+ for (const HEntity &handle : childrenHandles) {
+ Entity *c = manager->renderNodesManager()->data(handle);
+ if (c && c != excludeSubTree)
+ expandWorldBoundingVolume(manager, &childSphere, c, excludeSubTree);
}
sphere->expandToContain(childSphere);
}
@@ -73,6 +77,7 @@ void expandWorldBoundingVolume(Qt3DRender::Render::Sphere *sphere,
ComputeFilteredBoundingVolumeJob::ComputeFilteredBoundingVolumeJob()
: m_root(nullptr)
, m_ignoreSubTree(nullptr)
+ , m_manager(nullptr)
{
SET_JOB_RUN_STAT_TYPE(this, JobTypes::ExpandBoundingVolume, 0);
}
@@ -82,6 +87,11 @@ void ComputeFilteredBoundingVolumeJob::setRoot(Entity *root)
m_root = root;
}
+void ComputeFilteredBoundingVolumeJob::setManagers(NodeManagers *manager)
+{
+ m_manager = manager;
+}
+
void ComputeFilteredBoundingVolumeJob::ignoreSubTree(Entity *node)
{
m_ignoreSubTree = node;
@@ -113,7 +123,7 @@ void ComputeFilteredBoundingVolumeJob::run()
}
Qt3DRender::Render::Sphere sphere;
- expandWorldBoundingVolume(&sphere, m_root, m_ignoreSubTree);
+ expandWorldBoundingVolume(m_manager, &sphere, m_root, m_ignoreSubTree);
finished(sphere);
qCDebug(Jobs) << "Exiting" << Q_FUNC_INFO << QThread::currentThread();
diff --git a/src/render/jobs/computefilteredboundingvolumejob_p.h b/src/render/jobs/computefilteredboundingvolumejob_p.h
index ed336fe08..d2aca575c 100644
--- a/src/render/jobs/computefilteredboundingvolumejob_p.h
+++ b/src/render/jobs/computefilteredboundingvolumejob_p.h
@@ -62,14 +62,16 @@ namespace Qt3DRender {
namespace Render {
class Entity;
+class NodeManagers;
class Sphere;
-class QT3DRENDERSHARED_PRIVATE_EXPORT ComputeFilteredBoundingVolumeJob : public Qt3DCore::QAspectJob
+class Q_3DRENDERSHARED_PRIVATE_EXPORT ComputeFilteredBoundingVolumeJob : public Qt3DCore::QAspectJob
{
public:
ComputeFilteredBoundingVolumeJob();
void setRoot(Entity *root);
+ void setManagers(NodeManagers *manager);
void ignoreSubTree(Entity *node);
void run() override;
@@ -79,6 +81,7 @@ protected:
private:
Entity *m_root;
Entity *m_ignoreSubTree;
+ NodeManagers *m_manager;
};
typedef QSharedPointer<ComputeFilteredBoundingVolumeJob> ComputeFilteredBoundingVolumeJobPtr;
diff --git a/src/render/jobs/expandboundingvolumejob.cpp b/src/render/jobs/expandboundingvolumejob.cpp
index ec175f312..d63934b54 100644
--- a/src/render/jobs/expandboundingvolumejob.cpp
+++ b/src/render/jobs/expandboundingvolumejob.cpp
@@ -44,6 +44,8 @@
#include <Qt3DRender/private/renderlogging_p.h>
#include <Qt3DRender/private/sphere_p.h>
#include <Qt3DRender/private/job_common_p.h>
+#include <Qt3DRender/private/managers_p.h>
+#include <Qt3DRender/private/nodemanagers_p.h>
#include <QThread>
@@ -54,19 +56,25 @@ namespace Render {
namespace {
-void expandWorldBoundingVolume(Qt3DRender::Render::Entity *node)
+void expandWorldBoundingVolume(NodeManagers *manager, Entity *node)
{
// Go to the nodes that have the most depth
- const auto children = node->children();
- for (Entity *c : children)
- expandWorldBoundingVolume(c);
+ const auto childrenHandles = node->childrenHandles();
+ for (const HEntity &handle : childrenHandles) {
+ Entity *c = manager->renderNodesManager()->data(handle);
+ if (c)
+ expandWorldBoundingVolume(manager, c);
+ }
// Then traverse back from leaf to root
// Initialize parent bounding volume to be equal to that of the first child
- if (!children.empty()) {
+ if (!childrenHandles.empty()) {
Qt3DRender::Render::Sphere *parentBoundingVolume = node->worldBoundingVolumeWithChildren();
- for (Entity *c : children)
- parentBoundingVolume->expandToContain(*c->worldBoundingVolumeWithChildren());
+ for (const HEntity &handle : childrenHandles) {
+ Entity *c = manager->renderNodesManager()->data(handle);
+ if (c)
+ parentBoundingVolume->expandToContain(*c->worldBoundingVolumeWithChildren());
+ }
}
}
@@ -74,6 +82,7 @@ void expandWorldBoundingVolume(Qt3DRender::Render::Entity *node)
ExpandBoundingVolumeJob::ExpandBoundingVolumeJob()
: m_node(nullptr)
+ , m_manager(nullptr)
{
SET_JOB_RUN_STAT_TYPE(this, JobTypes::ExpandBoundingVolume, 0);
}
@@ -83,6 +92,11 @@ void ExpandBoundingVolumeJob::setRoot(Entity *root)
m_node = root;
}
+void ExpandBoundingVolumeJob::setManagers(NodeManagers *manager)
+{
+ m_manager = manager;
+}
+
void ExpandBoundingVolumeJob::run()
{
// Expand worldBoundingVolumeWithChildren of each node that has children by the
@@ -90,7 +104,7 @@ void ExpandBoundingVolumeJob::run()
// TODO: Implement this using a parallel_for
qCDebug(Jobs) << "Entering" << Q_FUNC_INFO << QThread::currentThread();
- expandWorldBoundingVolume(m_node);
+ expandWorldBoundingVolume(m_manager, m_node);
qCDebug(Jobs) << "Exiting" << Q_FUNC_INFO << QThread::currentThread();
}
diff --git a/src/render/jobs/expandboundingvolumejob_p.h b/src/render/jobs/expandboundingvolumejob_p.h
index f468cf816..a2745b456 100644
--- a/src/render/jobs/expandboundingvolumejob_p.h
+++ b/src/render/jobs/expandboundingvolumejob_p.h
@@ -62,17 +62,20 @@ namespace Qt3DRender {
namespace Render {
class Entity;
+class NodeManagers;
-class QT3DRENDERSHARED_PRIVATE_EXPORT ExpandBoundingVolumeJob : public Qt3DCore::QAspectJob
+class Q_3DRENDERSHARED_PRIVATE_EXPORT ExpandBoundingVolumeJob : public Qt3DCore::QAspectJob
{
public:
ExpandBoundingVolumeJob();
void setRoot(Entity *root);
+ void setManagers(NodeManagers *manager);
void run() override;
private:
Entity *m_node;
+ NodeManagers *m_manager;
};
typedef QSharedPointer<ExpandBoundingVolumeJob> ExpandBoundingVolumeJobPtr;
diff --git a/src/render/jobs/filterlayerentityjob_p.h b/src/render/jobs/filterlayerentityjob_p.h
index 418f3ff3a..33023775f 100644
--- a/src/render/jobs/filterlayerentityjob_p.h
+++ b/src/render/jobs/filterlayerentityjob_p.h
@@ -65,7 +65,7 @@ namespace Render {
class Entity;
class NodeManagers;
-class QT3DRENDERSHARED_PRIVATE_EXPORT FilterLayerEntityJob : public Qt3DCore::QAspectJob
+class Q_3DRENDERSHARED_PRIVATE_EXPORT FilterLayerEntityJob : public Qt3DCore::QAspectJob
{
public:
FilterLayerEntityJob();
diff --git a/src/render/jobs/framecleanupjob.cpp b/src/render/jobs/framecleanupjob.cpp
index d0496f991..ed01e73b4 100644
--- a/src/render/jobs/framecleanupjob.cpp
+++ b/src/render/jobs/framecleanupjob.cpp
@@ -81,22 +81,20 @@ void FrameCleanupJob::updateBoundingVolumesDebug(Entity *node)
{
Q_UNUSED(node);
#if 0
- BoundingVolumeDebug *debugBV = node->renderComponent<BoundingVolumeDebug>();
- if (debugBV) {
- Qt3DRender::Render::Sphere s;
- if (!debugBV->isRecursive()) {
- s = *node->worldBoundingVolume();
- } else {
- s = *node->worldBoundingVolumeWithChildren();
+ node->traverse([](Entity *node) {
+ BoundingVolumeDebug *debugBV = node->renderComponent<BoundingVolumeDebug>();
+ if (debugBV) {
+ Qt3DRender::Render::Sphere s;
+ if (!debugBV->isRecursive()) {
+ s = *node->worldBoundingVolume();
+ } else {
+ s = *node->worldBoundingVolumeWithChildren();
+ }
+ debugBV->setRadius(s.radius());
+ debugBV->setCenter(s.center());
}
- debugBV->setRadius(s.radius());
- debugBV->setCenter(s.center());
- }
+ });
-
- const auto children = node->children();
- for (Entity *c : children)
- updateBoundingVolumesDebug(c);
#endif
}
diff --git a/src/render/jobs/framecleanupjob_p.h b/src/render/jobs/framecleanupjob_p.h
index e3700fedc..78938a8cf 100644
--- a/src/render/jobs/framecleanupjob_p.h
+++ b/src/render/jobs/framecleanupjob_p.h
@@ -64,7 +64,7 @@ namespace Render {
class NodeManagers;
class Entity;
-class QT3DRENDERSHARED_PRIVATE_EXPORT FrameCleanupJob : public Qt3DCore::QAspectJob
+class Q_3DRENDERSHARED_PRIVATE_EXPORT FrameCleanupJob : public Qt3DCore::QAspectJob
{
public:
explicit FrameCleanupJob();
diff --git a/src/render/jobs/frustumcullingjob.cpp b/src/render/jobs/frustumcullingjob.cpp
index 1a03b691d..0922fb0cb 100644
--- a/src/render/jobs/frustumcullingjob.cpp
+++ b/src/render/jobs/frustumcullingjob.cpp
@@ -43,6 +43,8 @@
#include <Qt3DRender/private/entity_p.h>
#include <Qt3DRender/private/renderview_p.h>
#include <Qt3DRender/private/sphere_p.h>
+#include <Qt3DRender/private/managers_p.h>
+#include <Qt3DRender/private/nodemanagers_p.h>
QT_BEGIN_NAMESPACE
@@ -53,6 +55,7 @@ namespace Render {
FrustumCullingJob::FrustumCullingJob()
: Qt3DCore::QAspectJob()
, m_root(nullptr)
+ , m_manager(nullptr)
, m_active(false)
{
SET_JOB_RUN_STAT_TYPE(this, JobTypes::FrustumCulling, 0);
@@ -83,27 +86,25 @@ void FrustumCullingJob::run()
void FrustumCullingJob::cullScene(Entity *e, const Plane *planes)
{
- const Sphere *s = e->worldBoundingVolumeWithChildren();
-
- // Unrolled loop
- if (Vector3D::dotProduct(s->center(), planes[0].normal) + planes[0].d < -s->radius())
- return;
- if (Vector3D::dotProduct(s->center(), planes[1].normal) + planes[1].d < -s->radius())
- return;
- if (Vector3D::dotProduct(s->center(), planes[2].normal) + planes[2].d < -s->radius())
- return;
- if (Vector3D::dotProduct(s->center(), planes[3].normal) + planes[3].d < -s->radius())
- return;
- if (Vector3D::dotProduct(s->center(), planes[4].normal) + planes[4].d < -s->radius())
- return;
- if (Vector3D::dotProduct(s->center(), planes[5].normal) + planes[5].d < -s->radius())
- return;
-
- m_visibleEntities.push_back(e);
-
- const QVector<Entity *> children = e->children();
- for (Entity *c : children)
- cullScene(c, planes);
+ e->traverse([planes, this](Entity *e) {
+ const Sphere *s = e->worldBoundingVolumeWithChildren();
+
+ // Unrolled loop
+ if (Vector3D::dotProduct(s->center(), planes[0].normal) + planes[0].d < -s->radius())
+ return;
+ if (Vector3D::dotProduct(s->center(), planes[1].normal) + planes[1].d < -s->radius())
+ return;
+ if (Vector3D::dotProduct(s->center(), planes[2].normal) + planes[2].d < -s->radius())
+ return;
+ if (Vector3D::dotProduct(s->center(), planes[3].normal) + planes[3].d < -s->radius())
+ return;
+ if (Vector3D::dotProduct(s->center(), planes[4].normal) + planes[4].d < -s->radius())
+ return;
+ if (Vector3D::dotProduct(s->center(), planes[5].normal) + planes[5].d < -s->radius())
+ return;
+
+ m_visibleEntities.push_back(e);
+ });
}
} // Render
diff --git a/src/render/jobs/frustumcullingjob_p.h b/src/render/jobs/frustumcullingjob_p.h
index f81e4c5b9..cddbbd409 100644
--- a/src/render/jobs/frustumcullingjob_p.h
+++ b/src/render/jobs/frustumcullingjob_p.h
@@ -63,6 +63,7 @@ namespace Render {
class Entity;
class EntityManager;
+class NodeManagers;
struct Plane;
class FrustumCullingJob : public Qt3DCore::QAspectJob
@@ -73,6 +74,7 @@ public:
QT3D_ALIGNED_MALLOC_AND_FREE()
inline void setRoot(Entity *root) Q_DECL_NOTHROW { m_root = root; }
+ inline void setManagers(NodeManagers *manager) Q_DECL_NOTHROW { m_manager = manager; }
inline void setActive(bool active) Q_DECL_NOTHROW { m_active = active; }
inline bool isActive() const Q_DECL_NOTHROW { return m_active; }
inline void setViewProjection(const Matrix4x4 &viewProjection) Q_DECL_NOTHROW { m_viewProjection = viewProjection; }
@@ -86,6 +88,7 @@ private:
void cullScene(Entity *e, const Plane *planes);
Matrix4x4 m_viewProjection;
Entity *m_root;
+ NodeManagers *m_manager;
QVector<Entity *> m_visibleEntities;
bool m_active;
};
diff --git a/src/render/jobs/job_common_p.h b/src/render/jobs/job_common_p.h
index 8f8242ec8..99bf99195 100644
--- a/src/render/jobs/job_common_p.h
+++ b/src/render/jobs/job_common_p.h
@@ -107,8 +107,9 @@ namespace JobTypes {
SyncFilterEntityByLayer,
SyncMaterialGatherer,
UpdateLayerEntity,
+ SendTextureChangesToFrontend,
+ SendSetFenceHandlesToFrontend,
UpdateEntityHierarchy,
- SendTextureChangesToFrontend
};
} // JobTypes
diff --git a/src/render/jobs/pickboundingvolumejob.cpp b/src/render/jobs/pickboundingvolumejob.cpp
index 2050b8772..96ec11b4e 100644
--- a/src/render/jobs/pickboundingvolumejob.cpp
+++ b/src/render/jobs/pickboundingvolumejob.cpp
@@ -211,7 +211,6 @@ bool PickBoundingVolumeJob::runHelper()
const bool edgePickingRequested = (m_renderSettings->pickMethod() & QPickingSettings::LinePicking);
const bool pointPickingRequested = (m_renderSettings->pickMethod() & QPickingSettings::PointPicking);
const bool primitivePickingRequested = pointPickingRequested | edgePickingRequested | trianglePickingRequested;
- const bool allHitsRequested = (m_renderSettings->pickResultMode() == QPickingSettings::AllPicks);
const bool frontFaceRequested =
m_renderSettings->faceOrientationPickingMode() != QPickingSettings::BackFace;
const bool backFaceRequested =
@@ -237,7 +236,7 @@ bool PickBoundingVolumeJob::runHelper()
// has moved out of the viewport In case of a button released
// outside of the viewport, we still want to notify the
// lastCurrent entity about this.
- dispatchPickEvents(event.second, PickingUtils::HitList(), eventButton, eventButtons, eventModifiers, allHitsRequested);
+ dispatchPickEvents(event.second, PickingUtils::HitList(), eventButton, eventButtons, eventModifiers, m_renderSettings->pickResultMode());
continue;
}
@@ -249,14 +248,16 @@ bool PickBoundingVolumeJob::runHelper()
gathererFunctor.m_backFaceRequested = backFaceRequested;
gathererFunctor.m_manager = m_manager;
gathererFunctor.m_ray = ray;
- sphereHits << gathererFunctor.computeHits(entityPicker.entities(), allHitsRequested);
+ gathererFunctor.m_entityToPriorityTable = entityPicker.entityToPriorityTable();
+ sphereHits << gathererFunctor.computeHits(entityPicker.entities(), m_renderSettings->pickResultMode());
}
if (edgePickingRequested) {
PickingUtils::LineCollisionGathererFunctor gathererFunctor;
gathererFunctor.m_manager = m_manager;
gathererFunctor.m_ray = ray;
gathererFunctor.m_pickWorldSpaceTolerance = pickWorldSpaceTolerance;
- sphereHits << gathererFunctor.computeHits(entityPicker.entities(), allHitsRequested);
+ gathererFunctor.m_entityToPriorityTable = entityPicker.entityToPriorityTable();
+ sphereHits << gathererFunctor.computeHits(entityPicker.entities(), m_renderSettings->pickResultMode());
PickingUtils::AbstractCollisionGathererFunctor::sortHits(sphereHits);
}
if (pointPickingRequested) {
@@ -264,19 +265,20 @@ bool PickBoundingVolumeJob::runHelper()
gathererFunctor.m_manager = m_manager;
gathererFunctor.m_ray = ray;
gathererFunctor.m_pickWorldSpaceTolerance = pickWorldSpaceTolerance;
- sphereHits << gathererFunctor.computeHits(entityPicker.entities(), allHitsRequested);
+ gathererFunctor.m_entityToPriorityTable = entityPicker.entityToPriorityTable();
+ sphereHits << gathererFunctor.computeHits(entityPicker.entities(), m_renderSettings->pickResultMode());
PickingUtils::AbstractCollisionGathererFunctor::sortHits(sphereHits);
}
if (!primitivePickingRequested) {
sphereHits << entityPicker.hits();
PickingUtils::AbstractCollisionGathererFunctor::sortHits(sphereHits);
- if (!allHitsRequested)
+ if (m_renderSettings->pickResultMode() != QPickingSettings::AllPicks)
sphereHits = { sphereHits.front() };
}
}
// Dispatch events based on hit results
- dispatchPickEvents(event.second, sphereHits, eventButton, eventButtons, eventModifiers, allHitsRequested);
+ dispatchPickEvents(event.second, sphereHits, eventButton, eventButtons, eventModifiers, m_renderSettings->pickResultMode());
}
}
diff --git a/src/render/jobs/pickboundingvolumeutils.cpp b/src/render/jobs/pickboundingvolumeutils.cpp
index 5fed946d6..abc54482a 100644
--- a/src/render/jobs/pickboundingvolumeutils.cpp
+++ b/src/render/jobs/pickboundingvolumeutils.cpp
@@ -55,6 +55,7 @@
#include <vector>
#include <algorithm>
+#include <functional>
QT_BEGIN_NAMESPACE
@@ -134,34 +135,6 @@ bool ViewportCameraAreaGatherer::isUnique(const QVector<ViewportCameraAreaDetail
return true;
}
-QVector<Entity *> gatherEntities(Entity *entity, QVector<Entity *> entities)
-{
- if (entity != nullptr && entity->isEnabled()) {
- entities.push_back(entity);
- // Traverse children
- const auto children = entity->children();
- for (Entity *child : children)
- entities = gatherEntities(child, std::move(entities));
- }
- return entities;
-}
-
-EntityGatherer::EntityGatherer(Entity *root)
- : m_root(root)
- , m_needsRefresh(true)
-{
-}
-
-QVector<Entity *> EntityGatherer::entities() const
-{
- if (m_needsRefresh) {
- m_entities.clear();
- m_entities = gatherEntities(m_root, std::move(m_entities));
- m_needsRefresh = false;
- }
- return m_entities;
-}
-
class TriangleCollisionVisitor : public TrianglesVisitor
{
public:
@@ -418,6 +391,46 @@ HitList reduceToFirstHit(HitList &result, const HitList &intermediate)
return result;
}
+
+struct HighestPriorityHitReducer
+{
+ // No need to protect this from concurrent access as the table
+ // is read only
+ const QHash<Qt3DCore::QNodeId, int> entityToPriorityTable;
+
+ HitList operator()(HitList &result, const HitList &intermediate)
+ {
+ // Sort by priority first
+ // If we have equal priorities, we then sort by distance
+
+ if (!intermediate.empty()) {
+ if (result.empty())
+ result.push_back(intermediate.front());
+ int currentPriority = entityToPriorityTable.value(result.front().m_entityId, 0);
+ float closest = result.front().m_distance;
+
+ for (const auto &v : intermediate) {
+ const int newEntryPriority = entityToPriorityTable.value(v.m_entityId, 0);
+ if (newEntryPriority > currentPriority) {
+ result.push_front(v);
+ currentPriority = newEntryPriority;
+ closest = v.m_distance;
+ } else if (newEntryPriority == currentPriority) {
+ if (v.m_distance < closest) {
+ result.push_front(v);
+ closest = v.m_distance;
+ currentPriority = newEntryPriority;
+ }
+ }
+ }
+
+ while (result.size() > 1)
+ result.pop_back();
+ }
+ return result;
+ }
+};
+
HitList reduceToAllHits(HitList &results, const HitList &intermediate)
{
if (!intermediate.empty())
@@ -492,9 +505,22 @@ struct MapFunctorHolder
} // anonymous
-HitList EntityCollisionGathererFunctor::computeHits(const QVector<Entity *> &entities, bool allHitsRequested)
-{
- const auto reducerOp = allHitsRequested ? PickingUtils::reduceToAllHits : PickingUtils::reduceToFirstHit;
+HitList EntityCollisionGathererFunctor::computeHits(const QVector<Entity *> &entities,
+ Qt3DRender::QPickingSettings::PickResultMode mode)
+{
+ std::function<HitList (HitList &, const HitList &)> reducerOp;
+ switch (mode) {
+ case QPickingSettings::AllPicks:
+ reducerOp = PickingUtils::reduceToAllHits;
+ break;
+ case QPickingSettings::NearestPriorityPick:
+ reducerOp = HighestPriorityHitReducer{ m_entityToPriorityTable };
+ break;
+ case QPickingSettings::NearestPick:
+ reducerOp = PickingUtils::reduceToFirstHit;
+ break;
+ }
+
const MapFunctorHolder holder(this);
#if QT_CONFIG(concurrent)
return QtConcurrent::blockingMappedReduced<HitList>(entities, holder, reducerOp);
@@ -519,9 +545,22 @@ HitList EntityCollisionGathererFunctor::pick(const Entity *entity) const
return result;
}
-HitList TriangleCollisionGathererFunctor::computeHits(const QVector<Entity *> &entities, bool allHitsRequested)
-{
- const auto reducerOp = allHitsRequested ? PickingUtils::reduceToAllHits : PickingUtils::reduceToFirstHit;
+HitList TriangleCollisionGathererFunctor::computeHits(const QVector<Entity *> &entities,
+ Qt3DRender::QPickingSettings::PickResultMode mode)
+{
+ std::function<HitList (HitList &, const HitList &)> reducerOp;
+ switch (mode) {
+ case QPickingSettings::AllPicks:
+ reducerOp = PickingUtils::reduceToAllHits;
+ break;
+ case QPickingSettings::NearestPriorityPick:
+ reducerOp = HighestPriorityHitReducer { m_entityToPriorityTable };
+ break;
+ case QPickingSettings::NearestPick:
+ reducerOp = PickingUtils::reduceToFirstHit;
+ break;
+ }
+
const MapFunctorHolder holder(this);
#if QT_CONFIG(concurrent)
return QtConcurrent::blockingMappedReduced<HitList>(entities, holder, reducerOp);
@@ -553,9 +592,22 @@ HitList TriangleCollisionGathererFunctor::pick(const Entity *entity) const
return result;
}
-HitList LineCollisionGathererFunctor::computeHits(const QVector<Entity *> &entities, bool allHitsRequested)
-{
- const auto reducerOp = allHitsRequested ? PickingUtils::reduceToAllHits : PickingUtils::reduceToFirstHit;
+HitList LineCollisionGathererFunctor::computeHits(const QVector<Entity *> &entities,
+ Qt3DRender::QPickingSettings::PickResultMode mode)
+{
+ std::function<HitList (HitList &, const HitList &)> reducerOp;
+ switch (mode) {
+ case QPickingSettings::AllPicks:
+ reducerOp = PickingUtils::reduceToAllHits;
+ break;
+ case QPickingSettings::NearestPriorityPick:
+ reducerOp = HighestPriorityHitReducer { m_entityToPriorityTable };
+ break;
+ case QPickingSettings::NearestPick:
+ reducerOp = PickingUtils::reduceToFirstHit;
+ break;
+ }
+
const MapFunctorHolder holder(this);
#if QT_CONFIG(concurrent)
return QtConcurrent::blockingMappedReduced<HitList>(entities, holder, reducerOp);
@@ -586,9 +638,22 @@ HitList LineCollisionGathererFunctor::pick(const Entity *entity) const
return result;
}
-HitList PointCollisionGathererFunctor::computeHits(const QVector<Entity *> &entities, bool allHitsRequested)
-{
- const auto reducerOp = allHitsRequested ? PickingUtils::reduceToAllHits : PickingUtils::reduceToFirstHit;
+HitList PointCollisionGathererFunctor::computeHits(const QVector<Entity *> &entities,
+ Qt3DRender::QPickingSettings::PickResultMode mode)
+{
+ std::function<HitList (HitList &, const HitList &)> reducerOp;
+ switch (mode) {
+ case QPickingSettings::AllPicks:
+ reducerOp = PickingUtils::reduceToAllHits;
+ break;
+ case QPickingSettings::NearestPriorityPick:
+ reducerOp = HighestPriorityHitReducer { m_entityToPriorityTable };
+ break;
+ case QPickingSettings::NearestPick:
+ reducerOp = PickingUtils::reduceToFirstHit;
+ break;
+ }
+
const MapFunctorHolder holder(this);
#if QT_CONFIG(concurrent)
return QtConcurrent::blockingMappedReduced<HitList>(entities, holder, reducerOp);
@@ -641,15 +706,17 @@ bool HierarchicalEntityPicker::collectHits(NodeManagers *manager, Entity *root)
{
m_hits.clear();
m_entities.clear();
+ m_entityToPriorityTable.clear();
QRayCastingService rayCasting;
struct EntityData {
Entity* entity;
bool hasObjectPicker;
Qt3DCore::QNodeIdVector recursiveLayers;
+ int priority;
};
std::vector<EntityData> worklist;
- worklist.push_back({root, !root->componentHandle<ObjectPicker>().isNull(), {}});
+ worklist.push_back({root, !root->componentHandle<ObjectPicker>().isNull(), {}, 0});
LayerManager *layerManager = manager->layerManager();
@@ -710,6 +777,8 @@ bool HierarchicalEntityPicker::collectHits(NodeManagers *manager, Entity *root)
if (accepted && queryResult.m_distance >= 0.f && (current.hasObjectPicker || !m_objectPickersRequired)) {
m_entities.push_back(current.entity);
m_hits.push_back(queryResult);
+ // Record entry for entity/priority
+ m_entityToPriorityTable.insert(current.entity->peerId(), current.priority);
}
Qt3DCore::QNodeIdVector recursiveLayers;
@@ -721,10 +790,16 @@ bool HierarchicalEntityPicker::collectHits(NodeManagers *manager, Entity *root)
}
// and pick children
- const auto children = current.entity->children();
- for (auto child: children)
- worklist.push_back({child, current.hasObjectPicker || !child->componentHandle<ObjectPicker>().isNull(),
- current.recursiveLayers + recursiveLayers});
+ const auto childrenHandles = current.entity->childrenHandles();
+ for (const HEntity &handle : childrenHandles) {
+ Entity *child = manager->renderNodesManager()->data(handle);
+ if (child) {
+ ObjectPicker *childPicker = child->renderComponent<ObjectPicker>();
+ worklist.push_back({child, current.hasObjectPicker || childPicker,
+ current.recursiveLayers + recursiveLayers,
+ (childPicker ? childPicker->priority() : current.priority)});
+ }
+ }
}
return !m_hits.empty();
diff --git a/src/render/jobs/pickboundingvolumeutils_p.h b/src/render/jobs/pickboundingvolumeutils_p.h
index 780c16cc8..923a49317 100644
--- a/src/render/jobs/pickboundingvolumeutils_p.h
+++ b/src/render/jobs/pickboundingvolumeutils_p.h
@@ -55,6 +55,7 @@
#include <Qt3DRender/QAbstractRayCaster>
#include <Qt3DRender/private/qray3d_p.h>
#include <Qt3DRender/private/qraycastingservice_p.h>
+#include <Qt3DRender/qpickingsettings.h>
QT_BEGIN_NAMESPACE
@@ -99,19 +100,6 @@ private:
bool isUnique(const QVector<ViewportCameraAreaDetails> &vcaList, const ViewportCameraAreaDetails &vca) const;
};
-class Q_AUTOTEST_EXPORT EntityGatherer
-{
-public:
- explicit EntityGatherer(Entity *root);
-
- QVector<Entity *> entities() const;
-
-private:
- Entity *m_root;
- mutable QVector<Entity *> m_entities;
- mutable bool m_needsRefresh;
-};
-
typedef QVector<RayCasting::QCollisionQueryResult::Hit> HitList;
class Q_AUTOTEST_EXPORT HierarchicalEntityPicker
@@ -124,6 +112,7 @@ public:
bool collectHits(NodeManagers *manager, Entity *root);
inline HitList hits() const { return m_hits; }
inline QVector<Entity *> entities() const { return m_entities; }
+ inline QHash<Qt3DCore::QNodeId, int> entityToPriorityTable() const { return m_entityToPriorityTable; }
private:
RayCasting::QRay3D m_ray;
@@ -132,6 +121,7 @@ private:
bool m_objectPickersRequired;
Qt3DCore::QNodeIdVector m_layerIds;
QAbstractRayCaster::FilterMode m_filterMode;
+ QHash<Qt3DCore::QNodeId, int> m_entityToPriorityTable;
};
struct Q_AUTOTEST_EXPORT AbstractCollisionGathererFunctor
@@ -142,8 +132,9 @@ struct Q_AUTOTEST_EXPORT AbstractCollisionGathererFunctor
bool m_objectPickersRequired = true;
NodeManagers *m_manager = nullptr;
RayCasting::QRay3D m_ray;
+ QHash<Qt3DCore::QNodeId, int> m_entityToPriorityTable;
- virtual HitList computeHits(const QVector<Entity *> &entities, bool allHitsRequested) = 0;
+ virtual HitList computeHits(const QVector<Entity *> &entities, Qt3DRender::QPickingSettings::PickResultMode mode) = 0;
// This define is required to work with QtConcurrent
typedef HitList result_type;
@@ -156,7 +147,7 @@ struct Q_AUTOTEST_EXPORT AbstractCollisionGathererFunctor
struct Q_AUTOTEST_EXPORT EntityCollisionGathererFunctor : public AbstractCollisionGathererFunctor
{
- HitList computeHits(const QVector<Entity *> &entities, bool allHitsRequested) override;
+ HitList computeHits(const QVector<Entity *> &entities, Qt3DRender::QPickingSettings::PickResultMode mode) override;
HitList pick(const Entity *entity) const override;
};
@@ -165,7 +156,7 @@ struct Q_AUTOTEST_EXPORT TriangleCollisionGathererFunctor : public AbstractColli
bool m_frontFaceRequested;
bool m_backFaceRequested;
- HitList computeHits(const QVector<Entity *> &entities, bool allHitsRequested) override;
+ HitList computeHits(const QVector<Entity *> &entities, Qt3DRender::QPickingSettings::PickResultMode mode) override;
HitList pick(const Entity *entity) const override;
};
@@ -173,7 +164,7 @@ struct Q_AUTOTEST_EXPORT LineCollisionGathererFunctor : public AbstractCollision
{
float m_pickWorldSpaceTolerance;
- HitList computeHits(const QVector<Entity *> &entities, bool allHitsRequested) override;
+ HitList computeHits(const QVector<Entity *> &entities, Qt3DRender::QPickingSettings::PickResultMode mode) override;
HitList pick(const Entity *entity) const override;
};
@@ -181,7 +172,7 @@ struct Q_AUTOTEST_EXPORT PointCollisionGathererFunctor : public AbstractCollisio
{
float m_pickWorldSpaceTolerance;
- HitList computeHits(const QVector<Entity *> &entities, bool allHitsRequested) override;
+ HitList computeHits(const QVector<Entity *> &entities, Qt3DRender::QPickingSettings::PickResultMode mode) override;
HitList pick(const Entity *entity) const override;
};
diff --git a/src/render/jobs/raycastingjob.cpp b/src/render/jobs/raycastingjob.cpp
index 7d3af34cc..f3571c210 100644
--- a/src/render/jobs/raycastingjob.cpp
+++ b/src/render/jobs/raycastingjob.cpp
@@ -50,6 +50,7 @@
#include <Qt3DRender/private/renderer_p.h>
#include <Qt3DRender/private/rendersettings_p.h>
#include <Qt3DRender/private/trianglesvisitor_p.h>
+#include <Qt3DRender/private/entityvisitor_p.h>
QT_BEGIN_NAMESPACE
@@ -59,43 +60,23 @@ using namespace Render;
namespace {
-class EntityCasterGatherer
+class EntityCasterGatherer : public EntityVisitor
{
public:
using EntityCasterList = QVector<QPair<Entity *, RayCaster*>>;
+ EntityCasterList m_result;
- explicit EntityCasterGatherer(Entity *root) : m_root(root), m_needsRefresh(true) { }
+ explicit EntityCasterGatherer(NodeManagers *manager) : EntityVisitor(manager) { setPruneDisabled(true); }
- EntityCasterList result() const {
- if (m_needsRefresh) {
- m_result.clear();
- m_result = gatherEntities(m_root, std::move(m_result));
- m_needsRefresh = false;
+ Operation visit(Entity *entity) override {
+ QVector<RayCaster *> components = entity->renderComponents<RayCaster>();
+ for (const auto c: qAsConst(components)) {
+ if (c->isEnabled())
+ m_result.push_back(qMakePair(entity, c));
}
- return m_result;
- }
-
-private:
- EntityCasterList gatherEntities(Entity *entity, EntityCasterList entities) const
- {
- if (entity != nullptr && entity->isEnabled()) {
- QVector<RayCaster *> components = entity->renderComponents<RayCaster>();
- for (const auto c: qAsConst(components)) {
- if (c->isEnabled())
- entities.push_back(qMakePair(entity, c));
- }
- // Traverse children
- const auto children = entity->children();
- for (Entity *child : children)
- entities = gatherEntities(child, std::move(entities));
- }
- return entities;
+ return Continue;
}
-
- Entity *m_root;
- mutable EntityCasterList m_result;
- mutable bool m_needsRefresh;
};
} // anonymous
@@ -145,8 +126,9 @@ bool RayCastingJob::runHelper()
m_renderSettings->faceOrientationPickingMode() != QPickingSettings::FrontFace;
const float pickWorldSpaceTolerance = m_renderSettings->pickWorldSpaceTolerance();
- EntityCasterGatherer gatherer(m_node);
- const EntityCasterGatherer::EntityCasterList &entities = gatherer.result();
+ EntityCasterGatherer gatherer(m_manager);
+ gatherer.apply(m_node);
+ const EntityCasterGatherer::EntityCasterList &entities = gatherer.m_result;
PickingUtils::ViewportCameraAreaGatherer vcaGatherer;
const QVector<PickingUtils::ViewportCameraAreaDetails> vcaDetails = vcaGatherer.gather(m_frameGraphRoot);
@@ -186,7 +168,7 @@ bool RayCastingJob::runHelper()
gathererFunctor.m_manager = m_manager;
gathererFunctor.m_ray = ray;
gathererFunctor.m_objectPickersRequired = false;
- sphereHits << gathererFunctor.computeHits(entityPicker.entities(), true);
+ sphereHits << gathererFunctor.computeHits(entityPicker.entities(), QPickingSettings::AllPicks);
}
if (edgePickingRequested) {
PickingUtils::LineCollisionGathererFunctor gathererFunctor;
@@ -194,7 +176,7 @@ bool RayCastingJob::runHelper()
gathererFunctor.m_ray = ray;
gathererFunctor.m_pickWorldSpaceTolerance = pickWorldSpaceTolerance;
gathererFunctor.m_objectPickersRequired = false;
- sphereHits << gathererFunctor.computeHits(entityPicker.entities(), true);
+ sphereHits << gathererFunctor.computeHits(entityPicker.entities(), QPickingSettings::AllPicks);
PickingUtils::AbstractCollisionGathererFunctor::sortHits(sphereHits);
}
if (pointPickingRequested) {
@@ -203,7 +185,7 @@ bool RayCastingJob::runHelper()
gathererFunctor.m_ray = ray;
gathererFunctor.m_pickWorldSpaceTolerance = pickWorldSpaceTolerance;
gathererFunctor.m_objectPickersRequired = false;
- sphereHits << gathererFunctor.computeHits(entityPicker.entities(), true);
+ sphereHits << gathererFunctor.computeHits(entityPicker.entities(), QPickingSettings::AllPicks);
PickingUtils::AbstractCollisionGathererFunctor::sortHits(sphereHits);
}
if (!primitivePickingRequested) {
diff --git a/src/render/jobs/sendbuffercapturejob.cpp b/src/render/jobs/sendbuffercapturejob.cpp
index eae26ba6c..8683ea9f2 100644
--- a/src/render/jobs/sendbuffercapturejob.cpp
+++ b/src/render/jobs/sendbuffercapturejob.cpp
@@ -67,6 +67,12 @@ void SendBufferCaptureJob::addRequest(QPair<Buffer *, QByteArray> request)
m_pendingSendBufferCaptures.push_back(request);
}
+// Called by aspect thread jobs to execute (no concurrency at that point)
+bool SendBufferCaptureJob::hasRequests() const
+{
+ return m_pendingSendBufferCaptures.size() > 0;
+}
+
void SendBufferCaptureJob::run()
{
QMutexLocker locker(&m_mutex);
diff --git a/src/render/jobs/sendbuffercapturejob_p.h b/src/render/jobs/sendbuffercapturejob_p.h
index 771497e2f..f47c556df 100644
--- a/src/render/jobs/sendbuffercapturejob_p.h
+++ b/src/render/jobs/sendbuffercapturejob_p.h
@@ -68,13 +68,14 @@ class Entity;
class Renderer;
class Buffer;
-class QT3DRENDERSHARED_PRIVATE_EXPORT SendBufferCaptureJob : public Qt3DCore::QAspectJob
+class Q_3DRENDERSHARED_PRIVATE_EXPORT SendBufferCaptureJob : public Qt3DCore::QAspectJob
{
public:
explicit SendBufferCaptureJob();
~SendBufferCaptureJob();
void addRequest(QPair<Buffer*, QByteArray> request);
+ bool hasRequests() const;
void run() final;
diff --git a/src/render/jobs/sendrendercapturejob_p.h b/src/render/jobs/sendrendercapturejob_p.h
index 53b111ba6..8bc1e2fb0 100644
--- a/src/render/jobs/sendrendercapturejob_p.h
+++ b/src/render/jobs/sendrendercapturejob_p.h
@@ -63,7 +63,7 @@ namespace Render {
class NodeManagers;
class Entity;
-class QT3DRENDERSHARED_PRIVATE_EXPORT SendRenderCaptureJob : public Qt3DCore::QAspectJob
+class Q_3DRENDERSHARED_PRIVATE_EXPORT SendRenderCaptureJob : public Qt3DCore::QAspectJob
{
public:
SendRenderCaptureJob();
diff --git a/src/render/jobs/updateentityhierarchyjob_p.h b/src/render/jobs/updateentityhierarchyjob_p.h
index f6ba2d584..fd2b13631 100644
--- a/src/render/jobs/updateentityhierarchyjob_p.h
+++ b/src/render/jobs/updateentityhierarchyjob_p.h
@@ -64,7 +64,7 @@ namespace Render {
class Entity;
class NodeManagers;
-class QT3DRENDERSHARED_PRIVATE_EXPORT UpdateEntityHierarchyJob: public Qt3DCore::QAspectJob
+class Q_3DRENDERSHARED_PRIVATE_EXPORT UpdateEntityHierarchyJob: public Qt3DCore::QAspectJob
{
public:
UpdateEntityHierarchyJob();
diff --git a/src/render/jobs/updateentitylayersjob.cpp b/src/render/jobs/updateentitylayersjob.cpp
index 1fa34684f..2c5e38364 100644
--- a/src/render/jobs/updateentitylayersjob.cpp
+++ b/src/render/jobs/updateentitylayersjob.cpp
@@ -49,19 +49,6 @@ namespace Qt3DRender {
namespace Render {
-namespace {
-
-void addLayerIdToEntityChildren(const QVector<Entity *> &children,
- const Qt3DCore::QNodeId layerId)
-{
- for (Entity *child : children) {
- child->addRecursiveLayerId(layerId);
- addLayerIdToEntityChildren(child->children(), layerId);
- }
-}
-
-} // anonymous
-
UpdateEntityLayersJob::UpdateEntityLayersJob()
: m_manager(nullptr)
{
@@ -93,7 +80,9 @@ void UpdateEntityLayersJob::run()
Layer *layer = layerManager->lookupResource(layerId);
if (layer->recursive()) {
// Find all children of the entity and add the layers to them
- addLayerIdToEntityChildren(entity->children(), layerId);
+ entity->traverse([layerId](Entity *e) {
+ e->addRecursiveLayerId(layerId);
+ });
}
}
}
diff --git a/src/render/jobs/updateentitylayersjob_p.h b/src/render/jobs/updateentitylayersjob_p.h
index f2e63e32d..5d36042c4 100644
--- a/src/render/jobs/updateentitylayersjob_p.h
+++ b/src/render/jobs/updateentitylayersjob_p.h
@@ -65,7 +65,7 @@ class Entity;
class NodeManagers;
-class QT3DRENDERSHARED_PRIVATE_EXPORT UpdateEntityLayersJob: public Qt3DCore::QAspectJob
+class Q_3DRENDERSHARED_PRIVATE_EXPORT UpdateEntityLayersJob: public Qt3DCore::QAspectJob
{
public:
UpdateEntityLayersJob();
diff --git a/src/render/jobs/updatelevelofdetailjob.cpp b/src/render/jobs/updatelevelofdetailjob.cpp
index e4b651949..b5349a2c1 100644
--- a/src/render/jobs/updatelevelofdetailjob.cpp
+++ b/src/render/jobs/updatelevelofdetailjob.cpp
@@ -39,6 +39,7 @@
#include "updatelevelofdetailjob_p.h"
#include <Qt3DRender/QLevelOfDetail>
+#include <Qt3DRender/private/entityvisitor_p.h>
#include <Qt3DRender/private/job_common_p.h>
#include <Qt3DRender/private/nodemanagers_p.h>
#include <Qt3DRender/private/managers_p.h>
@@ -57,9 +58,145 @@ double approxRollingAverage(double avg, double input) {
return avg;
}
+class LODUpdateVisitor : public Qt3DRender::Render::EntityVisitor
+{
+public:
+ LODUpdateVisitor(double filterValue, Qt3DRender::Render::FrameGraphNode *frameGraphRoot, Qt3DRender::Render::NodeManagers *manager)
+ : Qt3DRender::Render::EntityVisitor(manager)
+ , m_filterValue(filterValue)
+ , m_frameGraphRoot(frameGraphRoot)
+ {
+ }
+
+ double filterValue() const { return m_filterValue; }
+
+ Operation visit(Qt3DRender::Render::Entity *entity = nullptr) override {
+ using namespace Qt3DRender;
+ using namespace Qt3DRender::Render;
+
+ if (!entity->isEnabled())
+ return Prune; // skip disabled sub-trees, since their bounding box is probably not valid anyway
+
+ QVector<LevelOfDetail *> lods = entity->renderComponents<LevelOfDetail>();
+ if (!lods.empty()) {
+ LevelOfDetail* lod = lods.front(); // other lods are ignored
+
+ if (lod->isEnabled() && !lod->thresholds().isEmpty()) {
+ switch (lod->thresholdType()) {
+ case QLevelOfDetail::DistanceToCameraThreshold:
+ updateEntityLodByDistance(entity, lod);
+ break;
+ case QLevelOfDetail::ProjectedScreenPixelSizeThreshold:
+ updateEntityLodByScreenArea(entity, lod);
+ break;
+ default:
+ Q_ASSERT(false);
+ break;
+ }
+ }
+ }
+
+ return Continue;
+ }
+
+private:
+ double m_filterValue = 0.;
+ Qt3DRender::Render::FrameGraphNode *m_frameGraphRoot;
+
+ void updateEntityLodByDistance(Qt3DRender::Render::Entity *entity, Qt3DRender::Render::LevelOfDetail *lod)
+ {
+ using namespace Qt3DRender;
+ using namespace Qt3DRender::Render;
+
+ Matrix4x4 viewMatrix;
+ Matrix4x4 projectionMatrix;
+ if (!Render::CameraLens::viewMatrixForCamera(m_manager->renderNodesManager(), lod->camera(), viewMatrix, projectionMatrix))
+ return;
+
+ const QVector<qreal> thresholds = lod->thresholds();
+ Vector3D center(lod->center());
+ if (lod->hasBoundingVolumeOverride() || entity->worldBoundingVolume() == nullptr) {
+ center = *entity->worldTransform() * center;
+ } else {
+ center = entity->worldBoundingVolume()->center();
+ }
+
+ const Vector3D tcenter = viewMatrix * center;
+ const float dist = tcenter.length();
+ const int n = thresholds.size();
+ for (int i=0; i<n; ++i) {
+ if (dist <= thresholds[i] || i == n -1) {
+ m_filterValue = approxRollingAverage<30>(m_filterValue, i);
+ i = qBound(0, static_cast<int>(qRound(m_filterValue)), n - 1);
+ if (lod->currentIndex() != i)
+ lod->setCurrentIndex(i);
+ break;
+ }
+ }
+ }
+
+ void updateEntityLodByScreenArea(Qt3DRender::Render::Entity *entity, Qt3DRender::Render::LevelOfDetail *lod)
+ {
+ using namespace Qt3DRender;
+ using namespace Qt3DRender::Render;
+
+ Matrix4x4 viewMatrix;
+ Matrix4x4 projectionMatrix;
+ if (!Render::CameraLens::viewMatrixForCamera(m_manager->renderNodesManager(), lod->camera(), viewMatrix, projectionMatrix))
+ return;
+
+ PickingUtils::ViewportCameraAreaGatherer vcaGatherer(lod->camera());
+ const QVector<PickingUtils::ViewportCameraAreaDetails> vcaTriplets = vcaGatherer.gather(m_frameGraphRoot);
+ if (vcaTriplets.isEmpty())
+ return;
+
+ const PickingUtils::ViewportCameraAreaDetails &vca = vcaTriplets.front();
+
+ const QVector<qreal> thresholds = lod->thresholds();
+ Sphere bv(Vector3D(lod->center()), lod->radius());
+ if (!lod->hasBoundingVolumeOverride() && entity->worldBoundingVolume() != nullptr) {
+ bv = *(entity->worldBoundingVolume());
+ } else {
+ bv.transform(*entity->worldTransform());
+ }
+
+ bv.transform(projectionMatrix * viewMatrix);
+ const float sideLength = bv.radius() * 2.f;
+ float area = vca.viewport.width() * sideLength * vca.viewport.height() * sideLength;
+
+ const QRect r = windowViewport(vca.area, vca.viewport);
+ area = std::sqrt(area * r.width() * r.height());
+
+ const int n = thresholds.size();
+ for (int i = 0; i < n; ++i) {
+ if (thresholds[i] < area || i == n -1) {
+ m_filterValue = approxRollingAverage<30>(m_filterValue, i);
+ i = qBound(0, static_cast<int>(qRound(m_filterValue)), n - 1);
+ if (lod->currentIndex() != i)
+ lod->setCurrentIndex(i);
+ break;
+ }
+ }
+ }
+
+ QRect windowViewport(const QSize &area, const QRectF &relativeViewport) const
+ {
+ 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();
+ }
+};
+
}
-namespace Qt3DRender {
+
+namespace Qt3DRender {
namespace Render {
UpdateLevelOfDetailJob::UpdateLevelOfDetailJob()
@@ -98,119 +235,13 @@ void UpdateLevelOfDetailJob::run()
if (m_manager->levelOfDetailManager()->count() == 0)
return;
- updateEntityLod(m_root);
-}
-
-QRect UpdateLevelOfDetailJob::windowViewport(const QSize &area, const QRectF &relativeViewport) const
-{
- 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();
-}
-
-void UpdateLevelOfDetailJob::updateEntityLod(Entity *entity)
-{
- if (!entity->isEnabled())
- return; // skip disabled sub-trees, since their bounding box is probably not valid anyway
-
- QVector<LevelOfDetail *> lods = entity->renderComponents<LevelOfDetail>();
- if (!lods.empty()) {
- LevelOfDetail* lod = lods.front(); // other lods are ignored
-
- if (lod->isEnabled() && !lod->thresholds().isEmpty()) {
- switch (lod->thresholdType()) {
- case QLevelOfDetail::DistanceToCameraThreshold:
- updateEntityLodByDistance(entity, lod);
- break;
- case QLevelOfDetail::ProjectedScreenPixelSizeThreshold:
- updateEntityLodByScreenArea(entity, lod);
- break;
- default:
- Q_ASSERT(false);
- break;
- }
- }
- }
-
- const auto children = entity->children();
- for (Qt3DRender::Render::Entity *child : children)
- updateEntityLod(child);
-}
-
-void UpdateLevelOfDetailJob::updateEntityLodByDistance(Entity *entity, LevelOfDetail *lod)
-{
- Matrix4x4 viewMatrix;
- Matrix4x4 projectionMatrix;
- if (!Render::CameraLens::viewMatrixForCamera(m_manager->renderNodesManager(), lod->camera(), viewMatrix, projectionMatrix))
- return;
-
- const QVector<qreal> thresholds = lod->thresholds();
- Vector3D center(lod->center());
- if (lod->hasBoundingVolumeOverride() || entity->worldBoundingVolume() == nullptr) {
- center = *entity->worldTransform() * center;
- } else {
- center = entity->worldBoundingVolume()->center();
- }
-
- const Vector3D tcenter = viewMatrix * center;
- const float dist = tcenter.length();
- const int n = thresholds.size();
- for (int i=0; i<n; ++i) {
- if (dist <= thresholds[i] || i == n -1) {
- m_filterValue = approxRollingAverage<30>(m_filterValue, i);
- i = qBound(0, static_cast<int>(qRound(m_filterValue)), n - 1);
- if (lod->currentIndex() != i)
- lod->setCurrentIndex(i);
- break;
- }
- }
-}
-
-void UpdateLevelOfDetailJob::updateEntityLodByScreenArea(Entity *entity, LevelOfDetail *lod)
-{
- Matrix4x4 viewMatrix;
- Matrix4x4 projectionMatrix;
- if (!Render::CameraLens::viewMatrixForCamera(m_manager->renderNodesManager(), lod->camera(), viewMatrix, projectionMatrix))
- return;
-
- PickingUtils::ViewportCameraAreaGatherer vcaGatherer(lod->camera());
- const QVector<PickingUtils::ViewportCameraAreaDetails> vcaTriplets = vcaGatherer.gather(m_frameGraphRoot);
- if (vcaTriplets.isEmpty())
- return;
-
- const PickingUtils::ViewportCameraAreaDetails &vca = vcaTriplets.front();
- const QVector<qreal> thresholds = lod->thresholds();
- Sphere bv(Vector3D(lod->center()), lod->radius());
- if (!lod->hasBoundingVolumeOverride() && entity->worldBoundingVolume() != nullptr) {
- bv = *(entity->worldBoundingVolume());
- } else {
- bv.transform(*entity->worldTransform());
- }
+ if (m_manager->levelOfDetailManager()->count() == 0)
+ return; // no LODs, lets bail out early
- bv.transform(projectionMatrix * viewMatrix);
- const float sideLength = bv.radius() * 2.f;
- float area = vca.viewport.width() * sideLength * vca.viewport.height() * sideLength;
-
- const QRect r = windowViewport(vca.area, vca.viewport);
- area = std::sqrt(area * r.width() * r.height());
-
- const int n = thresholds.size();
- for (int i = 0; i < n; ++i) {
- if (thresholds[i] < area || i == n -1) {
- m_filterValue = approxRollingAverage<30>(m_filterValue, i);
- i = qBound(0, static_cast<int>(qRound(m_filterValue)), n - 1);
- if (lod->currentIndex() != i)
- lod->setCurrentIndex(i);
- break;
- }
- }
+ LODUpdateVisitor visitor(m_filterValue, m_frameGraphRoot, m_manager);
+ visitor.apply(m_root);
+ m_filterValue = visitor.filterValue();
}
} // Render
diff --git a/src/render/jobs/updatelevelofdetailjob_p.h b/src/render/jobs/updatelevelofdetailjob_p.h
index 4c80a3205..3c7d00d2c 100644
--- a/src/render/jobs/updatelevelofdetailjob_p.h
+++ b/src/render/jobs/updatelevelofdetailjob_p.h
@@ -66,7 +66,7 @@ class NodeManagers;
class LevelOfDetail;
class FrameGraphNode;
-class QT3DRENDERSHARED_PRIVATE_EXPORT UpdateLevelOfDetailJob : public Qt3DCore::QAspectJob
+class Q_3DRENDERSHARED_PRIVATE_EXPORT UpdateLevelOfDetailJob : public Qt3DCore::QAspectJob
{
public:
UpdateLevelOfDetailJob();
@@ -81,12 +81,6 @@ public:
Entity *root() const { return m_root; }
private:
- void updateEntityLod(Entity *entity);
- void updateEntityLodByDistance(Entity *entity, LevelOfDetail *lod);
- void updateEntityLodByScreenArea(Entity *entity, LevelOfDetail *lod);
-
- QRect windowViewport(const QSize &area, const QRectF &relativeViewport) const;
-
NodeManagers *m_manager;
FrameGraphNode *m_frameGraphRoot;
Entity *m_root;
diff --git a/src/render/jobs/updatemeshtrianglelistjob_p.h b/src/render/jobs/updatemeshtrianglelistjob_p.h
index 9b67b9f49..048f8f01a 100644
--- a/src/render/jobs/updatemeshtrianglelistjob_p.h
+++ b/src/render/jobs/updatemeshtrianglelistjob_p.h
@@ -62,7 +62,7 @@ namespace Render {
class NodeManagers;
-class QT3DRENDERSHARED_PRIVATE_EXPORT UpdateMeshTriangleListJob : public Qt3DCore::QAspectJob
+class Q_3DRENDERSHARED_PRIVATE_EXPORT UpdateMeshTriangleListJob : public Qt3DCore::QAspectJob
{
public:
UpdateMeshTriangleListJob();
diff --git a/src/render/jobs/updateshaderdatatransformjob_p.h b/src/render/jobs/updateshaderdatatransformjob_p.h
index 2fc06b8f7..bcf4eb6af 100644
--- a/src/render/jobs/updateshaderdatatransformjob_p.h
+++ b/src/render/jobs/updateshaderdatatransformjob_p.h
@@ -62,7 +62,7 @@ namespace Render {
class NodeManagers;
-class QT3DRENDERSHARED_PRIVATE_EXPORT UpdateShaderDataTransformJob : public Qt3DCore::QAspectJob
+class Q_3DRENDERSHARED_PRIVATE_EXPORT UpdateShaderDataTransformJob : public Qt3DCore::QAspectJob
{
public:
UpdateShaderDataTransformJob();
diff --git a/src/render/jobs/updateskinningpalettejob.cpp b/src/render/jobs/updateskinningpalettejob.cpp
index 1ee9101f9..0f5d3d6d6 100644
--- a/src/render/jobs/updateskinningpalettejob.cpp
+++ b/src/render/jobs/updateskinningpalettejob.cpp
@@ -79,7 +79,11 @@ void UpdateSkinningPaletteJob::run()
// Find all the armature components and update their skinning palettes
QVector<HArmature> dirtyArmatures;
- findDirtyArmatures(m_root, dirtyArmatures);
+ m_root->traverse([&dirtyArmatures](Entity *entity) {
+ const auto armatureHandle = entity->componentHandle<Armature>();
+ if (!armatureHandle.isNull() && !dirtyArmatures.contains(armatureHandle))
+ dirtyArmatures.push_back(armatureHandle);
+ });
// Update the skeleton for each dirty armature
auto skeletonManager = m_nodeManagers->skeletonManager();
@@ -96,22 +100,6 @@ void UpdateSkinningPaletteJob::run()
}
}
-void UpdateSkinningPaletteJob::findDirtyArmatures(Entity *entity,
- QVector<HArmature> &armatures) const
-{
- // Just return all enabled armatures found on entities for now
- // TODO: Be smarter about limiting which armatures we update. For e.g. only
- // those with skeletons that have changed and only those that are within view
- // of one or more renderviews.
- const auto armatureHandle = entity->componentHandle<Armature>();
- if (!armatureHandle.isNull() && !armatures.contains(armatureHandle))
- armatures.push_back(armatureHandle);
-
- const auto children = entity->children();
- for (const auto child : children)
- findDirtyArmatures(child, armatures);
-}
-
} // namespace Render
} // namespace Qt3DRender
diff --git a/src/render/jobs/updateskinningpalettejob_p.h b/src/render/jobs/updateskinningpalettejob_p.h
index 9e230f143..c52e0841c 100644
--- a/src/render/jobs/updateskinningpalettejob_p.h
+++ b/src/render/jobs/updateskinningpalettejob_p.h
@@ -75,7 +75,6 @@ public:
protected:
void run() override;
- void findDirtyArmatures(Entity *entity, QVector<HArmature> &armatures) const;
NodeManagers *m_nodeManagers;
Entity *m_root;
QVector<HJoint> m_dirtyJoints;
diff --git a/src/render/jobs/updatetreeenabledjob.cpp b/src/render/jobs/updatetreeenabledjob.cpp
index 6475ea78c..e97fc6414 100644
--- a/src/render/jobs/updatetreeenabledjob.cpp
+++ b/src/render/jobs/updatetreeenabledjob.cpp
@@ -41,6 +41,8 @@
#include <Qt3DRender/private/entity_p.h>
#include <Qt3DRender/private/job_common_p.h>
+#include <Qt3DRender/private/managers_p.h>
+#include <Qt3DRender/private/nodemanagers_p.h>
#include <QThread>
@@ -51,14 +53,17 @@ namespace Render {
namespace {
-void updateTreeEnabled(Entity *node, bool parentEnabled)
+void updateTreeEnabled(NodeManagers *manager, Entity *node, bool parentEnabled)
{
const bool treeEnabled = node->isEnabled() && parentEnabled;
node->setTreeEnabled(treeEnabled);
- const QVector<Entity*> children = node->children();
- for (Entity *child : children)
- updateTreeEnabled(child, treeEnabled);
+ const auto childrenHandles = node->childrenHandles();
+ for (const HEntity &handle : childrenHandles) {
+ Entity *child = manager->renderNodesManager()->data(handle);
+ if (child)
+ updateTreeEnabled(manager, child, treeEnabled);
+ }
}
}
@@ -75,10 +80,15 @@ void UpdateTreeEnabledJob::setRoot(Entity *root)
m_node = root;
}
+void UpdateTreeEnabledJob::setManagers(NodeManagers *manager)
+{
+ m_manager = manager;
+}
+
void UpdateTreeEnabledJob::run()
{
- if (m_node)
- updateTreeEnabled(m_node, true);
+ if (m_node && m_manager)
+ updateTreeEnabled(m_manager, m_node, true);
}
} // namespace Render
diff --git a/src/render/jobs/updatetreeenabledjob_p.h b/src/render/jobs/updatetreeenabledjob_p.h
index 132271eaa..ba28998bc 100644
--- a/src/render/jobs/updatetreeenabledjob_p.h
+++ b/src/render/jobs/updatetreeenabledjob_p.h
@@ -62,17 +62,20 @@ namespace Qt3DRender {
namespace Render {
class Entity;
+class NodeManagers;
-class QT3DRENDERSHARED_PRIVATE_EXPORT UpdateTreeEnabledJob : public Qt3DCore::QAspectJob
+class Q_3DRENDERSHARED_PRIVATE_EXPORT UpdateTreeEnabledJob : public Qt3DCore::QAspectJob
{
public:
UpdateTreeEnabledJob();
void setRoot(Entity *root);
+ void setManagers(NodeManagers *manager);
void run() override;
private:
Entity *m_node;
+ NodeManagers *m_manager;
};
typedef QSharedPointer<UpdateTreeEnabledJob> UpdateTreeEnabledJobPtr;
diff --git a/src/render/jobs/updateworldboundingvolumejob_p.h b/src/render/jobs/updateworldboundingvolumejob_p.h
index affe78045..afb8cc6e1 100644
--- a/src/render/jobs/updateworldboundingvolumejob_p.h
+++ b/src/render/jobs/updateworldboundingvolumejob_p.h
@@ -62,7 +62,7 @@ namespace Render {
class EntityManager;
-class QT3DRENDERSHARED_PRIVATE_EXPORT UpdateWorldBoundingVolumeJob : public Qt3DCore::QAspectJob
+class Q_3DRENDERSHARED_PRIVATE_EXPORT UpdateWorldBoundingVolumeJob : public Qt3DCore::QAspectJob
{
public:
UpdateWorldBoundingVolumeJob();
diff --git a/src/render/jobs/updateworldtransformjob.cpp b/src/render/jobs/updateworldtransformjob.cpp
index c56ed8507..1a9697843 100644
--- a/src/render/jobs/updateworldtransformjob.cpp
+++ b/src/render/jobs/updateworldtransformjob.cpp
@@ -44,6 +44,8 @@
#include <Qt3DRender/private/transform_p.h>
#include <Qt3DRender/private/renderlogging_p.h>
#include <Qt3DRender/private/job_common_p.h>
+#include <Qt3DRender/private/managers_p.h>
+#include <Qt3DRender/private/nodemanagers_p.h>
#include <QThread>
@@ -54,7 +56,7 @@ namespace Render {
namespace {
-void updateWorldTransformAndBounds(Qt3DRender::Render::Entity *node, const Matrix4x4 &parentTransform)
+void updateWorldTransformAndBounds(NodeManagers *manager, Entity *node, const Matrix4x4 &parentTransform)
{
Matrix4x4 worldTransform(parentTransform);
Transform *nodeTransform = node->renderComponent<Transform>();
@@ -64,9 +66,12 @@ void updateWorldTransformAndBounds(Qt3DRender::Render::Entity *node, const Matri
*(node->worldTransform()) = worldTransform;
- const auto children = node->children();
- for (Qt3DRender::Render::Entity *child : children)
- updateWorldTransformAndBounds(child, worldTransform);
+ const auto childrenHandles = node->childrenHandles();
+ for (const HEntity &handle : childrenHandles) {
+ Entity *child = manager->renderNodesManager()->data(handle);
+ if (child)
+ updateWorldTransformAndBounds(manager, child, worldTransform);
+ }
}
}
@@ -74,6 +79,7 @@ void updateWorldTransformAndBounds(Qt3DRender::Render::Entity *node, const Matri
UpdateWorldTransformJob::UpdateWorldTransformJob()
: Qt3DCore::QAspectJob()
, m_node(nullptr)
+ , m_manager(nullptr)
{
SET_JOB_RUN_STAT_TYPE(this, JobTypes::UpdateTransform, 0);
}
@@ -83,6 +89,11 @@ void UpdateWorldTransformJob::setRoot(Entity *root)
m_node = root;
}
+void UpdateWorldTransformJob::setManagers(NodeManagers *manager)
+{
+ m_manager = manager;
+}
+
void UpdateWorldTransformJob::run()
{
// Iterate over each level of hierarchy in our scene
@@ -98,7 +109,7 @@ void UpdateWorldTransformJob::run()
Entity *parent = m_node->parent();
if (parent != nullptr)
parentTransform = *(parent->worldTransform());
- updateWorldTransformAndBounds(m_node, parentTransform);
+ updateWorldTransformAndBounds(m_manager, m_node, parentTransform);
qCDebug(Jobs) << "Exiting" << Q_FUNC_INFO << QThread::currentThread();
}
diff --git a/src/render/jobs/updateworldtransformjob_p.h b/src/render/jobs/updateworldtransformjob_p.h
index a85310e5c..2689fe45a 100644
--- a/src/render/jobs/updateworldtransformjob_p.h
+++ b/src/render/jobs/updateworldtransformjob_p.h
@@ -62,17 +62,21 @@ namespace Qt3DRender {
namespace Render {
class Entity;
+class NodeManagers;
-class QT3DRENDERSHARED_PRIVATE_EXPORT UpdateWorldTransformJob : public Qt3DCore::QAspectJob
+class Q_3DRENDERSHARED_PRIVATE_EXPORT UpdateWorldTransformJob : public Qt3DCore::QAspectJob
{
public:
UpdateWorldTransformJob();
void setRoot(Entity *root);
+ void setManagers(NodeManagers *manager);
+
void run() override;
private:
Entity *m_node;
+ NodeManagers *m_manager;
};
typedef QSharedPointer<UpdateWorldTransformJob> UpdateWorldTransformJobPtr;
diff --git a/src/render/lights/qabstractlight.h b/src/render/lights/qabstractlight.h
index b5dd89222..e92a5ee1d 100644
--- a/src/render/lights/qabstractlight.h
+++ b/src/render/lights/qabstractlight.h
@@ -52,7 +52,7 @@ namespace Qt3DRender {
class QAbstractLightPrivate;
-class QT3DRENDERSHARED_EXPORT QAbstractLight : public Qt3DCore::QComponent
+class Q_3DRENDERSHARED_EXPORT QAbstractLight : public Qt3DCore::QComponent
{
Q_OBJECT
Q_PROPERTY(Type type READ type)
diff --git a/src/render/lights/qabstractlight_p.h b/src/render/lights/qabstractlight_p.h
index f7831dce2..ebb8092b4 100644
--- a/src/render/lights/qabstractlight_p.h
+++ b/src/render/lights/qabstractlight_p.h
@@ -61,7 +61,7 @@ namespace Qt3DRender {
class QAbstractLight;
-class QT3DRENDERSHARED_PRIVATE_EXPORT QAbstractLightPrivate : public Qt3DCore::QComponentPrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QAbstractLightPrivate : public Qt3DCore::QComponentPrivate
{
public:
explicit QAbstractLightPrivate(QAbstractLight::Type type);
diff --git a/src/render/lights/qdirectionallight.h b/src/render/lights/qdirectionallight.h
index 6be1585db..5d572b9ea 100644
--- a/src/render/lights/qdirectionallight.h
+++ b/src/render/lights/qdirectionallight.h
@@ -48,7 +48,7 @@ namespace Qt3DRender {
class QDirectionalLightPrivate;
-class QT3DRENDERSHARED_EXPORT QDirectionalLight : public QAbstractLight
+class Q_3DRENDERSHARED_EXPORT QDirectionalLight : public QAbstractLight
{
Q_OBJECT
Q_PROPERTY(QVector3D worldDirection READ worldDirection WRITE setWorldDirection NOTIFY worldDirectionChanged)
diff --git a/src/render/lights/qdirectionallight_p.h b/src/render/lights/qdirectionallight_p.h
index ea80913eb..d57a95604 100644
--- a/src/render/lights/qdirectionallight_p.h
+++ b/src/render/lights/qdirectionallight_p.h
@@ -60,7 +60,7 @@ namespace Qt3DRender {
class QDirectionalLight;
-class QT3DRENDERSHARED_PRIVATE_EXPORT QDirectionalLightPrivate : QAbstractLightPrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QDirectionalLightPrivate : QAbstractLightPrivate
{
public:
QDirectionalLightPrivate();
diff --git a/src/render/lights/qenvironmentlight.h b/src/render/lights/qenvironmentlight.h
index 995768d3c..3afc44f28 100644
--- a/src/render/lights/qenvironmentlight.h
+++ b/src/render/lights/qenvironmentlight.h
@@ -50,7 +50,7 @@ namespace Qt3DRender {
class QAbstractTexture;
class QEnvironmentLightPrivate;
-class QT3DRENDERSHARED_EXPORT QEnvironmentLight : public Qt3DCore::QComponent
+class Q_3DRENDERSHARED_EXPORT QEnvironmentLight : public Qt3DCore::QComponent
{
Q_OBJECT
Q_PROPERTY(Qt3DRender::QAbstractTexture *irradiance READ irradiance WRITE setIrradiance NOTIFY irradianceChanged)
diff --git a/src/render/lights/qenvironmentlight_p.h b/src/render/lights/qenvironmentlight_p.h
index f4fa97b5a..a512f8f5b 100644
--- a/src/render/lights/qenvironmentlight_p.h
+++ b/src/render/lights/qenvironmentlight_p.h
@@ -62,7 +62,7 @@ namespace Qt3DRender {
class QAbstractTexture;
class QEnvironmentLight;
-class QT3DRENDERSHARED_PRIVATE_EXPORT QEnvironmentLightPrivate : public Qt3DCore::QComponentPrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QEnvironmentLightPrivate : public Qt3DCore::QComponentPrivate
{
public:
explicit QEnvironmentLightPrivate();
diff --git a/src/render/lights/qpointlight.h b/src/render/lights/qpointlight.h
index 16e048560..1efe1679a 100644
--- a/src/render/lights/qpointlight.h
+++ b/src/render/lights/qpointlight.h
@@ -48,7 +48,7 @@ namespace Qt3DRender {
class QPointLightPrivate;
-class QT3DRENDERSHARED_EXPORT QPointLight : public QAbstractLight
+class Q_3DRENDERSHARED_EXPORT QPointLight : public QAbstractLight
{
Q_OBJECT
Q_PROPERTY(float constantAttenuation READ constantAttenuation WRITE setConstantAttenuation NOTIFY constantAttenuationChanged)
diff --git a/src/render/lights/qpointlight_p.h b/src/render/lights/qpointlight_p.h
index 147867667..64c971291 100644
--- a/src/render/lights/qpointlight_p.h
+++ b/src/render/lights/qpointlight_p.h
@@ -60,7 +60,7 @@ namespace Qt3DRender {
class QPointLight;
-class QT3DRENDERSHARED_PRIVATE_EXPORT QPointLightPrivate : public QAbstractLightPrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QPointLightPrivate : public QAbstractLightPrivate
{
public:
QPointLightPrivate();
diff --git a/src/render/lights/qspotlight.h b/src/render/lights/qspotlight.h
index 8902708a3..760508b79 100644
--- a/src/render/lights/qspotlight.h
+++ b/src/render/lights/qspotlight.h
@@ -48,7 +48,7 @@ namespace Qt3DRender {
class QSpotLightPrivate;
-class QT3DRENDERSHARED_EXPORT QSpotLight : public QAbstractLight
+class Q_3DRENDERSHARED_EXPORT QSpotLight : public QAbstractLight
{
Q_OBJECT
Q_PROPERTY(float constantAttenuation READ constantAttenuation WRITE setConstantAttenuation NOTIFY constantAttenuationChanged)
diff --git a/src/render/lights/qspotlight_p.h b/src/render/lights/qspotlight_p.h
index eabc00353..2646a72cd 100644
--- a/src/render/lights/qspotlight_p.h
+++ b/src/render/lights/qspotlight_p.h
@@ -60,7 +60,7 @@ namespace Qt3DRender {
class QSpotLight;
-class QT3DRENDERSHARED_PRIVATE_EXPORT QSpotLightPrivate : public QAbstractLightPrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QSpotLightPrivate : public QAbstractLightPrivate
{
public:
QSpotLightPrivate();
diff --git a/src/render/materialsystem/qeffect.h b/src/render/materialsystem/qeffect.h
index 0a65311ba..decae6f39 100644
--- a/src/render/materialsystem/qeffect.h
+++ b/src/render/materialsystem/qeffect.h
@@ -51,7 +51,7 @@ class QParameter;
class QTechnique;
class QEffectPrivate;
-class QT3DRENDERSHARED_EXPORT QEffect : public Qt3DCore::QNode
+class Q_3DRENDERSHARED_EXPORT QEffect : public Qt3DCore::QNode
{
Q_OBJECT
public:
diff --git a/src/render/materialsystem/qeffect_p.h b/src/render/materialsystem/qeffect_p.h
index 39c7d1ecc..c1fe22ec0 100644
--- a/src/render/materialsystem/qeffect_p.h
+++ b/src/render/materialsystem/qeffect_p.h
@@ -63,7 +63,7 @@ class QEffect;
class QParameter;
class QTechnique;
-class QT3DRENDERSHARED_PRIVATE_EXPORT QEffectPrivate : public Qt3DCore::QNodePrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QEffectPrivate : public Qt3DCore::QNodePrivate
{
public :
QEffectPrivate();
diff --git a/src/render/materialsystem/qfilterkey.h b/src/render/materialsystem/qfilterkey.h
index 23c2dd342..d7dd470db 100644
--- a/src/render/materialsystem/qfilterkey.h
+++ b/src/render/materialsystem/qfilterkey.h
@@ -50,7 +50,7 @@ namespace Qt3DRender {
class QFilterKeyPrivate;
-class QT3DRENDERSHARED_EXPORT QFilterKey : public Qt3DCore::QNode
+class Q_3DRENDERSHARED_EXPORT QFilterKey : public Qt3DCore::QNode
{
Q_OBJECT
Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged)
diff --git a/src/render/materialsystem/qfilterkey_p.h b/src/render/materialsystem/qfilterkey_p.h
index 4050bc295..2174841a3 100644
--- a/src/render/materialsystem/qfilterkey_p.h
+++ b/src/render/materialsystem/qfilterkey_p.h
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_PRIVATE_EXPORT QFilterKeyPrivate : public Qt3DCore::QNodePrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QFilterKeyPrivate : public Qt3DCore::QNodePrivate
{
public:
QFilterKeyPrivate();
diff --git a/src/render/materialsystem/qgraphicsapifilter.h b/src/render/materialsystem/qgraphicsapifilter.h
index 08b30b1f7..337193673 100644
--- a/src/render/materialsystem/qgraphicsapifilter.h
+++ b/src/render/materialsystem/qgraphicsapifilter.h
@@ -51,7 +51,7 @@ namespace Qt3DRender {
class QGraphicsApiFilterPrivate;
-class QT3DRENDERSHARED_EXPORT QGraphicsApiFilter : public QObject
+class Q_3DRENDERSHARED_EXPORT QGraphicsApiFilter : public QObject
{
Q_OBJECT
Q_PROPERTY(Qt3DRender::QGraphicsApiFilter::Api api READ api WRITE setApi NOTIFY apiChanged)
diff --git a/src/render/materialsystem/qgraphicsapifilter_p.h b/src/render/materialsystem/qgraphicsapifilter_p.h
index f4581ac05..3961d4f93 100644
--- a/src/render/materialsystem/qgraphicsapifilter_p.h
+++ b/src/render/materialsystem/qgraphicsapifilter_p.h
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-struct QT3DRENDERSHARED_PRIVATE_EXPORT GraphicsApiFilterData
+struct Q_3DRENDERSHARED_PRIVATE_EXPORT GraphicsApiFilterData
{
GraphicsApiFilterData();
@@ -75,7 +75,7 @@ struct QT3DRENDERSHARED_PRIVATE_EXPORT GraphicsApiFilterData
bool operator <(const GraphicsApiFilterData &other) const;
};
-class QT3DRENDERSHARED_PRIVATE_EXPORT QGraphicsApiFilterPrivate : public QObjectPrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QGraphicsApiFilterPrivate : public QObjectPrivate
{
public:
QGraphicsApiFilterPrivate()
diff --git a/src/render/materialsystem/qmaterial.h b/src/render/materialsystem/qmaterial.h
index 9d1895294..d7d40f138 100644
--- a/src/render/materialsystem/qmaterial.h
+++ b/src/render/materialsystem/qmaterial.h
@@ -54,7 +54,7 @@ class QParameter;
class QMaterialPrivate;
class QEffect;
-class QT3DRENDERSHARED_EXPORT QMaterial : public Qt3DCore::QComponent
+class Q_3DRENDERSHARED_EXPORT QMaterial : public Qt3DCore::QComponent
{
Q_OBJECT
Q_PROPERTY(Qt3DRender::QEffect *effect READ effect WRITE setEffect NOTIFY effectChanged)
diff --git a/src/render/materialsystem/qmaterial_p.h b/src/render/materialsystem/qmaterial_p.h
index 9fb8d5de9..273e044e2 100644
--- a/src/render/materialsystem/qmaterial_p.h
+++ b/src/render/materialsystem/qmaterial_p.h
@@ -61,7 +61,7 @@ namespace Qt3DRender {
class QParameter;
class QEffect;
-class QT3DRENDERSHARED_PRIVATE_EXPORT QMaterialPrivate : public Qt3DCore::QComponentPrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QMaterialPrivate : public Qt3DCore::QComponentPrivate
{
public:
QMaterialPrivate();
diff --git a/src/render/materialsystem/qparameter.h b/src/render/materialsystem/qparameter.h
index 169543e24..8d56bcbe7 100644
--- a/src/render/materialsystem/qparameter.h
+++ b/src/render/materialsystem/qparameter.h
@@ -51,7 +51,7 @@ namespace Qt3DRender {
class QParameterPrivate;
class QAbstractTexture;
-class QT3DRENDERSHARED_EXPORT QParameter : public Qt3DCore::QNode
+class Q_3DRENDERSHARED_EXPORT QParameter : public Qt3DCore::QNode
{
Q_OBJECT
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
diff --git a/src/render/materialsystem/qparameter_p.h b/src/render/materialsystem/qparameter_p.h
index a56a63af4..e8d74ac91 100644
--- a/src/render/materialsystem/qparameter_p.h
+++ b/src/render/materialsystem/qparameter_p.h
@@ -60,7 +60,7 @@ namespace Qt3DRender {
class QParameter;
-class QT3DRENDERSHARED_PRIVATE_EXPORT QParameterPrivate : public Qt3DCore::QNodePrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QParameterPrivate : public Qt3DCore::QNodePrivate
{
public:
QParameterPrivate();
diff --git a/src/render/materialsystem/qrenderpass.h b/src/render/materialsystem/qrenderpass.h
index 14bd34b37..b82a0d973 100644
--- a/src/render/materialsystem/qrenderpass.h
+++ b/src/render/materialsystem/qrenderpass.h
@@ -59,7 +59,7 @@ typedef QVector<QParameter*> ParameterList;
class QRenderPassPrivate;
-class QT3DRENDERSHARED_EXPORT QRenderPass : public Qt3DCore::QNode
+class Q_3DRENDERSHARED_EXPORT QRenderPass : public Qt3DCore::QNode
{
Q_OBJECT
Q_PROPERTY(Qt3DRender::QShaderProgram *shaderProgram READ shaderProgram WRITE setShaderProgram NOTIFY shaderProgramChanged)
diff --git a/src/render/materialsystem/qshaderdata.h b/src/render/materialsystem/qshaderdata.h
index 5e57d11a4..eda009c6a 100644
--- a/src/render/materialsystem/qshaderdata.h
+++ b/src/render/materialsystem/qshaderdata.h
@@ -50,7 +50,7 @@ namespace Qt3DRender {
class QShaderDataPrivate;
-class QT3DRENDERSHARED_EXPORT PropertyReaderInterface
+class Q_3DRENDERSHARED_EXPORT PropertyReaderInterface
{
public:
virtual ~PropertyReaderInterface();
@@ -59,7 +59,7 @@ public:
typedef QSharedPointer<PropertyReaderInterface> PropertyReaderInterfacePtr;
-class QT3DRENDERSHARED_EXPORT QShaderData : public Qt3DCore::QComponent
+class Q_3DRENDERSHARED_EXPORT QShaderData : public Qt3DCore::QComponent
{
Q_OBJECT
public:
diff --git a/src/render/materialsystem/qshaderdata_p.h b/src/render/materialsystem/qshaderdata_p.h
index 258c962ee..18890aec9 100644
--- a/src/render/materialsystem/qshaderdata_p.h
+++ b/src/render/materialsystem/qshaderdata_p.h
@@ -86,7 +86,7 @@ class QShaderDataPropertyReader: public PropertyReaderInterface
}
};
-class QT3DRENDERSHARED_PRIVATE_EXPORT QShaderDataPrivate : public Qt3DCore::QComponentPrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QShaderDataPrivate : public Qt3DCore::QComponentPrivate
{
public:
QShaderDataPrivate();
diff --git a/src/render/materialsystem/qshaderprogram.h b/src/render/materialsystem/qshaderprogram.h
index efcfa792e..49c1076e5 100644
--- a/src/render/materialsystem/qshaderprogram.h
+++ b/src/render/materialsystem/qshaderprogram.h
@@ -49,7 +49,7 @@ namespace Qt3DRender {
class QShaderProgramPrivate;
-class QT3DRENDERSHARED_EXPORT QShaderProgram : public Qt3DCore::QNode
+class Q_3DRENDERSHARED_EXPORT QShaderProgram : public Qt3DCore::QNode
{
Q_OBJECT
Q_PROPERTY(QByteArray vertexShaderCode READ vertexShaderCode WRITE setVertexShaderCode NOTIFY vertexShaderCodeChanged)
diff --git a/src/render/materialsystem/qshaderprogrambuilder.cpp b/src/render/materialsystem/qshaderprogrambuilder.cpp
index 9318f96af..84dd33372 100644
--- a/src/render/materialsystem/qshaderprogrambuilder.cpp
+++ b/src/render/materialsystem/qshaderprogrambuilder.cpp
@@ -94,6 +94,53 @@ QShaderProgramBuilder::QShaderProgramBuilder(QShaderProgramBuilderPrivate &dd, Q
{
}
+void QShaderProgramBuilder::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
+{
+ Q_D(QShaderProgramBuilder);
+ if (change->type() == Qt3DCore::PropertyUpdated) {
+ const Qt3DCore::QPropertyUpdatedChangePtr e = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(change);
+ if (e->propertyName() == QByteArrayLiteral("generatedShaderCode")) {
+ const bool blocked = blockNotifications(true);
+ const QPair<int, QByteArray> data = e->value().value<QPair<int, QByteArray>>();
+
+ switch (data.first) {
+ case QShaderProgram::Vertex: {
+ d->m_vertexShaderCode = data.second;
+ emit vertexShaderCodeChanged(d->m_vertexShaderCode);
+ break;
+ }
+ case QShaderProgram::Fragment:{
+ d->m_fragmentShaderCode = data.second;
+ emit fragmentShaderCodeChanged(d->m_fragmentShaderCode);
+ break;
+ }
+ case QShaderProgram::Geometry: {
+ d->m_geometryShaderCode = data.second;
+ emit geometryShaderCodeChanged(d->m_geometryShaderCode);
+ break;
+ }
+ case QShaderProgram::Compute: {
+ d->m_computeShaderCode = data.second;
+ emit computeShaderCodeChanged(d->m_computeShaderCode);
+ break;
+ }
+ case QShaderProgram::TessellationControl: {
+ d->m_tessControlShaderCode = data.second;
+ emit tessellationControlShaderCodeChanged(d->m_tessControlShaderCode);
+ break;
+ }
+ case QShaderProgram::TessellationEvaluation: {
+ d->m_tessEvalShaderCode = data.second;
+ emit tessellationEvaluationShaderCodeChanged(d->m_tessEvalShaderCode);
+ break;
+ }
+ }
+
+ blockNotifications(blocked);
+ }
+ }
+}
+
/*!
\qmlproperty string ShaderProgramBuilder::shaderProgram
@@ -311,6 +358,114 @@ QUrl QShaderProgramBuilder::computeShaderGraph() const
return d->m_computeShaderGraph;
}
+/*!
+ \qmlproperty string ShaderProgramBuilder:vertexShaderCode
+
+ Holds the generated vertex shader code
+ \since 2.13
+*/
+/*!
+ \property QShaderProgram:Builder:vertexShaderCode
+
+ Holds the generate vertex shader code.
+ \since 5.13
+*/
+QByteArray QShaderProgramBuilder::vertexShaderCode() const
+{
+ Q_D(const QShaderProgramBuilder);
+ return d->m_vertexShaderCode;
+}
+
+/*!
+ \qmlproperty string ShaderProgramBuilder:tessellationControlShaderCode
+
+ Holds the generated tessellation control shader code
+ \since 2.13
+*/
+/*!
+ \property QShaderProgram:Builder:tessellationControlShaderCode
+
+ Holds the generate tessellation control shader code.
+ \since 5.13
+*/
+QByteArray QShaderProgramBuilder::tessellationControlShaderCode() const
+{
+ Q_D(const QShaderProgramBuilder);
+ return d->m_tessControlShaderCode;
+}
+
+/*!
+ \qmlproperty string ShaderProgramBuilder:tessellationEvaluationShaderCode
+
+ Holds the generated tessellation evaluation shader code
+ \since 2.13
+*/
+/*!
+ \property QShaderProgram:Builder:tessellationEvaluationShaderCode
+
+ Holds the generate tessellation evaluation shader code.
+ \since 5.13
+*/
+QByteArray QShaderProgramBuilder::tessellationEvaluationShaderCode() const
+{
+ Q_D(const QShaderProgramBuilder);
+ return d->m_tessEvalShaderCode;
+}
+
+/*!
+ \qmlproperty string ShaderProgramBuilder:geometryShaderCode
+
+ Holds the generated geometry shader code
+ \since 2.13
+*/
+/*!
+ \property QShaderProgram:Builder:geometryShaderCode
+
+ Holds the generate geometry shader code.
+ \since 5.13
+*/
+QByteArray QShaderProgramBuilder::geometryShaderCode() const
+{
+ Q_D(const QShaderProgramBuilder);
+ return d->m_geometryShaderCode;
+}
+
+/*!
+ \qmlproperty string ShaderProgramBuilder::fragmentShaderCode
+
+ Holds the generated fragment shader code
+ \since 2.13
+*/
+/*!
+ \property QShaderProgram:Builder:fragmentShaderCode
+
+ Holds the generate fragment shader code.
+ \since 5.13
+*/
+QByteArray QShaderProgramBuilder::fragmentShaderCode() const
+{
+ Q_D(const QShaderProgramBuilder);
+ return d->m_fragmentShaderCode;
+}
+
+/*!
+ \qmlproperty string ShaderProgramBuilder::computeShaderCode
+
+ Holds the generated compute shader code
+ \since 2.13
+*/
+/*!
+ \property QShaderProgram:Builder:computeShaderCode
+
+ Holds the generate compute shader code.
+ \since 5.13
+*/
+QByteArray QShaderProgramBuilder::computeShaderCode() const
+{
+ Q_D(const QShaderProgramBuilder);
+ return d->m_computeShaderCode;
+}
+
Qt3DCore::QNodeCreatedChangeBasePtr QShaderProgramBuilder::createNodeCreationChange() const
{
auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QShaderProgramBuilderData>::create(this);
diff --git a/src/render/materialsystem/qshaderprogrambuilder.h b/src/render/materialsystem/qshaderprogrambuilder.h
index fbbf7c752..184093730 100644
--- a/src/render/materialsystem/qshaderprogrambuilder.h
+++ b/src/render/materialsystem/qshaderprogrambuilder.h
@@ -52,7 +52,7 @@ namespace Qt3DRender {
class QShaderProgram;
class QShaderProgramBuilderPrivate;
-class QT3DRENDERSHARED_EXPORT QShaderProgramBuilder : public Qt3DCore::QNode
+class Q_3DRENDERSHARED_EXPORT QShaderProgramBuilder : public Qt3DCore::QNode
{
Q_OBJECT
Q_PROPERTY(Qt3DRender::QShaderProgram* shaderProgram READ shaderProgram WRITE setShaderProgram NOTIFY shaderProgramChanged)
@@ -63,6 +63,12 @@ class QT3DRENDERSHARED_EXPORT QShaderProgramBuilder : public Qt3DCore::QNode
Q_PROPERTY(QUrl geometryShaderGraph READ geometryShaderGraph WRITE setGeometryShaderGraph NOTIFY geometryShaderGraphChanged)
Q_PROPERTY(QUrl fragmentShaderGraph READ fragmentShaderGraph WRITE setFragmentShaderGraph NOTIFY fragmentShaderGraphChanged)
Q_PROPERTY(QUrl computeShaderGraph READ computeShaderGraph WRITE setComputeShaderGraph NOTIFY computeShaderGraphChanged)
+ Q_PROPERTY(QByteArray vertexShaderCode READ vertexShaderCode NOTIFY vertexShaderCodeChanged REVISION 13)
+ Q_PROPERTY(QByteArray tessellationControlShaderCode READ tessellationControlShaderCode NOTIFY tessellationControlShaderCodeChanged REVISION 13)
+ Q_PROPERTY(QByteArray tessellationEvaluationShaderCode READ tessellationEvaluationShaderCode NOTIFY tessellationEvaluationShaderCodeChanged REVISION 13)
+ Q_PROPERTY(QByteArray geometryShaderCode READ geometryShaderCode NOTIFY geometryShaderCodeChanged REVISION 13)
+ Q_PROPERTY(QByteArray fragmentShaderCode READ fragmentShaderCode NOTIFY fragmentShaderCodeChanged REVISION 13)
+ Q_PROPERTY(QByteArray computeShaderCode READ computeShaderCode NOTIFY computeShaderCodeChanged REVISION 13)
public:
explicit QShaderProgramBuilder(Qt3DCore::QNode *parent = nullptr);
@@ -76,6 +82,12 @@ public:
QUrl geometryShaderGraph() const;
QUrl fragmentShaderGraph() const;
QUrl computeShaderGraph() const;
+ QByteArray vertexShaderCode() const;
+ QByteArray tessellationControlShaderCode() const;
+ QByteArray tessellationEvaluationShaderCode() const;
+ QByteArray geometryShaderCode() const;
+ QByteArray fragmentShaderCode() const;
+ QByteArray computeShaderCode() const;
public Q_SLOTS:
void setShaderProgram(Qt3DRender::QShaderProgram *program);
@@ -96,9 +108,16 @@ Q_SIGNALS:
void geometryShaderGraphChanged(const QUrl &geometryShaderGraph);
void fragmentShaderGraphChanged(const QUrl &fragmentShaderGraph);
void computeShaderGraphChanged(const QUrl &computeShaderGraph);
+ Q_REVISION(13) void vertexShaderCodeChanged(const QByteArray &vertexShaderCode);
+ Q_REVISION(13) void tessellationControlShaderCodeChanged(const QByteArray &tessellationControlShaderCode);
+ Q_REVISION(13) void tessellationEvaluationShaderCodeChanged(const QByteArray &tessellationEvaluationShaderCode);
+ Q_REVISION(13) void geometryShaderCodeChanged(const QByteArray &geometryShaderCode);
+ Q_REVISION(13) void fragmentShaderCodeChanged(const QByteArray &fragmentShaderCode);
+ Q_REVISION(13) void computeShaderCodeChanged(const QByteArray &computeShaderCode);
protected:
explicit QShaderProgramBuilder(QShaderProgramBuilderPrivate &dd, Qt3DCore::QNode *parent = nullptr);
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override;
private:
Q_DECLARE_PRIVATE(QShaderProgramBuilder)
diff --git a/src/render/materialsystem/qshaderprogrambuilder_p.h b/src/render/materialsystem/qshaderprogrambuilder_p.h
index e1b470229..2ac765a1d 100644
--- a/src/render/materialsystem/qshaderprogrambuilder_p.h
+++ b/src/render/materialsystem/qshaderprogrambuilder_p.h
@@ -74,6 +74,12 @@ public:
QUrl m_geometryShaderGraph;
QUrl m_fragmentShaderGraph;
QUrl m_computeShaderGraph;
+ QByteArray m_vertexShaderCode;
+ QByteArray m_tessControlShaderCode;
+ QByteArray m_tessEvalShaderCode;
+ QByteArray m_geometryShaderCode;
+ QByteArray m_fragmentShaderCode;
+ QByteArray m_computeShaderCode;
};
struct QShaderProgramBuilderData
diff --git a/src/render/materialsystem/qtechnique.h b/src/render/materialsystem/qtechnique.h
index c0c0d0ade..7711cd67f 100644
--- a/src/render/materialsystem/qtechnique.h
+++ b/src/render/materialsystem/qtechnique.h
@@ -55,7 +55,7 @@ class QParameter;
class QTechniquePrivate;
class QGraphicsApiFilter;
-class QT3DRENDERSHARED_EXPORT QTechnique : public Qt3DCore::QNode
+class Q_3DRENDERSHARED_EXPORT QTechnique : public Qt3DCore::QNode
{
Q_OBJECT
Q_PROPERTY(Qt3DRender::QGraphicsApiFilter *graphicsApiFilter READ graphicsApiFilter CONSTANT)
diff --git a/src/render/materialsystem/shaderbuilder.cpp b/src/render/materialsystem/shaderbuilder.cpp
index 9c7cb0938..c1ec7f75a 100644
--- a/src/render/materialsystem/shaderbuilder.cpp
+++ b/src/render/materialsystem/shaderbuilder.cpp
@@ -40,6 +40,7 @@
#include "shaderbuilder_p.h"
#include <Qt3DRender/private/qshaderprogrambuilder_p.h>
+#include <Qt3DRender/qshaderprogram.h>
#include <Qt3DRender/private/qshaderprogram_p.h>
#include <Qt3DRender/private/qurlhelper_p.h>
@@ -112,6 +113,31 @@ using namespace Qt3DCore;
namespace Qt3DRender {
namespace Render {
+
+namespace {
+
+QShaderProgram::ShaderType toQShaderProgramType(ShaderBuilder::ShaderType type)
+{
+ switch (type) {
+ case ShaderBuilder::ShaderType::Vertex:
+ return QShaderProgram::Vertex;
+ case ShaderBuilder::ShaderType::TessellationControl:
+ return QShaderProgram::TessellationControl;
+ case ShaderBuilder::ShaderType::TessellationEvaluation:
+ return QShaderProgram::TessellationEvaluation;
+ case ShaderBuilder::ShaderType::Geometry:
+ return QShaderProgram::Geometry;
+ case ShaderBuilder::ShaderType::Fragment:
+ return QShaderProgram::Fragment;
+ case ShaderBuilder::ShaderType::Compute:
+ return QShaderProgram::Compute;
+ default:
+ Q_UNREACHABLE();
+ }
+}
+
+} // anonymous
+
QString ShaderBuilder::getPrototypesFile()
{
return qt3dGlobalShaderPrototypes->prototypesFile();
@@ -244,6 +270,13 @@ void ShaderBuilder::generateCode(ShaderBuilder::ShaderType type)
const auto code = generator.createShaderCode(m_enabledLayers);
m_codes.insert(type, QShaderProgramPrivate::deincludify(code, graphPath + QStringLiteral(".glsl")));
m_dirtyTypes.remove(type);
+
+ // Send notification to the frontend
+ Qt3DCore::QPropertyUpdatedChangePtr propertyChange = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
+ propertyChange->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll);
+ propertyChange->setPropertyName("generatedShaderCode");
+ propertyChange->setValue(QVariant::fromValue(qMakePair(int(toQShaderProgramType(type)), m_codes.value(type))));
+ notifyObservers(propertyChange);
}
void ShaderBuilder::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
diff --git a/src/render/materialsystem/shaderbuilder_p.h b/src/render/materialsystem/shaderbuilder_p.h
index e9378e3c5..00c4e1c28 100644
--- a/src/render/materialsystem/shaderbuilder_p.h
+++ b/src/render/materialsystem/shaderbuilder_p.h
@@ -61,7 +61,7 @@ namespace Qt3DRender {
namespace Render {
-class QT3DRENDERSHARED_PRIVATE_EXPORT ShaderBuilder : public BackendNode
+class Q_3DRENDERSHARED_PRIVATE_EXPORT ShaderBuilder : public BackendNode
{
public:
enum ShaderType {
diff --git a/src/render/materialsystem/shadercache_p.h b/src/render/materialsystem/shadercache_p.h
index bda629ee5..40b88b53e 100644
--- a/src/render/materialsystem/shadercache_p.h
+++ b/src/render/materialsystem/shadercache_p.h
@@ -66,7 +66,7 @@ namespace Render {
class tst_ShaderCache;
#endif
-class QT3DRENDERSHARED_PRIVATE_EXPORT ShaderCache
+class Q_3DRENDERSHARED_PRIVATE_EXPORT ShaderCache
{
public:
~ShaderCache();
diff --git a/src/render/materialsystem/technique_p.h b/src/render/materialsystem/technique_p.h
index 0ca9d3ae9..d885c1b87 100644
--- a/src/render/materialsystem/technique_p.h
+++ b/src/render/materialsystem/technique_p.h
@@ -73,7 +73,7 @@ namespace Render {
class TechniqueManager;
-class QT3DRENDERSHARED_PRIVATE_EXPORT Technique : public BackendNode
+class Q_3DRENDERSHARED_PRIVATE_EXPORT Technique : public BackendNode
{
public:
Technique();
diff --git a/src/render/picking/objectpicker.cpp b/src/render/picking/objectpicker.cpp
index 76f00993c..43e308d20 100644
--- a/src/render/picking/objectpicker.cpp
+++ b/src/render/picking/objectpicker.cpp
@@ -53,6 +53,7 @@ namespace Render {
ObjectPicker::ObjectPicker()
: BackendNode(QBackendNode::ReadWrite)
+ , m_priority(0)
, m_isPressed(false)
, m_hoverEnabled(false)
, m_dragEnabled(false)
@@ -70,6 +71,7 @@ void ObjectPicker::cleanup()
m_isPressed = false;
m_hoverEnabled = false;
m_dragEnabled = false;
+ m_priority = 0;
notifyJob();
}
@@ -79,6 +81,7 @@ void ObjectPicker::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr
const auto &data = typedChange->data;
m_hoverEnabled = data.hoverEnabled;
m_dragEnabled = data.dragEnabled;
+ m_priority = data.priority;
notifyJob();
}
@@ -97,6 +100,8 @@ void ObjectPicker::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
m_hoverEnabled = propertyChange->value().toBool();
} else if (propertyChange->propertyName() == QByteArrayLiteral("dragEnabled")) {
m_dragEnabled = propertyChange->value().toBool();
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("priority")) {
+ m_priority = propertyChange->value().toInt();
}
markDirty(AbstractRenderer::AllDirty);
@@ -175,6 +180,16 @@ void ObjectPicker::onExited()
notifyObservers(e);
}
+void ObjectPicker::setPriority(int priority)
+{
+ m_priority = priority;
+}
+
+int ObjectPicker::priority() const
+{
+ return m_priority;
+}
+
} // Render
} // Qt3DRender
diff --git a/src/render/picking/objectpicker_p.h b/src/render/picking/objectpicker_p.h
index b9c308afb..7389a4b53 100644
--- a/src/render/picking/objectpicker_p.h
+++ b/src/render/picking/objectpicker_p.h
@@ -81,10 +81,15 @@ public:
void onEntered();
void onExited();
+ // Needed for unit tests
+ void setPriority(int priority);
+ int priority() const;
+
private:
void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) final;
void notifyJob();
+ int m_priority;
bool m_isPressed;
bool m_hoverEnabled;
bool m_dragEnabled;
diff --git a/src/render/picking/qabstractraycaster.cpp b/src/render/picking/qabstractraycaster.cpp
index fa48cf0b0..ecec7a628 100644
--- a/src/render/picking/qabstractraycaster.cpp
+++ b/src/render/picking/qabstractraycaster.cpp
@@ -58,6 +58,10 @@ QAbstractRayCasterPrivate::QAbstractRayCasterPrivate()
m_shareable = false;
}
+/*!
+ \property Qt3DRender::QAbstractRayCaster::Hits
+*/
+
QAbstractRayCasterPrivate *QAbstractRayCasterPrivate::get(QAbstractRayCaster *obj)
{
return obj->d_func();
diff --git a/src/render/picking/qabstractraycaster.h b/src/render/picking/qabstractraycaster.h
index c706a7bd2..592511786 100644
--- a/src/render/picking/qabstractraycaster.h
+++ b/src/render/picking/qabstractraycaster.h
@@ -53,7 +53,7 @@ namespace Qt3DRender {
class QAbstractRayCasterPrivate;
class QLayer;
-class QT3DRENDERSHARED_EXPORT QAbstractRayCaster : public Qt3DCore::QComponent
+class Q_3DRENDERSHARED_EXPORT QAbstractRayCaster : public Qt3DCore::QComponent
{
Q_OBJECT
Q_PROPERTY(RunMode runMode READ runMode WRITE setRunMode NOTIFY runModeChanged)
diff --git a/src/render/picking/qabstractraycaster_p.h b/src/render/picking/qabstractraycaster_p.h
index 2c4006e70..2dcddbd6a 100644
--- a/src/render/picking/qabstractraycaster_p.h
+++ b/src/render/picking/qabstractraycaster_p.h
@@ -64,7 +64,7 @@ class QLayer;
/*!
\internal
*/
-class QT3DRENDERSHARED_PRIVATE_EXPORT QAbstractRayCasterPrivate : public Qt3DCore::QComponentPrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QAbstractRayCasterPrivate : public Qt3DCore::QComponentPrivate
{
public:
QAbstractRayCasterPrivate();
diff --git a/src/render/picking/qobjectpicker.cpp b/src/render/picking/qobjectpicker.cpp
index c3671d018..a0b6d8dcd 100644
--- a/src/render/picking/qobjectpicker.cpp
+++ b/src/render/picking/qobjectpicker.cpp
@@ -266,6 +266,23 @@ void QObjectPicker::setDragEnabled(bool dragEnabled)
}
/*!
+ * Sets the picker's priority to \a priority. This is used when the pick result
+ * mode on QPickingSettings is set to QPickingSettings::NearestPriorityPick.
+ * Picking results are sorted by highest priority and shortest picking
+ * distance.
+ *
+ * \since 5.13
+ */
+void QObjectPicker::setPriority(int priority)
+{
+ Q_D(QObjectPicker);
+ if (priority != d->m_priority) {
+ d->m_priority = priority;
+ emit priorityChanged(priority);
+ }
+}
+
+/*!
\qmlproperty bool Qt3D.Render::ObjectPicker::dragEnabled
*/
/*!
@@ -312,6 +329,25 @@ bool QObjectPicker::isPressed() const
return d->m_pressed;
}
+/*!
+ \qmlproperty int Qt3D.Render::ObjectPicker::priority
+
+ The priority to be used when filtering pick results by priority when
+ PickingSettings.pickResultMode is set to PickingSettings.PriorityPick.
+*/
+/*!
+ \property Qt3DRender::QObjectPicker::priority
+
+ The priority to be used when filtering pick results by priority when
+ QPickingSettings::pickResultMode is set to
+ QPickingSettings::NearestPriorityPick.
+*/
+int QObjectPicker::priority() const
+{
+ Q_D(const QObjectPicker);
+ return d->m_priority;
+}
+
/*! \internal */
void QObjectPicker::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
{
@@ -465,6 +501,7 @@ Qt3DCore::QNodeCreatedChangeBasePtr QObjectPicker::createNodeCreationChange() co
Q_D(const QObjectPicker);
data.hoverEnabled = d->m_hoverEnabled;
data.dragEnabled = d->m_dragEnabled;
+ data.priority = d->m_priority;
return creationChange;
}
diff --git a/src/render/picking/qobjectpicker.h b/src/render/picking/qobjectpicker.h
index 9f3b138c3..8866c99a9 100644
--- a/src/render/picking/qobjectpicker.h
+++ b/src/render/picking/qobjectpicker.h
@@ -51,13 +51,14 @@ class QAttribute;
class QObjectPickerPrivate;
class QPickEvent;
-class QT3DRENDERSHARED_EXPORT QObjectPicker : public Qt3DCore::QComponent
+class Q_3DRENDERSHARED_EXPORT QObjectPicker : public Qt3DCore::QComponent
{
Q_OBJECT
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)
+ Q_PROPERTY(int priority READ priority WRITE setPriority NOTIFY priorityChanged REVISION 13)
public:
explicit QObjectPicker(QNode *parent = nullptr);
@@ -69,9 +70,12 @@ public:
bool containsMouse() const;
bool isPressed() const;
+ int priority() const;
+
public Q_SLOTS:
void setHoverEnabled(bool hoverEnabled);
void setDragEnabled(bool dragEnabled);
+ Q_REVISION(13) void setPriority(int priority);
Q_SIGNALS:
void pressed(Qt3DRender::QPickEvent *pick);
@@ -84,6 +88,7 @@ Q_SIGNALS:
void dragEnabledChanged(bool dragEnabled);
void pressedChanged(bool pressed);
void containsMouseChanged(bool containsMouse);
+ Q_REVISION(13) void priorityChanged(int priority);
protected:
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override;
diff --git a/src/render/picking/qobjectpicker_p.h b/src/render/picking/qobjectpicker_p.h
index 3c48b9419..b95183ab5 100644
--- a/src/render/picking/qobjectpicker_p.h
+++ b/src/render/picking/qobjectpicker_p.h
@@ -59,7 +59,7 @@ namespace Qt3DRender {
/*!
\internal
*/
-class QT3DRENDERSHARED_PRIVATE_EXPORT QObjectPickerPrivate : public Qt3DCore::QComponentPrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QObjectPickerPrivate : public Qt3DCore::QComponentPrivate
{
public:
QObjectPickerPrivate()
@@ -69,6 +69,7 @@ public:
, m_pressed(false)
, m_containsMouse(false)
, m_acceptedLastPressedEvent(true)
+ , m_priority(0)
{
m_shareable = false;
}
@@ -79,6 +80,7 @@ public:
bool m_pressed;
bool m_containsMouse;
bool m_acceptedLastPressedEvent;
+ int m_priority;
enum EventType {
Pressed,
@@ -102,6 +104,7 @@ struct QObjectPickerData
{
bool hoverEnabled;
bool dragEnabled;
+ int priority;
};
} // namespace Qt3DRender
diff --git a/src/render/picking/qpickevent.h b/src/render/picking/qpickevent.h
index 7d854043e..5b354efb7 100644
--- a/src/render/picking/qpickevent.h
+++ b/src/render/picking/qpickevent.h
@@ -54,7 +54,7 @@ class QPickEventPrivate;
class QPickEvent;
typedef QSharedPointer<QPickEvent> QPickEventPtr;
-class QT3DRENDERSHARED_EXPORT QPickEvent : public QObject
+class Q_3DRENDERSHARED_EXPORT QPickEvent : public QObject
{
Q_OBJECT
Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted NOTIFY acceptedChanged)
diff --git a/src/render/picking/qpickevent_p.h b/src/render/picking/qpickevent_p.h
index ced36c9bb..e27ee51e2 100644
--- a/src/render/picking/qpickevent_p.h
+++ b/src/render/picking/qpickevent_p.h
@@ -60,7 +60,7 @@ namespace Qt3DRender {
class QPickEvent;
-class QT3DRENDERSHARED_PRIVATE_EXPORT QPickEventPrivate : public QObjectPrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QPickEventPrivate : public QObjectPrivate
{
public:
QPickEventPrivate()
diff --git a/src/render/picking/qpicklineevent.h b/src/render/picking/qpicklineevent.h
index 09697ad22..5941d38d4 100644
--- a/src/render/picking/qpicklineevent.h
+++ b/src/render/picking/qpicklineevent.h
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
class QPickLineEventPrivate;
-class QT3DRENDERSHARED_EXPORT QPickLineEvent : public QPickEvent
+class Q_3DRENDERSHARED_EXPORT QPickLineEvent : public QPickEvent
{
Q_OBJECT
Q_PROPERTY(uint edgeIndex READ edgeIndex CONSTANT)
diff --git a/src/render/picking/qpickpointevent.h b/src/render/picking/qpickpointevent.h
index f298f64b9..78ab23d9e 100644
--- a/src/render/picking/qpickpointevent.h
+++ b/src/render/picking/qpickpointevent.h
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
class QPickPointEventPrivate;
-class QT3DRENDERSHARED_EXPORT QPickPointEvent : public QPickEvent
+class Q_3DRENDERSHARED_EXPORT QPickPointEvent : public QPickEvent
{
Q_OBJECT
Q_PROPERTY(uint pointIndex READ pointIndex CONSTANT)
diff --git a/src/render/picking/qpicktriangleevent.h b/src/render/picking/qpicktriangleevent.h
index f116af288..48a1da762 100644
--- a/src/render/picking/qpicktriangleevent.h
+++ b/src/render/picking/qpicktriangleevent.h
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
class QPickTriangleEventPrivate;
-class QT3DRENDERSHARED_EXPORT QPickTriangleEvent : public QPickEvent
+class Q_3DRENDERSHARED_EXPORT QPickTriangleEvent : public QPickEvent
{
Q_OBJECT
Q_PROPERTY(uint triangleIndex READ triangleIndex CONSTANT)
diff --git a/src/render/picking/qraycaster.h b/src/render/picking/qraycaster.h
index 088c46607..b565c2c25 100644
--- a/src/render/picking/qraycaster.h
+++ b/src/render/picking/qraycaster.h
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_EXPORT QRayCaster : public QAbstractRayCaster
+class Q_3DRENDERSHARED_EXPORT QRayCaster : public QAbstractRayCaster
{
Q_OBJECT
Q_PROPERTY(QVector3D origin READ origin WRITE setOrigin NOTIFY originChanged)
diff --git a/src/render/picking/qraycasterhit.h b/src/render/picking/qraycasterhit.h
index 4764994df..9f62889fd 100644
--- a/src/render/picking/qraycasterhit.h
+++ b/src/render/picking/qraycasterhit.h
@@ -53,7 +53,7 @@ namespace Qt3DRender {
class QRayCasterHitData;
class QAbstractRayCasterPrivate;
-class QT3DRENDERSHARED_EXPORT QRayCasterHit
+class Q_3DRENDERSHARED_EXPORT QRayCasterHit
{
Q_GADGET
public:
diff --git a/src/render/picking/qscreenraycaster.h b/src/render/picking/qscreenraycaster.h
index 09ad94374..216ed47f5 100644
--- a/src/render/picking/qscreenraycaster.h
+++ b/src/render/picking/qscreenraycaster.h
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_EXPORT QScreenRayCaster : public QAbstractRayCaster
+class Q_3DRENDERSHARED_EXPORT QScreenRayCaster : public QAbstractRayCaster
{
Q_OBJECT
diff --git a/src/render/qt3drender_global.h b/src/render/qt3drender_global.h
index 68e1cb639..0bd34ac8b 100644
--- a/src/render/qt3drender_global.h
+++ b/src/render/qt3drender_global.h
@@ -46,12 +46,12 @@ QT_BEGIN_NAMESPACE
#if defined(QT_SHARED) || !defined(QT_STATIC)
# if defined(QT_BUILD_3DRENDER_LIB)
-# define QT3DRENDERSHARED_EXPORT Q_DECL_EXPORT
+# define Q_3DRENDERSHARED_EXPORT Q_DECL_EXPORT
# else
-# define QT3DRENDERSHARED_EXPORT Q_DECL_IMPORT
+# define Q_3DRENDERSHARED_EXPORT Q_DECL_IMPORT
# endif
#else
-# define QT3DRENDERSHARED_EXPORT
+# define Q_3DRENDERSHARED_EXPORT
#endif
QT_END_NAMESPACE
diff --git a/src/render/qt3drender_global_p.h b/src/render/qt3drender_global_p.h
index bdc35fd86..5caa8d895 100644
--- a/src/render/qt3drender_global_p.h
+++ b/src/render/qt3drender_global_p.h
@@ -54,6 +54,6 @@
#include "qt3drender_global.h"
#include <Qt3DRender/private/qt3drender-config_p.h>
-#define QT3DRENDERSHARED_PRIVATE_EXPORT QT3DRENDERSHARED_EXPORT
+#define Q_3DRENDERSHARED_PRIVATE_EXPORT Q_3DRENDERSHARED_EXPORT
#endif // QT3DRENDER_GLOBAL_P_H
diff --git a/src/render/raycasting/boundingsphere_p.h b/src/render/raycasting/boundingsphere_p.h
index bcffbaa19..fb76a8496 100644
--- a/src/render/raycasting/boundingsphere_p.h
+++ b/src/render/raycasting/boundingsphere_p.h
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
namespace RayCasting {
-class QT3DRENDERSHARED_EXPORT BoundingSphere : public QBoundingVolume
+class Q_3DRENDERSHARED_EXPORT BoundingSphere : public QBoundingVolume
{
public:
BoundingSphere();
diff --git a/src/render/raycasting/qabstractcollisionqueryservice_p.h b/src/render/raycasting/qabstractcollisionqueryservice_p.h
index fa35792d0..40137d239 100644
--- a/src/render/raycasting/qabstractcollisionqueryservice_p.h
+++ b/src/render/raycasting/qabstractcollisionqueryservice_p.h
@@ -77,7 +77,7 @@ public:
{}
};
-class QT3DRENDERSHARED_EXPORT QAbstractCollisionQueryService : public Qt3DCore::QAbstractServiceProvider
+class Q_3DRENDERSHARED_EXPORT QAbstractCollisionQueryService : public Qt3DCore::QAbstractServiceProvider
{
Q_OBJECT
public:
diff --git a/src/render/raycasting/qboundingvolume_p.h b/src/render/raycasting/qboundingvolume_p.h
index b63463f23..796085b25 100644
--- a/src/render/raycasting/qboundingvolume_p.h
+++ b/src/render/raycasting/qboundingvolume_p.h
@@ -61,7 +61,7 @@ namespace RayCasting {
class QRay3D;
-class QT3DRENDERSHARED_EXPORT QBoundingVolume
+class Q_3DRENDERSHARED_EXPORT QBoundingVolume
{
public:
QBoundingVolume();
diff --git a/src/render/raycasting/qboundingvolumeprovider_p.h b/src/render/raycasting/qboundingvolumeprovider_p.h
index ae9fd65e3..42b95dd30 100644
--- a/src/render/raycasting/qboundingvolumeprovider_p.h
+++ b/src/render/raycasting/qboundingvolumeprovider_p.h
@@ -60,7 +60,7 @@ namespace RayCasting {
class QBoundingVolume;
-class QT3DRENDERSHARED_EXPORT QBoundingVolumeProvider
+class Q_3DRENDERSHARED_EXPORT QBoundingVolumeProvider
{
public:
virtual ~QBoundingVolumeProvider();
diff --git a/src/render/raycasting/qcollisionqueryresult_p.h b/src/render/raycasting/qcollisionqueryresult_p.h
index 24371d30e..67f6a34d0 100644
--- a/src/render/raycasting/qcollisionqueryresult_p.h
+++ b/src/render/raycasting/qcollisionqueryresult_p.h
@@ -65,7 +65,7 @@ namespace RayCasting {
typedef int QQueryHandle;
class QCollisionQueryResultPrivate;
-class QT3DRENDERSHARED_EXPORT QCollisionQueryResult
+class Q_3DRENDERSHARED_EXPORT QCollisionQueryResult
{
public:
struct Hit {
diff --git a/src/render/raycasting/qray3d_p.h b/src/render/raycasting/qray3d_p.h
index 8b7852cc3..7d1ac874e 100644
--- a/src/render/raycasting/qray3d_p.h
+++ b/src/render/raycasting/qray3d_p.h
@@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
namespace RayCasting {
-class QT3DRENDERSHARED_EXPORT QRay3D
+class Q_3DRENDERSHARED_EXPORT QRay3D
{
public:
QRay3D();
@@ -104,12 +104,12 @@ QT3D_DECLARE_TYPEINFO_2(Qt3DRender, RayCasting, QRay3D, Q_MOVABLE_TYPE)
#ifndef QT_NO_DEBUG_STREAM
-QT3DRENDERSHARED_EXPORT QDebug operator<<(QDebug dbg, const QRay3D &ray);
+Q_3DRENDERSHARED_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);
+Q_3DRENDERSHARED_EXPORT QDataStream &operator<<(QDataStream &stream, const QRay3D &ray);
+Q_3DRENDERSHARED_EXPORT QDataStream &operator>>(QDataStream &stream, QRay3D &ray);
#endif
} // namespace RayCasting
diff --git a/src/render/raycasting/qraycastingservice_p.h b/src/render/raycasting/qraycastingservice_p.h
index b77c8af9f..792ba2626 100644
--- a/src/render/raycasting/qraycastingservice_p.h
+++ b/src/render/raycasting/qraycastingservice_p.h
@@ -69,7 +69,7 @@ class QRayCastingServicePrivate;
typedef QFuture<QCollisionQueryResult> FutureQueryResult;
-class QT3DRENDERSHARED_EXPORT QRayCastingService : public QAbstractCollisionQueryService
+class Q_3DRENDERSHARED_EXPORT QRayCastingService : public QAbstractCollisionQueryService
{
public:
QRayCastingService();
diff --git a/src/render/renderers/opengl/graphicshelpers/glfence_p.h b/src/render/renderers/opengl/graphicshelpers/glfence_p.h
new file mode 100644
index 000000000..366065048
--- /dev/null
+++ b/src/render/renderers/opengl/graphicshelpers/glfence_p.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** 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 GLFENCE_P_H
+#define GLFENCE_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 Qt3DRender {
+
+namespace Render {
+
+// GLsync is a pointer to a struct (unlike the rest of GL which used int ids)
+// We cannot reference GLsync as it's only available since 3.2 We use FenceId
+// to wrap that around and trust the GLHelpers will convert them accordingly.
+using GLFence = void *;
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+
+#endif // GLFENCE_P_H
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelperes2.cpp b/src/render/renderers/opengl/graphicshelpers/graphicshelperes2.cpp
index c5753195b..71540b1ad 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicshelperes2.cpp
+++ b/src/render/renderers/opengl/graphicshelpers/graphicshelperes2.cpp
@@ -318,6 +318,33 @@ void GraphicsHelperES2::drawBuffer(GLenum mode)
qWarning() << "glDrawBuffer is not supported with OpenGL ES 2";
}
+void *GraphicsHelperES2::fenceSync()
+{
+ qWarning() << "Fences are not supported by OpenGL ES 2.0 (since OpenGL ES 3.0)";
+ return nullptr;
+}
+
+void GraphicsHelperES2::clientWaitSync(void *, GLuint64 )
+{
+ qWarning() << "Fences are not supported by OpenGL ES 2.0 (since OpenGL ES 3.0)";
+}
+
+void GraphicsHelperES2::waitSync(void *)
+{
+ qWarning() << "Fences are not supported by OpenGL ES 2.0 (since OpenGL ES 3.0)";
+}
+
+bool GraphicsHelperES2::wasSyncSignaled(void *)
+{
+ qWarning() << "Fences are not supported by OpenGL ES 2.0 (since OpenGL ES 3.0)";
+ return false;
+}
+
+void GraphicsHelperES2::deleteSync(void *)
+{
+ qWarning() << "Fences are not supported by OpenGL ES 2.0 (since OpenGL ES 3.0)";
+}
+
void GraphicsHelperES2::blendEquation(GLenum mode)
{
m_funcs->glBlendEquation(mode);
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelperes2_p.h b/src/render/renderers/opengl/graphicshelpers/graphicshelperes2_p.h
index 1c6df41b6..8c8dd34e9 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicshelperes2_p.h
+++ b/src/render/renderers/opengl/graphicshelpers/graphicshelperes2_p.h
@@ -132,6 +132,12 @@ public:
void readBuffer(GLenum mode) override;
void drawBuffer(GLenum mode) override;
+ void *fenceSync() override;
+ void clientWaitSync(void *sync, GLuint64 nanoSecTimeout) override;
+ void waitSync(void *sync) override;
+ bool wasSyncSignaled(void *sync) override;
+ void deleteSync(void *sync) override;
+
void glUniform1fv(GLint location, GLsizei count, const GLfloat *value) override;
void glUniform2fv(GLint location, GLsizei count, const GLfloat *value) override;
void glUniform3fv(GLint location, GLsizei count, const GLfloat *value) override;
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelperes3.cpp b/src/render/renderers/opengl/graphicshelpers/graphicshelperes3.cpp
index 34c1e7448..5e5d2e001 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicshelperes3.cpp
+++ b/src/render/renderers/opengl/graphicshelpers/graphicshelperes3.cpp
@@ -147,6 +147,26 @@ QT_BEGIN_NAMESPACE
#define GL_READ_FRAMEBUFFER 0x8CA8
#endif
+#ifndef GL_SIGNALED
+#define GL_SIGNALED 0x9119
+#endif
+
+#ifndef GL_SYNC_STATUS
+#define GL_SYNC_STATUS 0x9114
+#endif
+
+#ifndef GL_TIMEOUT_IGNORED
+#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull
+#endif
+
+#ifndef GL_SYNC_GPU_COMMANDS_COMPLETE
+#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117
+#endif
+
+#ifndef GL_SYNC_FLUSH_COMMANDS_BIT
+#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001
+#endif
+
namespace Qt3DRender {
namespace Render {
@@ -307,6 +327,7 @@ bool GraphicsHelperES3::supportsFeature(GraphicsHelperInterface::Feature feature
case BlitFramebuffer:
case UniformBufferObject:
case MapBuffer:
+ case Fences:
return true;
default:
return false;
@@ -439,6 +460,37 @@ uint GraphicsHelperES3::uniformByteSize(const ShaderUniform &description)
return arrayStride ? rawByteSize * arrayStride : rawByteSize;
}
+void *GraphicsHelperES3::fenceSync()
+{
+ return m_extraFuncs->glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
+}
+
+void GraphicsHelperES3::clientWaitSync(void *sync, GLuint64 nanoSecTimeout)
+{
+ m_extraFuncs->glClientWaitSync(static_cast<GLsync>(sync), GL_SYNC_FLUSH_COMMANDS_BIT, nanoSecTimeout);
+}
+
+void GraphicsHelperES3::waitSync(void *sync)
+{
+ m_extraFuncs->glWaitSync(static_cast<GLsync>(sync), 0, GL_TIMEOUT_IGNORED);
+}
+
+bool GraphicsHelperES3::wasSyncSignaled(void *sync)
+{
+ GLint v;
+ m_extraFuncs->glGetSynciv(static_cast<GLsync>(sync),
+ GL_SYNC_STATUS,
+ sizeof(v),
+ nullptr,
+ &v);
+ return v == GL_SIGNALED;
+}
+
+void GraphicsHelperES3::deleteSync(void *sync)
+{
+ m_extraFuncs->glDeleteSync(static_cast<GLsync>(sync));
+}
+
void GraphicsHelperES3::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
{
m_extraFuncs->glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelperes3_p.h b/src/render/renderers/opengl/graphicshelpers/graphicshelperes3_p.h
index d4467cf7f..dc5cef10c 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicshelperes3_p.h
+++ b/src/render/renderers/opengl/graphicshelpers/graphicshelperes3_p.h
@@ -90,6 +90,12 @@ public:
UniformType uniformTypeFromGLType(GLenum glType) override;
uint uniformByteSize(const ShaderUniform &description) override;
+ void *fenceSync() override;
+ void clientWaitSync(void *sync, GLuint64 nanoSecTimeout) override;
+ void waitSync(void *sync) override;
+ bool wasSyncSignaled(void *sync) override;
+ void deleteSync(void *sync) override;
+
protected:
QOpenGLExtraFunctions *m_extraFuncs = nullptr;
};
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp
index 6da8a9b6f..b6f3412b2 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp
+++ b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp
@@ -272,6 +272,33 @@ void GraphicsHelperGL2::drawBuffer(GLenum mode)
m_funcs->glDrawBuffer(mode);
}
+void *GraphicsHelperGL2::fenceSync()
+{
+ qWarning() << "Fences are not supported by OpenGL 2.0 (since OpenGL 3.2)";
+ return nullptr;
+}
+
+void GraphicsHelperGL2::clientWaitSync(void *, GLuint64 )
+{
+ qWarning() << "Fences are not supported by OpenGL 2.0 (since OpenGL 3.2)";
+}
+
+void GraphicsHelperGL2::waitSync(void *)
+{
+ qWarning() << "Fences are not supported by OpenGL 2.0 (since OpenGL 3.2)";
+}
+
+bool GraphicsHelperGL2::wasSyncSignaled(void *)
+{
+ qWarning() << "Fences are not supported by OpenGL 2.0 (since OpenGL 3.2)";
+ return false;
+}
+
+void GraphicsHelperGL2::deleteSync(void *)
+{
+ qWarning() << "Fences are not supported by OpenGL 2.0 (since OpenGL 3.2)";
+}
+
void GraphicsHelperGL2::blendEquation(GLenum mode)
{
m_funcs->glBlendEquation(mode);
@@ -412,6 +439,7 @@ bool GraphicsHelperGL2::supportsFeature(GraphicsHelperInterface::Feature feature
case MRT:
return (m_fboFuncs != nullptr);
case TextureDimensionRetrieval:
+ case MapBuffer:
return true;
default:
return false;
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h
index 2db75004f..b142b2623 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h
+++ b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h
@@ -132,6 +132,12 @@ public:
void readBuffer(GLenum mode) override;
void drawBuffer(GLenum mode) override;
+ void *fenceSync() override;
+ void clientWaitSync(void *sync, GLuint64 nanoSecTimeout) override;
+ void waitSync(void *sync) override;
+ bool wasSyncSignaled(void *sync) override;
+ void deleteSync(void *sync) override;
+
void glUniform1fv(GLint location, GLsizei count, const GLfloat *value) override;
void glUniform2fv(GLint location, GLsizei count, const GLfloat *value) override;
void glUniform3fv(GLint location, GLsizei count, const GLfloat *value) override;
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp
index a35c4e37f..5ff1a2ba5 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp
+++ b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp
@@ -334,6 +334,37 @@ void GraphicsHelperGL3_2::drawBuffer(GLenum mode)
m_funcs->glDrawBuffer(mode);
}
+void *GraphicsHelperGL3_2::fenceSync()
+{
+ return m_funcs->glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
+}
+
+void GraphicsHelperGL3_2::clientWaitSync(void *sync, GLuint64 nanoSecTimeout)
+{
+ m_funcs->glClientWaitSync(static_cast<GLsync>(sync), GL_SYNC_FLUSH_COMMANDS_BIT, nanoSecTimeout);
+}
+
+void GraphicsHelperGL3_2::waitSync(void *sync)
+{
+ m_funcs->glWaitSync(static_cast<GLsync>(sync), 0, GL_TIMEOUT_IGNORED);
+}
+
+bool GraphicsHelperGL3_2::wasSyncSignaled(void *sync)
+{
+ GLint v;
+ m_funcs->glGetSynciv(static_cast<GLsync>(sync),
+ GL_SYNC_STATUS,
+ sizeof(v),
+ nullptr,
+ &v);
+ return v == GL_SIGNALED;
+}
+
+void GraphicsHelperGL3_2::deleteSync(void *sync)
+{
+ m_funcs->glDeleteSync(static_cast<GLsync>(sync));
+}
+
void GraphicsHelperGL3_2::blendEquation(GLenum mode)
{
m_funcs->glBlendEquation(mode);
@@ -481,6 +512,7 @@ bool GraphicsHelperGL3_2::supportsFeature(GraphicsHelperInterface::Feature featu
case TextureDimensionRetrieval:
case BindableFragmentOutputs:
case BlitFramebuffer:
+ case Fences:
return true;
case Tessellation:
return !m_tessFuncs.isNull();
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h
index 133295fd7..9e81345ad 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h
+++ b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h
@@ -134,6 +134,12 @@ public:
void readBuffer(GLenum mode) override;
void drawBuffer(GLenum mode) override;
+ void *fenceSync() override;
+ void clientWaitSync(void *sync, GLuint64 nanoSecTimeout) override;
+ void waitSync(void *sync) override;
+ bool wasSyncSignaled(void *sync) override;
+ void deleteSync(void *sync) override;
+
void glUniform1fv(GLint location, GLsizei count, const GLfloat *value) override;
void glUniform2fv(GLint location, GLsizei count, const GLfloat *value) override;
void glUniform3fv(GLint location, GLsizei count, const GLfloat *value) override;
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp
index b2512d84a..81081943d 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp
+++ b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp
@@ -330,6 +330,37 @@ void GraphicsHelperGL3_3::drawBuffer(GLenum mode)
m_funcs->glDrawBuffer(mode);
}
+void *GraphicsHelperGL3_3::fenceSync()
+{
+ return m_funcs->glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
+}
+
+void GraphicsHelperGL3_3::clientWaitSync(void *sync, GLuint64 nanoSecTimeout)
+{
+ m_funcs->glClientWaitSync(static_cast<GLsync>(sync), GL_SYNC_FLUSH_COMMANDS_BIT, nanoSecTimeout);
+}
+
+void GraphicsHelperGL3_3::waitSync(void *sync)
+{
+ m_funcs->glWaitSync(static_cast<GLsync>(sync), 0, GL_TIMEOUT_IGNORED);
+}
+
+bool GraphicsHelperGL3_3::wasSyncSignaled(void *sync)
+{
+ GLint v;
+ m_funcs->glGetSynciv(static_cast<GLsync>(sync),
+ GL_SYNC_STATUS,
+ sizeof(v),
+ nullptr,
+ &v);
+ return v == GL_SIGNALED;
+}
+
+void GraphicsHelperGL3_3::deleteSync(void *sync)
+{
+ m_funcs->glDeleteSync(static_cast<GLsync>(sync));
+}
+
void GraphicsHelperGL3_3::blendEquation(GLenum mode)
{
m_funcs->glBlendEquation(mode);
@@ -477,6 +508,7 @@ bool GraphicsHelperGL3_3::supportsFeature(GraphicsHelperInterface::Feature featu
case TextureDimensionRetrieval:
case BindableFragmentOutputs:
case BlitFramebuffer:
+ case Fences:
return true;
case Tessellation:
return !m_tessFuncs.isNull();
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h
index 0ecdd3620..c480e5258 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h
+++ b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h
@@ -134,6 +134,12 @@ public:
void readBuffer(GLenum mode) override;
void drawBuffer(GLenum mode) override;
+ void *fenceSync() override;
+ void clientWaitSync(void *sync, GLuint64 nanoSecTimeout) override;
+ void waitSync(void *sync) override;
+ bool wasSyncSignaled(void *sync) override;
+ void deleteSync(void *sync) override;
+
void glUniform1fv(GLint location, GLsizei count, const GLfloat *value) override;
void glUniform2fv(GLint location, GLsizei count, const GLfloat *value) override;
void glUniform3fv(GLint location, GLsizei count, const GLfloat *value) override;
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp
index ce1b8ac2b..22cbf7428 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp
+++ b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp
@@ -400,6 +400,39 @@ void GraphicsHelperGL4::drawBuffer(GLenum mode)
m_funcs->glDrawBuffer(mode);
}
+void *GraphicsHelperGL4::fenceSync()
+{
+ return m_funcs->glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
+}
+
+void GraphicsHelperGL4::clientWaitSync(void *sync, GLuint64 nanoSecTimeout)
+{
+ qDebug() << Q_FUNC_INFO << sync << static_cast<GLsync>(sync);
+ GLenum e = m_funcs->glClientWaitSync(static_cast<GLsync>(sync), GL_SYNC_FLUSH_COMMANDS_BIT, nanoSecTimeout);
+ qDebug() << e;
+}
+
+void GraphicsHelperGL4::waitSync(void *sync)
+{
+ m_funcs->glWaitSync(static_cast<GLsync>(sync), 0, GL_TIMEOUT_IGNORED);
+}
+
+bool GraphicsHelperGL4::wasSyncSignaled(void *sync)
+{
+ GLint v = 0;
+ m_funcs->glGetSynciv(static_cast<GLsync>(sync),
+ GL_SYNC_STATUS,
+ sizeof(v),
+ nullptr,
+ &v);
+ return v == GL_SIGNALED;
+}
+
+void GraphicsHelperGL4::deleteSync(void *sync)
+{
+ m_funcs->glDeleteSync(static_cast<GLsync>(sync));
+}
+
void GraphicsHelperGL4::glUniform1fv(GLint location, GLsizei count, const GLfloat *values)
{
m_funcs->glUniform1fv(location, count, values);
@@ -746,6 +779,8 @@ bool GraphicsHelperGL4::supportsFeature(GraphicsHelperInterface::Feature feature
case DrawBuffersBlend:
case BlitFramebuffer:
case IndirectDrawing:
+ case MapBuffer:
+ case Fences:
return true;
default:
return false;
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl4_p.h b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl4_p.h
index 3020b16d8..da62f4212 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl4_p.h
+++ b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl4_p.h
@@ -132,6 +132,12 @@ public:
void readBuffer(GLenum mode) override;
void drawBuffer(GLenum mode) override;
+ void *fenceSync() override;
+ void clientWaitSync(void *sync, GLuint64 nanoSecTimeout) override;
+ void waitSync(void *sync) override;
+ bool wasSyncSignaled(void *sync) override;
+ void deleteSync(void *sync) override;
+
void glUniform1fv(GLint location, GLsizei count, const GLfloat *value) override;
void glUniform2fv(GLint location, GLsizei count, const GLfloat *value) override;
void glUniform3fv(GLint location, GLsizei count, const GLfloat *value) override;
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelperinterface_p.h b/src/render/renderers/opengl/graphicshelpers/graphicshelperinterface_p.h
index e41325cb7..2a1688b7f 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicshelperinterface_p.h
+++ b/src/render/renderers/opengl/graphicshelpers/graphicshelperinterface_p.h
@@ -82,7 +82,8 @@ public:
DrawBuffersBlend,
BlitFramebuffer,
IndirectDrawing,
- MapBuffer
+ MapBuffer,
+ Fences
};
enum FBOBindMode {
@@ -155,6 +156,12 @@ public:
virtual void readBuffer(GLenum mode) = 0;
virtual void drawBuffer(GLenum mode) = 0;
+ virtual void *fenceSync() = 0;
+ virtual void clientWaitSync(void *sync, GLuint64 nanoSecTimeout) = 0;
+ virtual void waitSync(void *sync) = 0;
+ virtual bool wasSyncSignaled(void *sync) = 0;
+ virtual void deleteSync(void *sync) = 0;
+
virtual void glUniform1fv(GLint location, GLsizei count, const GLfloat *value) = 0;
virtual void glUniform2fv(GLint location, GLsizei count, const GLfloat *value) = 0;
virtual void glUniform3fv(GLint location, GLsizei count, const GLfloat *value) = 0;
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelpers.pri b/src/render/renderers/opengl/graphicshelpers/graphicshelpers.pri
index c40f52374..ad08038c9 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicshelpers.pri
+++ b/src/render/renderers/opengl/graphicshelpers/graphicshelpers.pri
@@ -3,6 +3,7 @@
INCLUDEPATH += $$PWD
HEADERS += \
+ $$PWD/glfence_p.h \
$$PWD/graphicscontext_p.h \
$$PWD/graphicshelperinterface_p.h \
$$PWD/graphicshelperes2_p.h \
diff --git a/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp b/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp
index 59c2d4286..51f7cebd1 100644
--- a/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp
+++ b/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp
@@ -1088,6 +1088,33 @@ void SubmissionContext::clearStencilValue(int stencil)
}
}
+GLFence SubmissionContext::fenceSync()
+{
+ return m_glHelper->fenceSync();
+}
+
+void SubmissionContext::clientWaitSync(GLFence sync, GLuint64 nanoSecTimeout)
+{
+ qDebug() << Q_FUNC_INFO << sync;
+ m_glHelper->clientWaitSync(sync, nanoSecTimeout);
+}
+
+void SubmissionContext::waitSync(GLFence sync)
+{
+ qDebug() << Q_FUNC_INFO << sync;
+ m_glHelper->waitSync(sync);
+}
+
+bool SubmissionContext::wasSyncSignaled(GLFence sync)
+{
+ return m_glHelper->wasSyncSignaled(sync);
+}
+
+void SubmissionContext::deleteSync(GLFence sync)
+{
+ m_glHelper->deleteSync(sync);
+}
+
// It will be easier if the QGraphicContext applies the QUniformPack
// than the other way around
bool SubmissionContext::setParameters(ShaderParameterPack &parameterPack)
@@ -1113,7 +1140,7 @@ bool SubmissionContext::setParameters(ShaderParameterPack &parameterPack)
if (t != nullptr) {
UniformValue &texUniform = uniformValues[namedTex.glslNameId];
if (texUniform.valueType() == UniformValue::TextureValue) {
- const int texUnit = m_textureContext.activateTexture(TextureSubmissionContext::TextureScopeMaterial, t);
+ const int texUnit = m_textureContext.activateTexture(TextureSubmissionContext::TextureScopeMaterial, m_gl, t);
texUniform.data<int>()[namedTex.uniformArrayIndex] = texUnit;
if (texUnit == -1) {
if (namedTex.glslNameId != irradianceId &&
diff --git a/src/render/renderers/opengl/graphicshelpers/submissioncontext_p.h b/src/render/renderers/opengl/graphicshelpers/submissioncontext_p.h
index 9b9bd7fa8..844e62f15 100644
--- a/src/render/renderers/opengl/graphicshelpers/submissioncontext_p.h
+++ b/src/render/renderers/opengl/graphicshelpers/submissioncontext_p.h
@@ -60,6 +60,7 @@
#include <Qt3DRender/qattribute.h>
#include <Qt3DRender/private/handle_types_p.h>
#include <Qt3DRender/private/shadercache_p.h>
+#include <Qt3DRender/private/glfence_p.h>
QT_BEGIN_NAMESPACE
@@ -147,6 +148,14 @@ public:
void clearDepthValue(float depth);
void clearStencilValue(int stencil);
+
+ // Fences
+ GLFence fenceSync();
+ void clientWaitSync(GLFence sync, GLuint64 nanoSecTimeout);
+ void waitSync(GLFence sync);
+ bool wasSyncSignaled(GLFence sync);
+ void deleteSync(GLFence sync);
+
private:
void initialize();
diff --git a/src/render/renderers/opengl/graphicshelpers/texturesubmissioncontext.cpp b/src/render/renderers/opengl/graphicshelpers/texturesubmissioncontext.cpp
index 35fc1dc7c..67d0f9976 100644
--- a/src/render/renderers/opengl/graphicshelpers/texturesubmissioncontext.cpp
+++ b/src/render/renderers/opengl/graphicshelpers/texturesubmissioncontext.cpp
@@ -104,7 +104,9 @@ void TextureSubmissionContext::endDrawing()
TextureExtRendererLocker::unlock(m_activeTextures[i].texture);
}
-int TextureSubmissionContext::activateTexture(TextureSubmissionContext::TextureScope scope, GLTexture *tex)
+int TextureSubmissionContext::activateTexture(TextureSubmissionContext::TextureScope scope,
+ QOpenGLContext *m_gl,
+ GLTexture *tex)
{
// Returns the texture unit to use for the texture
// This always return a valid unit, unless there are more textures than
@@ -115,11 +117,20 @@ int TextureSubmissionContext::activateTexture(TextureSubmissionContext::TextureS
if (onUnit == -1)
return -1;
- // Texture must have been created and updated at this point
- QOpenGLTexture *glTex = tex->getGLTexture();
- if (glTex == nullptr)
- return -1;
- glTex->bind(uint(onUnit));
+ const int sharedTextureId = tex->sharedTextureId();
+ // We have a valid texture id provided by a shared context
+ if (sharedTextureId > 0) {
+ m_gl->functions()->glActiveTexture(GL_TEXTURE0 + onUnit);
+ const QAbstractTexture::Target target = tex->properties().target;
+ // For now we know that target values correspond to the GL values
+ m_gl->functions()->glBindTexture(target, tex->sharedTextureId());
+ } else {
+ // Texture must have been created and updated at this point
+ QOpenGLTexture *glTex = tex->getGLTexture();
+ if (glTex == nullptr)
+ return -1;
+ glTex->bind(uint(onUnit));
+ }
if (m_activeTextures[onUnit].texture != tex) {
if (m_activeTextures[onUnit].texture)
TextureExtRendererLocker::unlock(m_activeTextures[onUnit].texture);
diff --git a/src/render/renderers/opengl/graphicshelpers/texturesubmissioncontext_p.h b/src/render/renderers/opengl/graphicshelpers/texturesubmissioncontext_p.h
index d0c1565b2..3c84fe558 100644
--- a/src/render/renderers/opengl/graphicshelpers/texturesubmissioncontext_p.h
+++ b/src/render/renderers/opengl/graphicshelpers/texturesubmissioncontext_p.h
@@ -57,6 +57,8 @@
QT_BEGIN_NAMESPACE
+class QOpenGLContext;
+
namespace Qt3DRender {
namespace Render {
@@ -78,7 +80,7 @@ public:
void initialize(GraphicsContext *context);
void endDrawing();
- int activateTexture(TextureScope scope, GLTexture* tex);
+ int activateTexture(TextureScope scope, QOpenGLContext *gl, GLTexture* tex);
void deactivateTexture(GLTexture *tex);
void deactivateTexturesWithScope(TextureScope ts);
diff --git a/src/render/renderers/opengl/jobs/filtercompatibletechniquejob_p.h b/src/render/renderers/opengl/jobs/filtercompatibletechniquejob_p.h
index 4f7a7146c..27b3d4ed2 100644
--- a/src/render/renderers/opengl/jobs/filtercompatibletechniquejob_p.h
+++ b/src/render/renderers/opengl/jobs/filtercompatibletechniquejob_p.h
@@ -64,7 +64,7 @@ namespace Render {
class TechniqueManager;
class Renderer;
-class QT3DRENDERSHARED_PRIVATE_EXPORT FilterCompatibleTechniqueJob : public Qt3DCore::QAspectJob
+class Q_3DRENDERSHARED_PRIVATE_EXPORT FilterCompatibleTechniqueJob : public Qt3DCore::QAspectJob
{
public:
FilterCompatibleTechniqueJob();
diff --git a/src/render/renderers/opengl/jobs/materialparametergathererjob_p.h b/src/render/renderers/opengl/jobs/materialparametergathererjob_p.h
index fbfac3364..6ba060841 100644
--- a/src/render/renderers/opengl/jobs/materialparametergathererjob_p.h
+++ b/src/render/renderers/opengl/jobs/materialparametergathererjob_p.h
@@ -70,7 +70,7 @@ class Renderer;
// TO be executed for each FrameGraph branch with a given RenderPassFilter/TechniqueFilter
-class QT3DRENDERSHARED_PRIVATE_EXPORT MaterialParameterGathererJob : public Qt3DCore::QAspectJob
+class Q_3DRENDERSHARED_PRIVATE_EXPORT MaterialParameterGathererJob : public Qt3DCore::QAspectJob
{
public:
MaterialParameterGathererJob();
diff --git a/src/render/renderers/opengl/jobs/renderviewjobutils.cpp b/src/render/renderers/opengl/jobs/renderviewjobutils.cpp
index 49e85e1d3..c2d75b499 100644
--- a/src/render/renderers/opengl/jobs/renderviewjobutils.cpp
+++ b/src/render/renderers/opengl/jobs/renderviewjobutils.cpp
@@ -68,6 +68,7 @@
#include <Qt3DRender/private/techniquemanager_p.h>
#include <Qt3DRender/private/memorybarrier_p.h>
#include <Qt3DRender/private/blitframebuffer_p.h>
+#include <Qt3DRender/private/waitfence_p.h>
QT_BEGIN_NAMESPACE
@@ -274,6 +275,17 @@ void setRenderViewConfigFromFrameGraphLeafNode(RenderView *rv, const FrameGraphN
break;
}
+ case FrameGraphNode::WaitFence: {
+ const Render::WaitFence *waitFence = static_cast<const Render::WaitFence *>(node);
+ rv->appendWaitFence(waitFence->data());
+ break;
+ }
+
+ case FrameGraphNode::SetFence: {
+ rv->appendInsertFenceId(node->peerId());
+ break;
+ }
+
default:
// Should never get here
qCWarning(Backend) << "Unhandled FrameGraphNode type";
diff --git a/src/render/renderers/opengl/renderer/renderer.cpp b/src/render/renderers/opengl/renderer/renderer.cpp
index aeb3e513d..b4a19c641 100644
--- a/src/render/renderers/opengl/renderer/renderer.cpp
+++ b/src/render/renderers/opengl/renderer/renderer.cpp
@@ -91,6 +91,7 @@
#include <Qt3DRender/private/renderviewbuilder_p.h>
#include <Qt3DRender/private/commandthread_p.h>
#include <Qt3DRender/private/glcommands_p.h>
+#include <Qt3DRender/private/setfence_p.h>
#include <Qt3DRender/qcameralens.h>
#include <Qt3DCore/private/qeventfilterservice_p.h>
@@ -197,6 +198,7 @@ Renderer::Renderer(QRenderAspect::RenderType type)
, m_vaoGathererJob(Render::GenericLambdaJobPtr<std::function<void ()>>::create([this] { lookForAbandonedVaos(); }, JobTypes::DirtyVaoGathering))
, m_textureGathererJob(Render::GenericLambdaJobPtr<std::function<void ()>>::create([this] { lookForDirtyTextures(); }, JobTypes::DirtyTextureGathering))
, m_sendTextureChangesToFrontendJob(Render::GenericLambdaJobPtr<std::function<void ()>>::create([this] { sendTextureChangesToFrontend(); }, JobTypes::SendTextureChangesToFrontend))
+ , m_sendSetFenceHandlesToFrontendJob(Render::GenericLambdaJobPtr<std::function<void ()>>::create([this] { sendSetFenceHandlesToFrontend(); }, JobTypes::SendSetFenceHandlesToFrontend))
, m_introspectShaderJob(Render::GenericLambdaJobPtr<std::function<void ()>>::create([this] { reloadDirtyShaders(); }, JobTypes::DirtyShaderGathering))
, m_syncTextureLoadingJob(Render::GenericLambdaJobPtr<std::function<void ()>>::create([] {}, JobTypes::SyncTextureLoading))
, m_ownedContext(false)
@@ -294,6 +296,8 @@ void Renderer::setNodeManagers(NodeManagers *managers)
m_updateShaderDataTransformJob->setManagers(m_nodesManager);
m_cleanupJob->setManagers(m_nodesManager);
m_calculateBoundingVolumeJob->setManagers(m_nodesManager);
+ m_expandBoundingVolumeJob->setManagers(m_nodesManager);
+ m_worldTransformJob->setManagers(m_nodesManager);
m_pickBoundingVolumeJob->setManagers(m_nodesManager);
m_rayCastingJob->setManagers(m_nodesManager);
m_updateWorldBoundingVolumeJob->setManager(m_nodesManager->renderNodesManager());
@@ -303,6 +307,7 @@ void Renderer::setNodeManagers(NodeManagers *managers)
m_updateMeshTriangleListJob->setManagers(m_nodesManager);
m_filterCompatibleTechniqueJob->setManager(m_nodesManager->techniqueManager());
m_updateEntityLayersJob->setManager(m_nodesManager);
+ m_updateTreeEnabledJob->setManagers(m_nodesManager);
m_updateEntityHierarchyJob->setManager(m_nodesManager);
}
@@ -393,6 +398,9 @@ void Renderer::initialize()
[this] { releaseGraphicsResources(); });
}
+ qCDebug(Backend) << "Qt3D shared context:" << ctx->shareContext();
+ qCDebug(Backend) << "Qt global shared context:" << qt_gl_global_share_context();
+
if (!ctx->shareContext()) {
m_shareContext = new QOpenGLContext;
m_shareContext->setFormat(ctx->format());
@@ -1097,7 +1105,7 @@ void Renderer::lookForDirtyTextures()
}
// Dirty meaning that something has changed on the texture
- // either properties, parameters, generator or a texture image
+ // either properties, parameters, shared texture id, generator or a texture image
if (texture->dirtyFlags() != Texture::NotDirty)
m_dirtyTextures.push_back(handle);
// Note: texture dirty flags are reset when actually updating the
@@ -1183,7 +1191,7 @@ void Renderer::reloadDirtyShaders()
// Executed in a job
void Renderer::sendTextureChangesToFrontend()
{
- const QVector<QPair<TextureProperties, Qt3DCore::QNodeIdVector>> updateTextureProperties = std::move(m_updatedTextureProperties);
+ const QVector<QPair<Texture::TextureUpdateInfo, Qt3DCore::QNodeIdVector>> updateTextureProperties = std::move(m_updatedTextureProperties);
for (const auto &pair : updateTextureProperties) {
// Prepare change notification
@@ -1202,6 +1210,22 @@ void Renderer::sendTextureChangesToFrontend()
}
}
+// Executed in a job
+void Renderer::sendSetFenceHandlesToFrontend()
+{
+ const QVector<QPair<Qt3DCore::QNodeId, GLFence>> updatedSetFence = std::move(m_updatedSetFences);
+ FrameGraphManager *fgManager = m_nodesManager->frameGraphManager();
+ for (const auto &pair : updatedSetFence) {
+ FrameGraphNode *fgNode = fgManager->lookupNode(pair.first);
+ if (fgNode != nullptr) { // Node could have been deleted before we got a chance to notify it
+ Q_ASSERT(fgNode->nodeType() == FrameGraphNode::SetFence);
+ SetFence *setFenceNode = static_cast<SetFence *>(fgNode);
+ setFenceNode->setHandleType(QSetFence::OpenGLFenceId);
+ setFenceNode->setHandle(QVariant::fromValue(pair.second));
+ }
+ }
+}
+
// Render Thread (or QtQuick RenderThread when using Scene3D)
// Scene3D: When using Scene3D rendering, we can't assume that when
// updateGLResources is called, the resource handles points to still existing
@@ -1215,6 +1239,25 @@ void Renderer::sendTextureChangesToFrontend()
void Renderer::updateGLResources()
{
{
+ // Update active fence objects:
+ // - Destroy fences that have reached their signaled state
+ GLFenceManager *fenceManager = m_nodesManager->glFenceManager();
+ const auto end = fenceManager->end();
+ auto it = fenceManager->begin();
+ while (it != end) {
+ const GLFence fence = it.value();
+ if (m_submissionContext->wasSyncSignaled(fence)) {
+ // Fence was signaled, we delete it
+ // before removing the entry from the manager
+ m_submissionContext->deleteSync(fence);
+ it = fenceManager->erase(it);
+ } else {
+ ++it;
+ }
+ }
+ }
+
+ {
Profiling::GLTimeRecorder recorder(Profiling::BufferUpload);
const QVector<HBuffer> dirtyBufferHandles = std::move(m_dirtyBuffers);
for (const HBuffer &handle: dirtyBufferHandles) {
@@ -1280,8 +1323,13 @@ void Renderer::updateGLResources()
// Gather these information and store them to be distributed by a change next frame
const QNodeIdVector referenceTextureIds = glTextureManager->referencedTextureIds(glTexture);
// Store properties and referenceTextureIds
- if (info.wasUpdated)
- m_updatedTextureProperties.push_back({info.properties, referenceTextureIds});
+ if (info.wasUpdated) {
+ Texture::TextureUpdateInfo updateInfo;
+ updateInfo.properties = info.properties;
+ updateInfo.handleType = QAbstractTexture::OpenGLTextureId;
+ updateInfo.handle = info.texture ? QVariant(info.texture->textureId()) : QVariant();
+ m_updatedTextureProperties.push_back({updateInfo, referenceTextureIds});
+ }
}
}
}
@@ -1303,18 +1351,21 @@ void Renderer::updateTexture(Texture *texture)
return;
// For implementing unique, non-shared, non-cached textures.
- // for now, every texture is shared by default
+ // for now, every texture is shared by default except if:
+ // - texture is reference by a render attachment
+ // - texture is referencing a shared texture id
+ bool isUnique = texture->sharedTextureId() > 0;
- bool isUnique = false;
-
- // TO DO: Update the vector once per frame (or in a job)
- const QVector<HAttachment> activeRenderTargetOutputs = m_nodesManager->attachmentManager()->activeHandles();
- // A texture is unique if it's being reference by a render target output
- for (const HAttachment &attachmentHandle : activeRenderTargetOutputs) {
- RenderTargetOutput *attachment = m_nodesManager->attachmentManager()->data(attachmentHandle);
- if (attachment->textureUuid() == texture->peerId()) {
- isUnique = true;
- break;
+ if (!isUnique) {
+ // TO DO: Update the vector once per frame (or in a job)
+ const QVector<HAttachment> activeRenderTargetOutputs = m_nodesManager->attachmentManager()->activeHandles();
+ // A texture is unique if it's being reference by a render target output
+ for (const HAttachment &attachmentHandle : activeRenderTargetOutputs) {
+ RenderTargetOutput *attachment = m_nodesManager->attachmentManager()->data(attachmentHandle);
+ if (attachment->textureUuid() == texture->peerId()) {
+ isUnique = true;
+ break;
+ }
}
}
@@ -1361,6 +1412,9 @@ void Renderer::updateTexture(Texture *texture)
// we hold a reference to a unique or exclusive access to a shared texture
// we can thus modify the texture directly.
const Texture::DirtyFlags dirtyFlags = texture->dirtyFlags();
+ if (dirtyFlags.testFlag(Texture::DirtySharedTextureId) &&
+ !glTextureManager->setSharedTextureId(glTexture, texture->sharedTextureId()))
+ qWarning() << "[Qt3DRender::TextureNode] updateTexture: TextureImpl.setSharedTextureId failed, should be non-shared";
if (dirtyFlags.testFlag(Texture::DirtyProperties) &&
!glTextureManager->setProperties(glTexture, texture->properties()))
@@ -1394,6 +1448,7 @@ void Renderer::cleanupTexture(Qt3DCore::QNodeId cleanedUpTextureId)
glTextureManager->abandon(glTexture, cleanedUpTextureId);
}
+// Called by SubmitRenderView
void Renderer::downloadGLBuffers()
{
lookForDownloadableBuffers();
@@ -1478,6 +1533,45 @@ Renderer::ViewSubmissionResultData Renderer::submitRenderViews(const QVector<Ren
if (renderView->memoryBarrier() != QMemoryBarrier::None)
m_submissionContext->memoryBarrier(renderView->memoryBarrier());
+
+ // Insert Fence into command stream if needed
+ const Qt3DCore::QNodeIdVector insertFenceIds = renderView->insertFenceIds();
+ GLFenceManager *fenceManager = m_nodesManager->glFenceManager();
+ for (const Qt3DCore::QNodeId insertFenceId : insertFenceIds) {
+ // If the fence is not in the manager, then it hasn't been inserted
+ // into the command stream yet.
+ if (fenceManager->find(insertFenceId) == fenceManager->end()) {
+ // Insert fence into command stream
+ GLFence glFence = m_submissionContext->fenceSync();
+ // Record glFence
+ fenceManager->insert(insertFenceId, glFence);
+ // Add entry for notification changes to be sent
+ m_updatedSetFences.push_back({insertFenceId, glFence});
+ }
+ // If it is in the manager, then it hasn't been signaled yet,
+ // nothing we can do but try at the next frame
+ }
+
+ // Wait for fences if needed
+ const QVector<QWaitFenceData> waitFences = renderView->waitFences();
+ for (const QWaitFenceData &waitFence : waitFences) {
+ // TO DO
+ if (waitFence.handleType != QWaitFence::OpenGLFenceId) {
+ qWarning() << "WaitFence handleType should be OpenGLFenceId when using the Qt 3D OpenGL renderer";
+ continue;
+ }
+ GLFence fence = reinterpret_cast<GLFence>(waitFence.handle.value<qintptr>());
+ if (fence == nullptr)
+ continue;
+
+ if (waitFence.waitOnCPU) {
+ m_submissionContext->clientWaitSync(fence,
+ waitFence.timeout);
+ } else {
+ m_submissionContext->waitSync(fence);
+ }
+ }
+
// Note: the RenderStateSet is allocated once per RV if needed
// and it contains a list of StateVariant value types
RenderStateSet *renderViewStateSet = renderView->stateSet();
@@ -1642,6 +1736,33 @@ void Renderer::skipNextFrame()
m_submitRenderViewsSemaphore.release(1);
}
+// Jobs we may have to run even if no rendering will happen
+QVector<QAspectJobPtr> Renderer::preRenderingJobs()
+{
+ QVector<QAspectJobPtr> jobs;
+
+ // Do we need to notify any texture about property changes?
+ if (m_updatedTextureProperties.size() > 0)
+ jobs.push_back(m_sendTextureChangesToFrontendJob);
+
+ // Do we need to notify frontend about fence change?
+ if (m_updatedSetFences.size() > 0)
+ jobs.push_back(m_sendSetFenceHandlesToFrontendJob);
+
+ const QVector<Qt3DCore::QNodeId> pendingCaptureIds = takePendingRenderCaptureSendRequests();
+ if (pendingCaptureIds.size() > 0) {
+ m_sendRenderCaptureJob->setPendingCaptureRequests(pendingCaptureIds);
+ jobs.push_back(m_sendRenderCaptureJob);
+ }
+ if (m_sendBufferCaptureJob->hasRequests())
+ jobs.push_back(m_sendBufferCaptureJob);
+
+ jobs.append(pickBoundingVolumeJob());
+ jobs.append(rayCastingJob());
+
+ return jobs;
+}
+
// Waits to be told to create jobs for the next frame
// Called by QRenderAspect jobsToExecute context of QAspectThread
// Returns all the jobs (and with proper dependency chain) required
@@ -1703,17 +1824,6 @@ QVector<Qt3DCore::QAspectJobPtr> Renderer::renderBinJobs()
renderBinJobs.push_back(m_updateLevelOfDetailJob);
renderBinJobs.push_back(m_cleanupJob);
- const QVector<Qt3DCore::QNodeId> pendingCaptureIds = takePendingRenderCaptureSendRequests();
- if (pendingCaptureIds.size() > 0) {
- m_sendRenderCaptureJob->setPendingCaptureRequests(pendingCaptureIds);
- renderBinJobs.push_back(m_sendRenderCaptureJob);
- }
-
- // Do we need to notify any texture about property changes?
- if (m_updatedTextureProperties.size() > 0)
- renderBinJobs.push_back(m_sendTextureChangesToFrontendJob);
-
- renderBinJobs.push_back(m_sendBufferCaptureJob);
renderBinJobs.append(bufferJobs);
// Jobs to prepare GL Resource upload
diff --git a/src/render/renderers/opengl/renderer/renderer_p.h b/src/render/renderers/opengl/renderer/renderer_p.h
index 6443215a4..5b5f5c4f4 100644
--- a/src/render/renderers/opengl/renderer/renderer_p.h
+++ b/src/render/renderers/opengl/renderer/renderer_p.h
@@ -81,6 +81,7 @@
#include <Qt3DRender/private/updateentityhierarchyjob_p.h>
#include <Qt3DRender/private/renderercache_p.h>
#include <Qt3DRender/private/texture_p.h>
+#include <Qt3DRender/private/glfence_p.h>
#include <QHash>
#include <QMatrix4x4>
@@ -97,6 +98,10 @@
#include <functional>
+#if defined(QT_BUILD_INTERNAL)
+class tst_Renderer;
+#endif
+
QT_BEGIN_NAMESPACE
class QSurface;
@@ -153,7 +158,7 @@ typedef QSharedPointer<UpdateLevelOfDetailJob> UpdateLevelOfDetailJobPtr;
using SynchronizerJobPtr = GenericLambdaJobPtr<std::function<void()>>;
using IntrospectShadersJobPtr = GenericLambdaJobPtr<std::function<void()>>;
-class QT3DRENDERSHARED_PRIVATE_EXPORT Renderer : public AbstractRenderer
+class Q_3DRENDERSHARED_PRIVATE_EXPORT Renderer : public AbstractRenderer
{
public:
explicit Renderer(QRenderAspect::RenderType type);
@@ -197,6 +202,7 @@ public:
bool shouldRender() override;
void skipNextFrame() override;
+ QVector<Qt3DCore::QAspectJobPtr> preRenderingJobs() override;
QVector<Qt3DCore::QAspectJobPtr> renderBinJobs() override;
Qt3DCore::QAspectJobPtr pickBoundingVolumeJob() override;
Qt3DCore::QAspectJobPtr rayCastingJob() override;
@@ -376,6 +382,7 @@ private:
GenericLambdaJobPtr<std::function<void ()>> m_vaoGathererJob;
GenericLambdaJobPtr<std::function<void ()>> m_textureGathererJob;
GenericLambdaJobPtr<std::function<void ()>> m_sendTextureChangesToFrontendJob;
+ GenericLambdaJobPtr<std::function<void ()>> m_sendSetFenceHandlesToFrontendJob;
IntrospectShadersJobPtr m_introspectShaderJob;
SynchronizerJobPtr m_syncTextureLoadingJob;
@@ -386,6 +393,7 @@ private:
void lookForDirtyTextures();
void reloadDirtyShaders();
void sendTextureChangesToFrontend();
+ void sendSetFenceHandlesToFrontend();
QMutex m_abandonedVaosMutex;
QVector<HVao> m_abandonedVaos;
@@ -394,7 +402,8 @@ private:
QVector<HBuffer> m_downloadableBuffers;
QVector<HShader> m_dirtyShaders;
QVector<HTexture> m_dirtyTextures;
- QVector<QPair<TextureProperties, Qt3DCore::QNodeIdVector>> m_updatedTextureProperties;
+ QVector<QPair<Texture::TextureUpdateInfo, Qt3DCore::QNodeIdVector>> m_updatedTextureProperties;
+ QVector<QPair<Qt3DCore::QNodeId, GLFence>> m_updatedSetFences;
bool m_ownedContext;
@@ -406,6 +415,10 @@ private:
friend class Qt3DRender::Debug::CommandExecuter;
#endif
+#ifdef QT_BUILD_INTERNAL
+ friend class ::tst_Renderer;
+#endif
+
QMetaObject::Connection m_contextConnection;
RendererCache m_cache;
};
diff --git a/src/render/renderers/opengl/renderer/renderview.cpp b/src/render/renderers/opengl/renderer/renderview.cpp
index 62758bb53..9bbf966c8 100644
--- a/src/render/renderers/opengl/renderer/renderview.cpp
+++ b/src/render/renderers/opengl/renderer/renderview.cpp
@@ -712,6 +712,11 @@ QVector<RenderCommand *> RenderView::buildComputeRenderCommands(const QVector<En
if ((computeJob = entity->renderComponent<ComputeCommand>()) != nullptr
&& computeJob->isEnabled()) {
+ // Note: if frameCount has reached 0 in the previous frame, isEnabled
+ // would be false
+ if (computeJob->runType() == QComputeCommand::Manual)
+ computeJob->updateFrameCount();
+
const Qt3DCore::QNodeId materialComponentId = entity->componentUuid<Material>();
const QVector<RenderPassParameterData> renderPassData = m_parameters.value(materialComponentId);
diff --git a/src/render/renderers/opengl/renderer/renderview_p.h b/src/render/renderers/opengl/renderer/renderview_p.h
index cb3c74917..7ebcdb6bd 100644
--- a/src/render/renderers/opengl/renderer/renderview_p.h
+++ b/src/render/renderers/opengl/renderer/renderview_p.h
@@ -65,6 +65,7 @@
#include <Qt3DRender/private/qmemorybarrier_p.h>
#include <Qt3DRender/private/qrendercapture_p.h>
#include <Qt3DRender/private/qblitframebuffer_p.h>
+#include <Qt3DRender/private/qwaitfence_p.h>
#include <Qt3DCore/private/qframeallocator_p.h>
#include <Qt3DRender/private/aligned_malloc_p.h>
@@ -174,6 +175,13 @@ public:
inline void appendProximityFilterId(const Qt3DCore::QNodeId proximityFilterId) { m_data.m_proximityFilterIds.push_back(proximityFilterId); }
inline Qt3DCore::QNodeIdVector proximityFilterIds() const { return m_data.m_proximityFilterIds; }
+ inline void appendInsertFenceId(const Qt3DCore::QNodeId setFenceId) { m_insertFenceIds.push_back(setFenceId); }
+ // We prefix with get to avoid confusion when it is called
+ inline Qt3DCore::QNodeIdVector insertFenceIds() const { return m_insertFenceIds; }
+
+ inline void appendWaitFence(const QWaitFenceData &data) { m_waitFences.push_back(data); }
+ inline QVector<QWaitFenceData> waitFences() const { return m_waitFences; }
+
inline void setRenderPassFilter(const RenderPassFilter *rpFilter) Q_DECL_NOTHROW { m_data.m_passFilter = rpFilter; }
inline const RenderPassFilter *renderPassFilter() const Q_DECL_NOTHROW { return m_data.m_passFilter; }
@@ -320,6 +328,8 @@ private:
bool m_frustumCulling:1;
int m_workGroups[3];
QMemoryBarrier::Operations m_memoryBarrier;
+ QVector<Qt3DCore::QNodeId> m_insertFenceIds;
+ QVector<QWaitFenceData> m_waitFences;
// 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
diff --git a/src/render/renderers/opengl/textures/gltexture.cpp b/src/render/renderers/opengl/textures/gltexture.cpp
index ce212de03..42deb4c2a 100644
--- a/src/render/renderers/opengl/textures/gltexture.cpp
+++ b/src/render/renderers/opengl/textures/gltexture.cpp
@@ -57,6 +57,11 @@
#include <Qt3DCore/qpropertynodeaddedchange.h>
#include <Qt3DCore/qpropertynoderemovedchange.h>
+#if !defined(QT_OPENGL_ES_2)
+#include <QOpenGLFunctions_3_1>
+#include <QOpenGLFunctions_4_5_Core>
+#endif
+
QT_BEGIN_NAMESPACE
using namespace Qt3DCore;
@@ -75,6 +80,7 @@ GLTexture::GLTexture(TextureDataManager *texDataMgr,
, m_textureImageDataManager(texImgDataMgr)
, m_dataFunctor(texGen)
, m_pendingDataFunctor(nullptr)
+ , m_sharedTextureId(-1)
, m_externalRendering(false)
{
// make sure texture generator is executed
@@ -181,39 +187,44 @@ GLTexture::TextureUpdateInfo GLTexture::createOrUpdateGLTexture()
m_properties.status = QAbstractTexture::Error;
- // on the first invocation in the render thread, make sure to
- // evaluate the texture data generator output
- // (this might change some property values)
- if (m_dataFunctor && !m_textureData) {
- const bool successfullyLoadedTextureData = loadTextureDataFromGenerator();
- if (successfullyLoadedTextureData) {
- setDirtyFlag(Properties, true);
- needUpload = true;
- } else {
- if (m_pendingDataFunctor != m_dataFunctor.get()) {
- qWarning() << "[Qt3DRender::GLTexture] No QTextureData generated from Texture Generator yet. Texture will be invalid for this frame";
- m_pendingDataFunctor = m_dataFunctor.get();
+ const bool hasSharedTextureId = m_sharedTextureId > 0;
+
+ // Only load texture data if we are not using a sharedTextureId
+ if (!hasSharedTextureId) {
+ // on the first invocation in the render thread, make sure to
+ // evaluate the texture data generator output
+ // (this might change some property values)
+ if (m_dataFunctor && !m_textureData) {
+ const bool successfullyLoadedTextureData = loadTextureDataFromGenerator();
+ if (successfullyLoadedTextureData) {
+ setDirtyFlag(Properties, true);
+ needUpload = true;
+ } else {
+ if (m_pendingDataFunctor != m_dataFunctor.get()) {
+ qWarning() << "[Qt3DRender::GLTexture] No QTextureData generated from Texture Generator yet. Texture will be invalid for this frame";
+ m_pendingDataFunctor = m_dataFunctor.get();
+ }
+ textureInfo.properties.status = QAbstractTexture::Loading;
+ return textureInfo;
}
- textureInfo.properties.status = QAbstractTexture::Loading;
- return textureInfo;
}
- }
- // additional texture images may be defined through image data generators
- if (testDirtyFlag(TextureData)) {
- m_imageData.clear();
- loadTextureDataFromImages();
- needUpload = true;
- }
+ // additional texture images may be defined through image data generators
+ if (testDirtyFlag(TextureData)) {
+ m_imageData.clear();
+ loadTextureDataFromImages();
+ needUpload = true;
+ }
- // don't try to create the texture if the format was not set
- if (m_properties.format == QAbstractTexture::Automatic) {
- textureInfo.properties.status = QAbstractTexture::Error;
- return textureInfo;
+ // don't try to create the texture if the format was not set
+ if (m_properties.format == QAbstractTexture::Automatic) {
+ textureInfo.properties.status = QAbstractTexture::Error;
+ return textureInfo;
+ }
}
// if the properties changed, we need to re-allocate the texture
- if (testDirtyFlag(Properties)) {
+ if (testDirtyFlag(Properties) || testDirtyFlag(SharedTextureId)) {
delete m_gl;
m_gl = nullptr;
textureInfo.wasUpdated = true;
@@ -223,40 +234,48 @@ GLTexture::TextureUpdateInfo GLTexture::createOrUpdateGLTexture()
needUpload = true;
}
+ m_properties.status = QAbstractTexture::Ready;
- if (!m_gl) {
- m_gl = buildGLTexture();
+ if (hasSharedTextureId && testDirtyFlag(SharedTextureId)) {
+ // Update m_properties by doing introspection on the texture
+ introspectPropertiesFromSharedTextureId();
+ } else {
+ // We only build a QOpenGLTexture if we have no shared textureId set
if (!m_gl) {
- textureInfo.properties.status = QAbstractTexture::Error;
- return textureInfo;
- }
+ m_gl = buildGLTexture();
+ if (!m_gl) {
+ textureInfo.properties.status = QAbstractTexture::Error;
+ return textureInfo;
+ }
- m_gl->allocateStorage();
- if (!m_gl->isStorageAllocated()) {
- textureInfo.properties.status = QAbstractTexture::Error;
- return textureInfo;
+ m_gl->allocateStorage();
+ if (!m_gl->isStorageAllocated()) {
+ textureInfo.properties.status = QAbstractTexture::Error;
+ return textureInfo;
+ }
}
- }
- m_properties.status = QAbstractTexture::Ready;
- textureInfo.properties = m_properties;
- textureInfo.texture = m_gl;
+ textureInfo.texture = m_gl;
- // need to (re-)upload texture data?
- if (needUpload) {
- uploadGLTextureData();
- setDirtyFlag(TextureData, false);
- }
+ // need to (re-)upload texture data?
+ if (needUpload) {
+ uploadGLTextureData();
+ setDirtyFlag(TextureData, false);
+ }
- // need to set texture parameters?
- if (testDirtyFlag(Properties) || testDirtyFlag(Parameters)) {
- updateGLTextureParameters();
+ // need to set texture parameters?
+ if (testDirtyFlag(Properties) || testDirtyFlag(Parameters)) {
+ updateGLTextureParameters();
+ }
}
+ textureInfo.properties = m_properties;
+
// un-set properties and parameters. The TextureData flag might have been set by another thread
// in the meantime, so don't clear that.
setDirtyFlag(Properties, false);
setDirtyFlag(Parameters, false);
+ setDirtyFlag(SharedTextureId, false);
return textureInfo;
}
@@ -355,6 +374,14 @@ void GLTexture::setGenerator(const QTextureGeneratorPtr &generator)
}
}
+void GLTexture::setSharedTextureId(int textureId)
+{
+ if (m_sharedTextureId != textureId) {
+ m_sharedTextureId = textureId;
+ setDirtyFlag(SharedTextureId);
+ }
+}
+
// Return nullptr if
// - context cannot be obtained
// - texture hasn't yet been loaded
@@ -403,8 +430,8 @@ QOpenGLTexture *GLTexture::buildGLTexture()
// is written against GLES 1.0.
if (m_properties.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")))
+ || ctx->hasExtension(QByteArrayLiteral("GL_OES_compressed_ETC2_RGB8_texture"))
+ || ctx->hasExtension(QByteArrayLiteral("GL_ARB_ES3_compatibility")))
format = m_properties.format = QAbstractTexture::RGB8_ETC2;
}
@@ -414,14 +441,14 @@ QOpenGLTexture *GLTexture::buildGLTexture()
glTex->setSize(m_properties.width, m_properties.height, m_properties.depth);
// Set layers count if texture array
if (m_actualTarget == QAbstractTexture::Target1DArray ||
- m_actualTarget == QAbstractTexture::Target2DArray ||
- m_actualTarget == QAbstractTexture::Target2DMultisampleArray ||
- m_actualTarget == QAbstractTexture::TargetCubeMapArray) {
+ m_actualTarget == QAbstractTexture::Target2DArray ||
+ m_actualTarget == QAbstractTexture::Target2DMultisampleArray ||
+ m_actualTarget == QAbstractTexture::TargetCubeMapArray) {
glTex->setLayers(m_properties.layers);
}
if (m_actualTarget == QAbstractTexture::Target2DMultisample ||
- m_actualTarget == QAbstractTexture::Target2DMultisampleArray) {
+ m_actualTarget == QAbstractTexture::Target2DMultisampleArray) {
// Set samples count if multisampled texture
// (multisampled textures don't have mipmaps)
glTex->setSamples(m_properties.samples);
@@ -497,8 +524,8 @@ void GLTexture::updateGLTextureParameters()
{
m_gl->setWrapMode(QOpenGLTexture::DirectionS, static_cast<QOpenGLTexture::WrapMode>(m_parameters.wrapModeX));
if (m_actualTarget != QAbstractTexture::Target1D &&
- m_actualTarget != QAbstractTexture::Target1DArray &&
- m_actualTarget != QAbstractTexture::TargetBuffer)
+ m_actualTarget != QAbstractTexture::Target1DArray &&
+ m_actualTarget != QAbstractTexture::TargetBuffer)
m_gl->setWrapMode(QOpenGLTexture::DirectionT, static_cast<QOpenGLTexture::WrapMode>(m_parameters.wrapModeY));
if (m_actualTarget == QAbstractTexture::Target3D)
m_gl->setWrapMode(QOpenGLTexture::DirectionR, static_cast<QOpenGLTexture::WrapMode>(m_parameters.wrapModeZ));
@@ -512,6 +539,129 @@ void GLTexture::updateGLTextureParameters()
}
}
+void GLTexture::introspectPropertiesFromSharedTextureId()
+{
+ // We know that the context is active when this function is called
+ QOpenGLContext *ctx = QOpenGLContext::currentContext();
+ if (!ctx) {
+ qWarning() << Q_FUNC_INFO << "requires an OpenGL context";
+ return;
+ }
+ QOpenGLFunctions *gl = ctx->functions();
+
+ // If the user has set the target format himself, we won't try to deduce it
+ if (m_properties.target != QAbstractTexture::TargetAutomatic)
+ return;
+
+ const QAbstractTexture::Target targets[] = {
+ QAbstractTexture::Target2D,
+ QAbstractTexture::TargetCubeMap,
+#ifndef QT_OPENGL_ES_2
+ QAbstractTexture::Target1D,
+ QAbstractTexture::Target1DArray,
+ QAbstractTexture::Target3D,
+ QAbstractTexture::Target2DArray,
+ QAbstractTexture::TargetCubeMapArray,
+ QAbstractTexture::Target2DMultisample,
+ QAbstractTexture::Target2DMultisampleArray,
+ QAbstractTexture::TargetRectangle,
+ QAbstractTexture::TargetBuffer,
+#endif
+ };
+
+#ifndef QT_OPENGL_ES_2
+ // Try to find texture target with GL 4.5 functions
+ const QPair<int, int> ctxGLVersion = ctx->format().version();
+ if (ctxGLVersion.first > 4 || (ctxGLVersion.first == 4 && ctxGLVersion.second >= 5)) {
+ // Only for GL 4.5+
+ QOpenGLFunctions_4_5_Core *gl5 = ctx->versionFunctions<QOpenGLFunctions_4_5_Core>();
+#ifdef GL_TEXTURE_TARGET
+ if (gl5 != nullptr)
+ gl5->glGetTextureParameteriv(m_sharedTextureId, GL_TEXTURE_TARGET, reinterpret_cast<int *>(&m_properties.target));
+#endif
+ }
+#endif
+
+ // If GL 4.5 function unavailable or not working, try a slower way
+ if (m_properties.target == QAbstractTexture::TargetAutomatic) {
+ // // OpenGL offers no proper way of querying for the target of a texture given its id
+ gl->glActiveTexture(GL_TEXTURE0);
+
+ const GLenum targetBindings[] = {
+ GL_TEXTURE_BINDING_2D,
+ GL_TEXTURE_BINDING_CUBE_MAP,
+#ifndef QT_OPENGL_ES_2
+ GL_TEXTURE_BINDING_1D,
+ GL_TEXTURE_BINDING_1D_ARRAY,
+ GL_TEXTURE_BINDING_3D,
+ GL_TEXTURE_BINDING_2D_ARRAY,
+ GL_TEXTURE_BINDING_CUBE_MAP_ARRAY,
+ GL_TEXTURE_BINDING_2D_MULTISAMPLE,
+ GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY,
+ GL_TEXTURE_BINDING_RECTANGLE,
+ GL_TEXTURE_BINDING_BUFFER
+#endif
+ };
+
+ Q_ASSERT(sizeof(targetBindings) / sizeof(targetBindings[0] == sizeof(targets) / sizeof(targets[0])));
+
+ for (uint i = 0; i < sizeof(targetBindings) / sizeof(targetBindings[0]); ++i) {
+ const int target = targets[i];
+ gl->glBindTexture(target, m_sharedTextureId);
+ int boundId = 0;
+ gl->glGetIntegerv(targetBindings[i], &boundId);
+ gl->glBindTexture(target, 0);
+ if (boundId == m_sharedTextureId) {
+ m_properties.target = static_cast<QAbstractTexture::Target>(target);
+ break;
+ }
+ }
+ }
+
+ // Return early if we weren't able to find texture target
+ if (std::find(std::begin(targets), std::end(targets), m_properties.target) == std::end(targets)) {
+ qWarning() << "Unable to determine texture target for shared GL texture";
+ return;
+ }
+
+ // Bind texture once we know its target
+ gl->glBindTexture(m_properties.target, m_sharedTextureId);
+
+ // TO DO: Improve by using glGetTextureParameters when available which
+ // support direct state access
+#ifndef GL_TEXTURE_MAX_LEVEL
+#define GL_TEXTURE_MAX_LEVEL 0x813D
+#endif
+
+#ifndef GL_TEXTURE_WRAP_R
+#define GL_TEXTURE_WRAP_R 0x8072
+#endif
+
+ gl->glGetTexParameteriv(int(m_properties.target), GL_TEXTURE_MAX_LEVEL, reinterpret_cast<int *>(&m_properties.mipLevels));
+ gl->glGetTexParameteriv(int(m_properties.target), GL_TEXTURE_MIN_FILTER, reinterpret_cast<int *>(&m_parameters.minificationFilter));
+ gl->glGetTexParameteriv(int(m_properties.target), GL_TEXTURE_MAG_FILTER, reinterpret_cast<int *>(&m_parameters.magnificationFilter));
+ gl->glGetTexParameteriv(int(m_properties.target), GL_TEXTURE_WRAP_R, reinterpret_cast<int *>(&m_parameters.wrapModeX));
+ gl->glGetTexParameteriv(int(m_properties.target), GL_TEXTURE_WRAP_S, reinterpret_cast<int *>(&m_parameters.wrapModeY));
+ gl->glGetTexParameteriv(int(m_properties.target), GL_TEXTURE_WRAP_T, reinterpret_cast<int *>(&m_parameters.wrapModeZ));
+
+#ifndef QT_OPENGL_ES_2
+ // Try to retrieve dimensions (not available on ES 2.0)
+ if (!ctx->isOpenGLES()) {
+ QOpenGLFunctions_3_1 *gl3 = ctx->versionFunctions<QOpenGLFunctions_3_1>();
+ if (!gl3) {
+ qWarning() << "Failed to retrieve shared texture dimensions";
+ return;
+ }
+
+ gl3->glGetTexLevelParameteriv(int(m_properties.target), 0, GL_TEXTURE_WIDTH, reinterpret_cast<int *>(&m_properties.width));
+ gl3->glGetTexLevelParameteriv(int(m_properties.target), 0, GL_TEXTURE_HEIGHT, reinterpret_cast<int *>(&m_properties.height));
+ gl3->glGetTexLevelParameteriv(int(m_properties.target), 0, GL_TEXTURE_DEPTH, reinterpret_cast<int *>(&m_properties.depth));
+ gl3->glGetTexLevelParameteriv(int(m_properties.target), 0, GL_TEXTURE_INTERNAL_FORMAT, reinterpret_cast<int *>(&m_properties.format));
+ }
+#endif
+
+ gl->glBindTexture(m_properties.target, 0);
+}
} // namespace Render
} // namespace Qt3DRender
diff --git a/src/render/renderers/opengl/textures/gltexture_p.h b/src/render/renderers/opengl/textures/gltexture_p.h
index ca9c0d5db..66f66926c 100644
--- a/src/render/renderers/opengl/textures/gltexture_p.h
+++ b/src/render/renderers/opengl/textures/gltexture_p.h
@@ -125,6 +125,7 @@ public:
inline TextureProperties properties() const { return m_properties; }
inline TextureParameters parameters() const { return m_parameters; }
inline QTextureGeneratorPtr textureGenerator() const { return m_dataFunctor; }
+ inline int sharedTextureId() const { return m_sharedTextureId; }
inline QVector<Image> images() const { return m_images; }
inline QSize size() const { return QSize(m_properties.width, m_properties.height); }
@@ -204,14 +205,15 @@ protected:
void setProperties(const TextureProperties &props);
void setImages(const QVector<Image> &images);
void setGenerator(const QTextureGeneratorPtr &generator);
+ void setSharedTextureId(int textureId);
private:
enum DirtyFlag {
TextureData = 0x01, // one or more image generators have been executed, data needs uploading to GPU
Properties = 0x02, // texture needs to be (re-)created
- Parameters = 0x04 // texture parameters need to be (re-)set
-
+ Parameters = 0x04, // texture parameters need to be (re-)set
+ SharedTextureId = 0x08 // texture id from shared context
};
bool testDirtyFlag(DirtyFlag flag)
@@ -232,6 +234,7 @@ private:
void loadTextureDataFromImages();
void uploadGLTextureData();
void updateGLTextureParameters();
+ void introspectPropertiesFromSharedTextureId();
void destroyResources();
bool m_unique;
@@ -257,6 +260,7 @@ private:
QTextureDataPtr m_textureData;
QVector<QTextureImageDataPtr> m_imageData;
+ int m_sharedTextureId;
bool m_externalRendering;
};
diff --git a/src/render/renderstates/qalphacoverage.h b/src/render/renderstates/qalphacoverage.h
index 53636d300..7c4e1c2c8 100644
--- a/src/render/renderstates/qalphacoverage.h
+++ b/src/render/renderstates/qalphacoverage.h
@@ -49,7 +49,7 @@ namespace Qt3DRender {
class QAlphaCoveragePrivate;
-class QT3DRENDERSHARED_EXPORT QAlphaCoverage : public QRenderState
+class Q_3DRENDERSHARED_EXPORT QAlphaCoverage : public QRenderState
{
Q_OBJECT
public:
diff --git a/src/render/renderstates/qalphatest.h b/src/render/renderstates/qalphatest.h
index 8545d2043..7ec14eaee 100644
--- a/src/render/renderstates/qalphatest.h
+++ b/src/render/renderstates/qalphatest.h
@@ -49,7 +49,7 @@ namespace Qt3DRender {
class QAlphaTestPrivate;
-class QT3DRENDERSHARED_EXPORT QAlphaTest : public QRenderState
+class Q_3DRENDERSHARED_EXPORT QAlphaTest : public QRenderState
{
Q_OBJECT
Q_PROPERTY(AlphaFunction alphaFunction READ alphaFunction WRITE setAlphaFunction NOTIFY alphaFunctionChanged)
diff --git a/src/render/renderstates/qblendequation.h b/src/render/renderstates/qblendequation.h
index d084113d7..69a06768d 100644
--- a/src/render/renderstates/qblendequation.h
+++ b/src/render/renderstates/qblendequation.h
@@ -49,7 +49,7 @@ namespace Qt3DRender {
class QBlendEquationPrivate;
-class QT3DRENDERSHARED_EXPORT QBlendEquation : public QRenderState
+class Q_3DRENDERSHARED_EXPORT QBlendEquation : public QRenderState
{
Q_OBJECT
Q_PROPERTY(BlendFunction blendFunction READ blendFunction WRITE setBlendFunction NOTIFY blendFunctionChanged)
diff --git a/src/render/renderstates/qblendequation_p.h b/src/render/renderstates/qblendequation_p.h
index 228e61f15..c8a65de11 100644
--- a/src/render/renderstates/qblendequation_p.h
+++ b/src/render/renderstates/qblendequation_p.h
@@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_PRIVATE_EXPORT QBlendEquationPrivate : public QRenderStatePrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QBlendEquationPrivate : public QRenderStatePrivate
{
public:
QBlendEquationPrivate()
diff --git a/src/render/renderstates/qblendequationarguments.h b/src/render/renderstates/qblendequationarguments.h
index 1b2e039f7..e454dbae5 100644
--- a/src/render/renderstates/qblendequationarguments.h
+++ b/src/render/renderstates/qblendequationarguments.h
@@ -49,7 +49,7 @@ namespace Qt3DRender {
class QBlendEquationArgumentsPrivate;
-class QT3DRENDERSHARED_EXPORT QBlendEquationArguments : public QRenderState
+class Q_3DRENDERSHARED_EXPORT QBlendEquationArguments : public QRenderState
{
Q_OBJECT
Q_PROPERTY(Blending sourceRgb READ sourceRgb WRITE setSourceRgb NOTIFY sourceRgbChanged)
diff --git a/src/render/renderstates/qblendequationarguments_p.h b/src/render/renderstates/qblendequationarguments_p.h
index 110039295..d2aae69c7 100644
--- a/src/render/renderstates/qblendequationarguments_p.h
+++ b/src/render/renderstates/qblendequationarguments_p.h
@@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_PRIVATE_EXPORT QBlendEquationArgumentsPrivate : public QRenderStatePrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QBlendEquationArgumentsPrivate : public QRenderStatePrivate
{
public:
QBlendEquationArgumentsPrivate(Render::StateMask type = Render::BlendEquationArgumentsMask)
diff --git a/src/render/renderstates/qclipplane.h b/src/render/renderstates/qclipplane.h
index fa210d668..94bfaa57d 100644
--- a/src/render/renderstates/qclipplane.h
+++ b/src/render/renderstates/qclipplane.h
@@ -49,7 +49,7 @@ namespace Qt3DRender {
class QClipPlanePrivate;
-class QT3DRENDERSHARED_EXPORT QClipPlane : public QRenderState
+class Q_3DRENDERSHARED_EXPORT QClipPlane : public QRenderState
{
Q_OBJECT
Q_PROPERTY(int planeIndex READ planeIndex WRITE setPlaneIndex NOTIFY planeIndexChanged)
diff --git a/src/render/renderstates/qclipplane_p.h b/src/render/renderstates/qclipplane_p.h
index 517831e10..9c59675c6 100644
--- a/src/render/renderstates/qclipplane_p.h
+++ b/src/render/renderstates/qclipplane_p.h
@@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_PRIVATE_EXPORT QClipPlanePrivate : public QRenderStatePrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QClipPlanePrivate : public QRenderStatePrivate
{
public:
QClipPlanePrivate()
diff --git a/src/render/renderstates/qcolormask.h b/src/render/renderstates/qcolormask.h
index 7d28e80c6..980cde5ac 100644
--- a/src/render/renderstates/qcolormask.h
+++ b/src/render/renderstates/qcolormask.h
@@ -48,7 +48,7 @@ namespace Qt3DRender {
class QColorMaskPrivate;
-class QT3DRENDERSHARED_EXPORT QColorMask : public QRenderState
+class Q_3DRENDERSHARED_EXPORT QColorMask : public QRenderState
{
Q_OBJECT
Q_PROPERTY(bool redMasked READ isRedMasked WRITE setRedMasked NOTIFY redMaskedChanged)
diff --git a/src/render/renderstates/qcolormask_p.h b/src/render/renderstates/qcolormask_p.h
index 1e2386eb9..bd041de3b 100644
--- a/src/render/renderstates/qcolormask_p.h
+++ b/src/render/renderstates/qcolormask_p.h
@@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_PRIVATE_EXPORT QColorMaskPrivate : public QRenderStatePrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QColorMaskPrivate : public QRenderStatePrivate
{
public:
QColorMaskPrivate()
diff --git a/src/render/renderstates/qcullface.h b/src/render/renderstates/qcullface.h
index ab60d342e..053e86215 100644
--- a/src/render/renderstates/qcullface.h
+++ b/src/render/renderstates/qcullface.h
@@ -50,7 +50,7 @@ namespace Qt3DRender {
class QCullFacePrivate;
-class QT3DRENDERSHARED_EXPORT QCullFace : public QRenderState
+class Q_3DRENDERSHARED_EXPORT QCullFace : public QRenderState
{
Q_OBJECT
Q_PROPERTY(CullingMode mode READ mode WRITE setMode NOTIFY modeChanged)
diff --git a/src/render/renderstates/qcullface_p.h b/src/render/renderstates/qcullface_p.h
index 98cf99454..fd85b27a7 100644
--- a/src/render/renderstates/qcullface_p.h
+++ b/src/render/renderstates/qcullface_p.h
@@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_PRIVATE_EXPORT QCullFacePrivate : public QRenderStatePrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QCullFacePrivate : public QRenderStatePrivate
{
public:
QCullFacePrivate()
diff --git a/src/render/renderstates/qdepthtest.h b/src/render/renderstates/qdepthtest.h
index 91c06c649..419c36b57 100644
--- a/src/render/renderstates/qdepthtest.h
+++ b/src/render/renderstates/qdepthtest.h
@@ -49,7 +49,7 @@ namespace Qt3DRender {
class QDepthTestPrivate;
-class QT3DRENDERSHARED_EXPORT QDepthTest : public QRenderState
+class Q_3DRENDERSHARED_EXPORT QDepthTest : public QRenderState
{
Q_OBJECT
Q_PROPERTY(DepthFunction depthFunction READ depthFunction WRITE setDepthFunction NOTIFY depthFunctionChanged)
diff --git a/src/render/renderstates/qdepthtest_p.h b/src/render/renderstates/qdepthtest_p.h
index 555be2d4a..82689a50f 100644
--- a/src/render/renderstates/qdepthtest_p.h
+++ b/src/render/renderstates/qdepthtest_p.h
@@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_PRIVATE_EXPORT QDepthTestPrivate : public QRenderStatePrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QDepthTestPrivate : public QRenderStatePrivate
{
public :
QDepthTestPrivate()
diff --git a/src/render/renderstates/qdithering.h b/src/render/renderstates/qdithering.h
index db6667f8a..4f118977d 100644
--- a/src/render/renderstates/qdithering.h
+++ b/src/render/renderstates/qdithering.h
@@ -49,7 +49,7 @@ namespace Qt3DRender {
class QDitheringPrivate;
-class QT3DRENDERSHARED_EXPORT QDithering : public QRenderState
+class Q_3DRENDERSHARED_EXPORT QDithering : public QRenderState
{
Q_OBJECT
public:
diff --git a/src/render/renderstates/qfrontface.h b/src/render/renderstates/qfrontface.h
index 9ef32d8ed..10cc9b422 100644
--- a/src/render/renderstates/qfrontface.h
+++ b/src/render/renderstates/qfrontface.h
@@ -49,7 +49,7 @@ namespace Qt3DRender {
class QFrontFacePrivate;
-class QT3DRENDERSHARED_EXPORT QFrontFace : public QRenderState
+class Q_3DRENDERSHARED_EXPORT QFrontFace : public QRenderState
{
Q_OBJECT
Q_PROPERTY(WindingDirection direction READ direction WRITE setDirection NOTIFY directionChanged)
diff --git a/src/render/renderstates/qfrontface_p.h b/src/render/renderstates/qfrontface_p.h
index 3849714fd..605e78196 100644
--- a/src/render/renderstates/qfrontface_p.h
+++ b/src/render/renderstates/qfrontface_p.h
@@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_PRIVATE_EXPORT QFrontFacePrivate : public QRenderStatePrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QFrontFacePrivate : public QRenderStatePrivate
{
public:
QFrontFacePrivate()
diff --git a/src/render/renderstates/qlinewidth.h b/src/render/renderstates/qlinewidth.h
index 764ebc82a..3e53a5f29 100644
--- a/src/render/renderstates/qlinewidth.h
+++ b/src/render/renderstates/qlinewidth.h
@@ -47,7 +47,7 @@ namespace Qt3DRender {
class QLineWidthPrivate;
-class QT3DRENDERSHARED_EXPORT QLineWidth : public QRenderState
+class Q_3DRENDERSHARED_EXPORT QLineWidth : public QRenderState
{
Q_OBJECT
Q_PROPERTY(float value READ value WRITE setValue NOTIFY valueChanged)
diff --git a/src/render/renderstates/qmultisampleantialiasing.h b/src/render/renderstates/qmultisampleantialiasing.h
index 087f32ce2..5ac0dfdb5 100644
--- a/src/render/renderstates/qmultisampleantialiasing.h
+++ b/src/render/renderstates/qmultisampleantialiasing.h
@@ -48,7 +48,7 @@ namespace Qt3DRender {
class QMultiSampleAntiAliasingPrivate;
-class QT3DRENDERSHARED_EXPORT QMultiSampleAntiAliasing : public QRenderState
+class Q_3DRENDERSHARED_EXPORT QMultiSampleAntiAliasing : public QRenderState
{
Q_OBJECT
diff --git a/src/render/renderstates/qnodepthmask.h b/src/render/renderstates/qnodepthmask.h
index 20171595e..221052699 100644
--- a/src/render/renderstates/qnodepthmask.h
+++ b/src/render/renderstates/qnodepthmask.h
@@ -49,7 +49,7 @@ namespace Qt3DRender {
class QNoDepthMaskPrivate;
-class QT3DRENDERSHARED_EXPORT QNoDepthMask : public QRenderState
+class Q_3DRENDERSHARED_EXPORT QNoDepthMask : public QRenderState
{
Q_OBJECT
public:
diff --git a/src/render/renderstates/qpointsize.h b/src/render/renderstates/qpointsize.h
index 7e50a7953..49fdd5c9c 100644
--- a/src/render/renderstates/qpointsize.h
+++ b/src/render/renderstates/qpointsize.h
@@ -47,7 +47,7 @@ namespace Qt3DRender {
class QPointSizePrivate;
-class QT3DRENDERSHARED_EXPORT QPointSize : public QRenderState
+class Q_3DRENDERSHARED_EXPORT QPointSize : public QRenderState
{
Q_OBJECT
Q_PROPERTY(SizeMode sizeMode READ sizeMode WRITE setSizeMode NOTIFY sizeModeChanged)
diff --git a/src/render/renderstates/qpointsize_p.h b/src/render/renderstates/qpointsize_p.h
index eb669b131..fab7baf30 100644
--- a/src/render/renderstates/qpointsize_p.h
+++ b/src/render/renderstates/qpointsize_p.h
@@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_PRIVATE_EXPORT QPointSizePrivate : public QRenderStatePrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QPointSizePrivate : public QRenderStatePrivate
{
public:
QPointSizePrivate(QPointSize::SizeMode sizeMode, float value)
diff --git a/src/render/renderstates/qpolygonoffset.h b/src/render/renderstates/qpolygonoffset.h
index f89203c6b..9ba18f2e4 100644
--- a/src/render/renderstates/qpolygonoffset.h
+++ b/src/render/renderstates/qpolygonoffset.h
@@ -48,7 +48,7 @@ namespace Qt3DRender {
class QPolygonOffsetPrivate;
-class QT3DRENDERSHARED_EXPORT QPolygonOffset : public QRenderState
+class Q_3DRENDERSHARED_EXPORT QPolygonOffset : public QRenderState
{
Q_OBJECT
diff --git a/src/render/renderstates/qpolygonoffset_p.h b/src/render/renderstates/qpolygonoffset_p.h
index 66a62674e..11edaf445 100644
--- a/src/render/renderstates/qpolygonoffset_p.h
+++ b/src/render/renderstates/qpolygonoffset_p.h
@@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_PRIVATE_EXPORT QPolygonOffsetPrivate : public QRenderStatePrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QPolygonOffsetPrivate : public QRenderStatePrivate
{
public:
QPolygonOffsetPrivate()
diff --git a/src/render/renderstates/qrenderstate.h b/src/render/renderstates/qrenderstate.h
index 6892432be..3b7ff03bc 100644
--- a/src/render/renderstates/qrenderstate.h
+++ b/src/render/renderstates/qrenderstate.h
@@ -50,7 +50,7 @@ namespace Qt3DRender {
class QRenderStatePrivate;
-class QT3DRENDERSHARED_EXPORT QRenderState : public Qt3DCore::QNode
+class Q_3DRENDERSHARED_EXPORT QRenderState : public Qt3DCore::QNode
{
Q_OBJECT
public:
diff --git a/src/render/renderstates/qrenderstate_p.h b/src/render/renderstates/qrenderstate_p.h
index c3457afd7..e43097020 100644
--- a/src/render/renderstates/qrenderstate_p.h
+++ b/src/render/renderstates/qrenderstate_p.h
@@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_PRIVATE_EXPORT QRenderStatePrivate : public Qt3DCore::QNodePrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QRenderStatePrivate : public Qt3DCore::QNodePrivate
{
public:
explicit QRenderStatePrivate(Render::StateMask type);
diff --git a/src/render/renderstates/qscissortest.h b/src/render/renderstates/qscissortest.h
index f94e997f8..c808dc1c6 100644
--- a/src/render/renderstates/qscissortest.h
+++ b/src/render/renderstates/qscissortest.h
@@ -49,7 +49,7 @@ namespace Qt3DRender {
class QScissorTestPrivate;
-class QT3DRENDERSHARED_EXPORT QScissorTest : public QRenderState
+class Q_3DRENDERSHARED_EXPORT QScissorTest : public QRenderState
{
Q_OBJECT
Q_PROPERTY(int left READ left WRITE setLeft NOTIFY leftChanged)
diff --git a/src/render/renderstates/qscissortest_p.h b/src/render/renderstates/qscissortest_p.h
index 7c7bfdfe0..eebf3c326 100644
--- a/src/render/renderstates/qscissortest_p.h
+++ b/src/render/renderstates/qscissortest_p.h
@@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_PRIVATE_EXPORT QScissorTestPrivate : public QRenderStatePrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QScissorTestPrivate : public QRenderStatePrivate
{
public:
QScissorTestPrivate()
diff --git a/src/render/renderstates/qseamlesscubemap.h b/src/render/renderstates/qseamlesscubemap.h
index 40ae0a955..d2f63a8df 100644
--- a/src/render/renderstates/qseamlesscubemap.h
+++ b/src/render/renderstates/qseamlesscubemap.h
@@ -48,7 +48,7 @@ namespace Qt3DRender {
class QSeamlessCubemapPrivate;
-class QT3DRENDERSHARED_EXPORT QSeamlessCubemap : public QRenderState
+class Q_3DRENDERSHARED_EXPORT QSeamlessCubemap : public QRenderState
{
Q_OBJECT
diff --git a/src/render/renderstates/qstencilmask.h b/src/render/renderstates/qstencilmask.h
index 5f6e3b686..08396a86f 100644
--- a/src/render/renderstates/qstencilmask.h
+++ b/src/render/renderstates/qstencilmask.h
@@ -48,7 +48,7 @@ namespace Qt3DRender {
class QStencilMaskPrivate;
-class QT3DRENDERSHARED_EXPORT QStencilMask : public QRenderState
+class Q_3DRENDERSHARED_EXPORT QStencilMask : public QRenderState
{
Q_OBJECT
Q_PROPERTY(uint frontOutputMask READ frontOutputMask WRITE setFrontOutputMask NOTIFY frontOutputMaskChanged)
diff --git a/src/render/renderstates/qstencilmask_p.h b/src/render/renderstates/qstencilmask_p.h
index 762b249f8..c9af3d7f1 100644
--- a/src/render/renderstates/qstencilmask_p.h
+++ b/src/render/renderstates/qstencilmask_p.h
@@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_PRIVATE_EXPORT QStencilMaskPrivate : public QRenderStatePrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QStencilMaskPrivate : public QRenderStatePrivate
{
public:
QStencilMaskPrivate()
diff --git a/src/render/renderstates/qstenciloperation.h b/src/render/renderstates/qstenciloperation.h
index 889bb73dc..90c7da7ba 100644
--- a/src/render/renderstates/qstenciloperation.h
+++ b/src/render/renderstates/qstenciloperation.h
@@ -49,7 +49,7 @@ namespace Qt3DRender {
class QStencilOperationPrivate;
class QStencilOperationArguments;
-class QT3DRENDERSHARED_EXPORT QStencilOperation : public QRenderState
+class Q_3DRENDERSHARED_EXPORT QStencilOperation : public QRenderState
{
Q_OBJECT
Q_PROPERTY(Qt3DRender::QStencilOperationArguments *front READ front CONSTANT)
diff --git a/src/render/renderstates/qstenciloperation_p.h b/src/render/renderstates/qstenciloperation_p.h
index dbce734b1..a1c0cda4a 100644
--- a/src/render/renderstates/qstenciloperation_p.h
+++ b/src/render/renderstates/qstenciloperation_p.h
@@ -64,7 +64,7 @@ struct QStencilOperationData
QStencilOperationArgumentsData back;
};
-class QT3DRENDERSHARED_PRIVATE_EXPORT QStencilOperationPrivate : public QRenderStatePrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QStencilOperationPrivate : public QRenderStatePrivate
{
public:
QStencilOperationPrivate()
diff --git a/src/render/renderstates/qstenciloperationarguments.h b/src/render/renderstates/qstenciloperationarguments.h
index 9705c9822..e8e23c6fe 100644
--- a/src/render/renderstates/qstenciloperationarguments.h
+++ b/src/render/renderstates/qstenciloperationarguments.h
@@ -50,7 +50,7 @@ namespace Qt3DRender {
class QStencilOperationPrivate;
class QStencilOperationArgumentsPrivate;
-class QT3DRENDERSHARED_EXPORT QStencilOperationArguments : public QObject
+class Q_3DRENDERSHARED_EXPORT QStencilOperationArguments : public QObject
{
Q_OBJECT
Q_PROPERTY(FaceMode faceMode READ faceMode NOTIFY faceModeChanged)
diff --git a/src/render/renderstates/qstenciloperationarguments_p.h b/src/render/renderstates/qstenciloperationarguments_p.h
index 3babd3373..b24ddf09d 100644
--- a/src/render/renderstates/qstenciloperationarguments_p.h
+++ b/src/render/renderstates/qstenciloperationarguments_p.h
@@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_PRIVATE_EXPORT QStencilOperationArgumentsPrivate : public QObjectPrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QStencilOperationArgumentsPrivate : public QObjectPrivate
{
public:
QStencilOperationArgumentsPrivate(QStencilOperationArguments::FaceMode mode)
diff --git a/src/render/renderstates/qstenciltest.h b/src/render/renderstates/qstenciltest.h
index 0178ef968..f17baa23f 100644
--- a/src/render/renderstates/qstenciltest.h
+++ b/src/render/renderstates/qstenciltest.h
@@ -50,7 +50,7 @@ namespace Qt3DRender {
class QStencilTestPrivate;
class QStencilTestArguments;
-class QT3DRENDERSHARED_EXPORT QStencilTest : public QRenderState
+class Q_3DRENDERSHARED_EXPORT QStencilTest : public QRenderState
{
Q_OBJECT
Q_PROPERTY(Qt3DRender::QStencilTestArguments *front READ front CONSTANT)
diff --git a/src/render/renderstates/qstenciltest_p.h b/src/render/renderstates/qstenciltest_p.h
index 838ba5bc0..328e34878 100644
--- a/src/render/renderstates/qstenciltest_p.h
+++ b/src/render/renderstates/qstenciltest_p.h
@@ -64,7 +64,7 @@ struct QStencilTestData
QStencilTestArgumentsData back;
};
-class QT3DRENDERSHARED_PRIVATE_EXPORT QStencilTestPrivate : public QRenderStatePrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QStencilTestPrivate : public QRenderStatePrivate
{
public:
QStencilTestPrivate()
diff --git a/src/render/renderstates/qstenciltestarguments.h b/src/render/renderstates/qstenciltestarguments.h
index 35447d477..92696806d 100644
--- a/src/render/renderstates/qstenciltestarguments.h
+++ b/src/render/renderstates/qstenciltestarguments.h
@@ -50,7 +50,7 @@ namespace Qt3DRender {
class QStencilTestPrivate;
class QStencilTestArgumentsPrivate;
-class QT3DRENDERSHARED_EXPORT QStencilTestArguments : public QObject
+class Q_3DRENDERSHARED_EXPORT QStencilTestArguments : public QObject
{
Q_OBJECT
Q_PROPERTY(StencilFaceMode faceMode READ faceMode NOTIFY faceModeChanged)
diff --git a/src/render/renderstates/qstenciltestarguments_p.h b/src/render/renderstates/qstenciltestarguments_p.h
index 662301843..9a85c93a6 100644
--- a/src/render/renderstates/qstenciltestarguments_p.h
+++ b/src/render/renderstates/qstenciltestarguments_p.h
@@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_PRIVATE_EXPORT QStencilTestArgumentsPrivate : public QObjectPrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QStencilTestArgumentsPrivate : public QObjectPrivate
{
public:
QStencilTestArgumentsPrivate(QStencilTestArguments::StencilFaceMode face)
diff --git a/src/render/texture/apitexturemanager_p.h b/src/render/texture/apitexturemanager_p.h
index 58e6e6420..79dc9af94 100644
--- a/src/render/texture/apitexturemanager_p.h
+++ b/src/render/texture/apitexturemanager_p.h
@@ -257,6 +257,19 @@ public:
return true;
}
+ // Change the texture's referenced texture Id from a shared context
+ bool setSharedTextureId(APITexture *tex, int textureId)
+ {
+ Q_ASSERT(tex);
+
+ if (isShared(tex))
+ return false;
+
+ tex->setSharedTextureId(textureId);
+ m_updatedTextures.push_back(tex);
+ return true;
+ }
+
// Retrieves abandoned textures. This should be regularly called from the OpenGL thread
// to make sure needed GL resources are de-allocated.
QVector<APITexture*> takeAbandonedTextures()
@@ -344,6 +357,7 @@ private:
newTex->setProperties(node->properties());
newTex->setParameters(node->parameters());
newTex->setImages(texImgs);
+ newTex->setSharedTextureId(node->sharedTextureId());
m_updatedTextures.push_back(newTex);
diff --git a/src/render/texture/qabstracttexture.cpp b/src/render/texture/qabstracttexture.cpp
index 03746620e..751b6691f 100644
--- a/src/render/texture/qabstracttexture.cpp
+++ b/src/render/texture/qabstracttexture.cpp
@@ -66,6 +66,9 @@ QAbstractTexturePrivate::QAbstractTexturePrivate()
, m_comparisonMode(QAbstractTexture::CompareNone)
, m_layers(1)
, m_samples(1)
+ , m_sharedTextureId(-1)
+ , m_handleType(QAbstractTexture::NoHandle)
+ , m_handle(QVariant())
{
}
@@ -414,7 +417,7 @@ void QAbstractTexture::setDepth(int depth)
}
/*!
- * \return the width of the texture
+ * Returns the width of the texture
*/
int QAbstractTexture::width() const
{
@@ -423,7 +426,7 @@ int QAbstractTexture::width() const
}
/*!
- * \return the height of the texture
+ * Returns the height of the texture
*/
int QAbstractTexture::height() const
{
@@ -432,7 +435,7 @@ int QAbstractTexture::height() const
}
/*!
- * \return the depth of the texture
+ * Returns the depth of the texture
*/
int QAbstractTexture::depth() const
{
@@ -462,7 +465,7 @@ void QAbstractTexture::setLayers(int layers)
}
/*!
- \return the maximum number of layers for the texture provider.
+ 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.
@@ -495,7 +498,7 @@ void QAbstractTexture::setSamples(int samples)
}
/*!
- \return the number of samples per texel for the texture provider.
+ Returns the number of samples per texel for the texture provider.
\note this has a meaning only for texture providers that have multisample
formats.
@@ -561,7 +564,35 @@ void QAbstractTexture::setStatus(Status status)
}
/*!
- * \return the current status of the texture provider.
+ * \internal
+ */
+void QAbstractTexture::setHandle(const QVariant &handle)
+{
+ Q_D(QAbstractTexture);
+ if (d->m_handle != handle) {
+ d->m_handle = handle;
+ const bool blocked = blockNotifications(true);
+ emit handleChanged(handle);
+ blockNotifications(blocked);
+ }
+}
+
+/*!
+ * \internal
+ */
+void QAbstractTexture::setHandleType(QAbstractTexture::HandleType type)
+{
+ Q_D(QAbstractTexture);
+ if (d->m_handleType != type) {
+ d->m_handleType = type;
+ const bool blocked = blockNotifications(true);
+ emit handleTypeChanged(type);
+ blockNotifications(blocked);
+ }
+}
+
+/*!
+ * Returns the current status of the texture provider.
*/
QAbstractTexture::Status QAbstractTexture::status() const
{
@@ -663,7 +694,7 @@ void QAbstractTexture::removeTextureImage(QAbstractTextureImage *textureImage)
}
/*!
- \return a list of pointers to QAbstractTextureImage objects contained in
+ Returns a list of pointers to QAbstractTextureImage objects contained in
the texture provider.
*/
QVector<QAbstractTextureImage *> QAbstractTexture::textureImages() const
@@ -817,7 +848,7 @@ void QAbstractTexture::setMaximumAnisotropy(float anisotropy)
}
/*!
- * \return the current maximum anisotropy
+ * Returns the current maximum anisotropy
*/
float QAbstractTexture::maximumAnisotropy() const
{
@@ -826,7 +857,7 @@ float QAbstractTexture::maximumAnisotropy() const
}
/*!
- \property Qt3DRender::QAbstractTexture::comparisonFunction
+ \property Qt3DRender::QAbstractTexture::ComparisonFunction
Holds the comparison function of the texture provider.
*/
@@ -843,7 +874,7 @@ void QAbstractTexture::setComparisonFunction(QAbstractTexture::ComparisonFunctio
}
/*!
- * \return the current comparison function.
+ * Returns the current comparison function.
*/
QAbstractTexture::ComparisonFunction QAbstractTexture::comparisonFunction() const
{
@@ -852,7 +883,7 @@ QAbstractTexture::ComparisonFunction QAbstractTexture::comparisonFunction() cons
}
/*!
- \property Qt3DRender::QAbstractTexture::comparisonMode
+ \property Qt3DRender::QAbstractTexture::ComparisonMode
Holds the comparison mode of the texture provider.
*/
@@ -869,7 +900,7 @@ void QAbstractTexture::setComparisonMode(QAbstractTexture::ComparisonMode mode)
}
/*!
- * \return the current comparison mode.
+ * Returns the current comparison mode.
*/
QAbstractTexture::ComparisonMode QAbstractTexture::comparisonMode() const
{
@@ -878,7 +909,7 @@ QAbstractTexture::ComparisonMode QAbstractTexture::comparisonMode() const
}
/*!
- * \return the current data generator.
+ * Returns the current data generator.
*/
QTextureGeneratorPtr QAbstractTexture::dataGenerator() const
{
@@ -886,6 +917,55 @@ QTextureGeneratorPtr QAbstractTexture::dataGenerator() const
return d->m_dataFunctor;
}
+/*!
+ * \property Qt3DRender::QAbstractTexture::handleType
+ *
+ * Holds the current texture handle type.
+ */
+
+/*!
+ * \qmlproperty handleType
+ *
+ * Holds the current texture handle type.
+ */
+
+/*!
+ * \return the current texture handle type.
+ * \since 5.13
+ */
+QAbstractTexture::HandleType QAbstractTexture::handleType() const
+{
+ Q_D(const QAbstractTexture);
+ return d->m_handleType;
+}
+
+
+/*!
+ * \property Qt3DRender::QAbstractTexture::handle
+ *
+ * Holds the current texture handle, if Qt 3D is using the OpenGL renderer,
+ * handle is a texture id integer.
+ */
+
+/*!
+ * \qmlproperty handle
+ *
+ * Holds the current texture handle, if Qt 3D is using the OpenGL renderer,
+ * handle is a texture id integer.
+ */
+
+/*!
+ * \return the current texture handle, if Qt 3D is using the OpenGL renderer,
+ * handle is a texture id integer.
+ *
+ * \since 5.13
+ */
+QVariant QAbstractTexture::handle() const
+{
+ Q_D(const QAbstractTexture);
+ return d->m_handle;
+}
+
Qt3DCore::QNodeCreatedChangeBasePtr QAbstractTexture::createNodeCreationChange() const
{
auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QAbstractTextureData>::create(this);
@@ -909,9 +989,13 @@ Qt3DCore::QNodeCreatedChangeBasePtr QAbstractTexture::createNodeCreationChange()
data.layers = d->m_layers;
data.samples = d->m_samples;
data.dataFunctor = d->m_dataFunctor;
+ data.sharedTextureId = d->m_sharedTextureId;
return creationChange;
}
+/*!
+ A function for receiving and processing a \a change.
+*/
void QAbstractTexture::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
{
switch (change->type()) {
@@ -941,6 +1025,10 @@ void QAbstractTexture::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
bool blocked = blockNotifications(true);
setStatus(static_cast<QAbstractTexture::Status>(propertyChange->value().toInt()));
blockNotifications(blocked);
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("handleType")) {
+ setHandleType(static_cast<QAbstractTexture::HandleType>(propertyChange->value().toInt()));
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("handle")) {
+ setHandle(propertyChange->value());
}
// TODO handle target changes, it's a CONSTANT property but can be affected by loader
break;
diff --git a/src/render/texture/qabstracttexture.h b/src/render/texture/qabstracttexture.h
index f17633710..6097e4449 100644
--- a/src/render/texture/qabstracttexture.h
+++ b/src/render/texture/qabstracttexture.h
@@ -55,7 +55,7 @@ class QTextureGenerator;
typedef QSharedPointer<QTextureGenerator> QTextureGeneratorPtr;
-class QT3DRENDERSHARED_EXPORT QAbstractTexture : public Qt3DCore::QNode
+class Q_3DRENDERSHARED_EXPORT QAbstractTexture : public Qt3DCore::QNode
{
Q_OBJECT
Q_PROPERTY(Target target READ target CONSTANT)
@@ -73,6 +73,8 @@ class QT3DRENDERSHARED_EXPORT QAbstractTexture : public Qt3DCore::QNode
Q_PROPERTY(ComparisonMode comparisonMode READ comparisonMode WRITE setComparisonMode NOTIFY comparisonModeChanged)
Q_PROPERTY(int layers READ layers WRITE setLayers NOTIFY layersChanged)
Q_PROPERTY(int samples READ samples WRITE setSamples NOTIFY samplesChanged)
+ Q_PROPERTY(HandleType handleType READ handleType NOTIFY handleTypeChanged REVISION 13)
+ Q_PROPERTY(QVariant handle READ handle NOTIFY handleChanged REVISION 13)
public:
@@ -268,6 +270,12 @@ public:
};
Q_ENUM(ComparisonMode) // LCOV_EXCL_LINE
+ enum HandleType {
+ NoHandle,
+ OpenGLTextureId
+ };
+ Q_ENUM(HandleType) // LCOV_EXCL_LINE
+
~QAbstractTexture();
Target target() const;
@@ -298,6 +306,8 @@ public:
int layers() const;
int samples() const;
QTextureGeneratorPtr dataGenerator() const;
+ HandleType handleType() const;
+ QVariant handle() const;
public Q_SLOTS:
void setFormat(TextureFormat format);
@@ -327,6 +337,8 @@ Q_SIGNALS:
void comparisonModeChanged(ComparisonMode comparisonMode);
void layersChanged(int layers);
void samplesChanged(int samples);
+ Q_REVISION(13) void handleTypeChanged(HandleType handleType);
+ Q_REVISION(13) void handleChanged(QVariant handle);
protected:
explicit QAbstractTexture(Qt3DCore::QNode *parent = nullptr);
@@ -335,6 +347,8 @@ protected:
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override;
void setStatus(Status status);
+ void setHandle(const QVariant &handle);
+ void setHandleType(HandleType type);
private:
Q_DECLARE_PRIVATE(QAbstractTexture)
diff --git a/src/render/texture/qabstracttexture_p.h b/src/render/texture/qabstracttexture_p.h
index a27ae3729..f4bdecacc 100644
--- a/src/render/texture/qabstracttexture_p.h
+++ b/src/render/texture/qabstracttexture_p.h
@@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_PRIVATE_EXPORT QAbstractTexturePrivate : public Qt3DCore::QNodePrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QAbstractTexturePrivate : public Qt3DCore::QNodePrivate
{
public :
QAbstractTexturePrivate();
@@ -87,6 +87,11 @@ public :
int m_layers;
int m_samples;
+ int m_sharedTextureId;
+
+ QAbstractTexture::HandleType m_handleType;
+ QVariant m_handle;
+
QTextureGeneratorPtr dataFunctor() const;
void setDataFunctor(const QTextureGeneratorPtr &generator);
@@ -113,6 +118,7 @@ struct QAbstractTextureData
Qt3DCore::QNodeIdVector textureImageIds;
int layers;
int samples;
+ int sharedTextureId;
QTextureGeneratorPtr dataFunctor;
};
diff --git a/src/render/texture/qabstracttextureimage.h b/src/render/texture/qabstracttextureimage.h
index 7e840fdd4..e072a26dc 100644
--- a/src/render/texture/qabstracttextureimage.h
+++ b/src/render/texture/qabstracttextureimage.h
@@ -49,7 +49,7 @@ namespace Qt3DRender {
class QAbstractTextureImagePrivate;
-class QT3DRENDERSHARED_EXPORT QAbstractTextureImage : public Qt3DCore::QNode
+class Q_3DRENDERSHARED_EXPORT QAbstractTextureImage : public Qt3DCore::QNode
{
Q_OBJECT
Q_PROPERTY(int mipLevel READ mipLevel WRITE setMipLevel NOTIFY mipLevelChanged)
diff --git a/src/render/texture/qabstracttextureimage_p.h b/src/render/texture/qabstracttextureimage_p.h
index f0d836055..a5299acd7 100644
--- a/src/render/texture/qabstracttextureimage_p.h
+++ b/src/render/texture/qabstracttextureimage_p.h
@@ -61,7 +61,7 @@ namespace Qt3DRender {
class QAbstractTextureImage;
-class QT3DRENDERSHARED_PRIVATE_EXPORT QAbstractTextureImagePrivate : public Qt3DCore::QNodePrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QAbstractTextureImagePrivate : public Qt3DCore::QNodePrivate
{
public:
QAbstractTextureImagePrivate();
diff --git a/src/render/texture/qpaintedtextureimage.h b/src/render/texture/qpaintedtextureimage.h
index 5b884a42e..1e8cf90ae 100644
--- a/src/render/texture/qpaintedtextureimage.h
+++ b/src/render/texture/qpaintedtextureimage.h
@@ -50,7 +50,7 @@ namespace Qt3DRender {
class QPaintedTextureImagePrivate;
-class QT3DRENDERSHARED_EXPORT QPaintedTextureImage : public QAbstractTextureImage
+class Q_3DRENDERSHARED_EXPORT QPaintedTextureImage : public QAbstractTextureImage
{
Q_OBJECT
Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged)
diff --git a/src/render/texture/qpaintedtextureimage_p.h b/src/render/texture/qpaintedtextureimage_p.h
index 4e554f1c1..48553323d 100644
--- a/src/render/texture/qpaintedtextureimage_p.h
+++ b/src/render/texture/qpaintedtextureimage_p.h
@@ -63,7 +63,7 @@ class QPainter;
namespace Qt3DRender {
-class QT3DRENDERSHARED_PRIVATE_EXPORT QPaintedTextureImagePrivate : public QAbstractTextureImagePrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QPaintedTextureImagePrivate : public QAbstractTextureImagePrivate
{
public:
QPaintedTextureImagePrivate();
diff --git a/src/render/texture/qtexture.cpp b/src/render/texture/qtexture.cpp
index f8b34451f..0e652c6ff 100644
--- a/src/render/texture/qtexture.cpp
+++ b/src/render/texture/qtexture.cpp
@@ -1487,6 +1487,69 @@ bool QTextureFromSourceGenerator::isMirrored() const
return m_mirrored;
}
+/*!
+ * \class QSharedGLTexture
+ * \brief Allows to use a textureId from a separate OpenGL context in a Qt 3D scene.
+ *
+ * Depending on the rendering mode used by Qt 3D, the shared context will either be:
+ * \list
+ * \li qt_gl_global_share_context when letting Qt 3D drive the rendering. When
+ * setting the attribute Qt::AA_ShareOpenGLContexts on the QApplication class,
+ * this will automatically make QOpenGLWidget instances have their context shared
+ * with qt_gl_global_share_context.
+ * \li the shared context from the QtQuick scene. You might have to subclass
+ * QWindow or use QtQuickRenderControl to have control over what that shared
+ * context is though as of 5.13 it is qt_gl_global_share_context.
+ * \endlist
+ *
+ * \since 5.13
+ *
+ * Any 3rd party engine that shares its context with the Qt 3D renderer can now
+ * provide texture ids that will be referenced by the Qt 3D texture.
+ *
+ * You can omit specifying the texture properties, Qt 3D will try at runtime to
+ * determine what they are. If you know them, you can of course provide them,
+ * avoid additional work for Qt 3D.
+ *
+ * Keep in mind that if you are using custom materials and shaders, you need to
+ * specify the correct sampler type to be used.
+ */
+
+QSharedGLTexture::QSharedGLTexture(Qt3DCore::QNode *parent)
+ : QAbstractTexture(parent)
+{
+ QAbstractTexturePrivate *d = static_cast<QAbstractTexturePrivate *>(Qt3DCore::QNodePrivate::get(this));
+ d->m_target = TargetAutomatic;
+}
+
+QSharedGLTexture::~QSharedGLTexture()
+{
+}
+
+/*!
+ * \qmlproperty textureId
+ *
+ * The OpenGL texture id value that you want Qt3D to gain access to.
+ */
+/*!
+ *\property Qt3DRender::QSharedGLTexture::textureId
+ *
+ * The OpenGL texture id value that you want Qt3D to gain access to.
+ */
+int QSharedGLTexture::textureId() const
+{
+ return static_cast<QAbstractTexturePrivate *>(d_ptr.get())->m_sharedTextureId;
+}
+
+void QSharedGLTexture::setTextureId(int id)
+{
+ QAbstractTexturePrivate *d = static_cast<QAbstractTexturePrivate *>(Qt3DCore::QNodePrivate::get(this));
+ if (d->m_sharedTextureId != id) {
+ d->m_sharedTextureId = id;
+ emit textureIdChanged(id);
+ }
+}
+
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/texture/qtexture.h b/src/render/texture/qtexture.h
index 24d19fbcf..7556c6fc4 100644
--- a/src/render/texture/qtexture.h
+++ b/src/render/texture/qtexture.h
@@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_EXPORT QTexture1D : public QAbstractTexture
+class Q_3DRENDERSHARED_EXPORT QTexture1D : public QAbstractTexture
{
Q_OBJECT
public:
@@ -63,7 +63,7 @@ public:
~QTexture1D();
};
-class QT3DRENDERSHARED_EXPORT QTexture1DArray : public QAbstractTexture
+class Q_3DRENDERSHARED_EXPORT QTexture1DArray : public QAbstractTexture
{
Q_OBJECT
public:
@@ -71,7 +71,7 @@ public:
~QTexture1DArray();
};
-class QT3DRENDERSHARED_EXPORT QTexture2D : public QAbstractTexture
+class Q_3DRENDERSHARED_EXPORT QTexture2D : public QAbstractTexture
{
Q_OBJECT
public:
@@ -79,7 +79,7 @@ public:
~QTexture2D();
};
-class QT3DRENDERSHARED_EXPORT QTexture2DArray : public QAbstractTexture
+class Q_3DRENDERSHARED_EXPORT QTexture2DArray : public QAbstractTexture
{
Q_OBJECT
public:
@@ -87,7 +87,7 @@ public:
~QTexture2DArray();
};
-class QT3DRENDERSHARED_EXPORT QTexture3D : public QAbstractTexture
+class Q_3DRENDERSHARED_EXPORT QTexture3D : public QAbstractTexture
{
Q_OBJECT
public:
@@ -95,7 +95,7 @@ public:
~QTexture3D();
};
-class QT3DRENDERSHARED_EXPORT QTextureCubeMap : public QAbstractTexture
+class Q_3DRENDERSHARED_EXPORT QTextureCubeMap : public QAbstractTexture
{
Q_OBJECT
public:
@@ -103,7 +103,7 @@ public:
~QTextureCubeMap();
};
-class QT3DRENDERSHARED_EXPORT QTextureCubeMapArray : public QAbstractTexture
+class Q_3DRENDERSHARED_EXPORT QTextureCubeMapArray : public QAbstractTexture
{
Q_OBJECT
public:
@@ -111,7 +111,7 @@ public:
~QTextureCubeMapArray();
};
-class QT3DRENDERSHARED_EXPORT QTexture2DMultisample : public QAbstractTexture
+class Q_3DRENDERSHARED_EXPORT QTexture2DMultisample : public QAbstractTexture
{
Q_OBJECT
public:
@@ -119,7 +119,7 @@ public:
~QTexture2DMultisample();
};
-class QT3DRENDERSHARED_EXPORT QTexture2DMultisampleArray : public QAbstractTexture
+class Q_3DRENDERSHARED_EXPORT QTexture2DMultisampleArray : public QAbstractTexture
{
Q_OBJECT
public:
@@ -127,7 +127,7 @@ public:
~QTexture2DMultisampleArray();
};
-class QT3DRENDERSHARED_EXPORT QTextureRectangle : public QAbstractTexture
+class Q_3DRENDERSHARED_EXPORT QTextureRectangle : public QAbstractTexture
{
Q_OBJECT
public:
@@ -135,7 +135,7 @@ public:
~QTextureRectangle();
};
-class QT3DRENDERSHARED_EXPORT QTextureBuffer : public QAbstractTexture
+class Q_3DRENDERSHARED_EXPORT QTextureBuffer : public QAbstractTexture
{
Q_OBJECT
public:
@@ -145,7 +145,7 @@ public:
class QTextureLoaderPrivate;
-class QT3DRENDERSHARED_EXPORT QTextureLoader : public QAbstractTexture
+class Q_3DRENDERSHARED_EXPORT QTextureLoader : public QAbstractTexture
{
Q_OBJECT
Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
@@ -169,6 +169,23 @@ private:
Q_DECLARE_PRIVATE(QTextureLoader)
};
+class Q_3DRENDERSHARED_EXPORT QSharedGLTexture : public QAbstractTexture
+{
+ Q_OBJECT
+ Q_PROPERTY(int textureId READ textureId WRITE setTextureId NOTIFY textureIdChanged)
+public:
+ explicit QSharedGLTexture(Qt3DCore::QNode *parent = nullptr);
+ ~QSharedGLTexture();
+
+ int textureId() const;
+
+public Q_SLOTS:
+ void setTextureId(int id);
+
+Q_SIGNALS:
+ void textureIdChanged(int textureId);
+};
+
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/texture/qtexture_p.h b/src/render/texture/qtexture_p.h
index 087480340..012b719ff 100644
--- a/src/render/texture/qtexture_p.h
+++ b/src/render/texture/qtexture_p.h
@@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_PRIVATE_EXPORT QTextureLoaderPrivate : public QAbstractTexturePrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QTextureLoaderPrivate : public QAbstractTexturePrivate
{
public:
QTextureLoaderPrivate();
diff --git a/src/render/texture/qtexturedata.h b/src/render/texture/qtexturedata.h
index a86a3ec45..04324ca14 100644
--- a/src/render/texture/qtexturedata.h
+++ b/src/render/texture/qtexturedata.h
@@ -51,7 +51,7 @@ namespace Qt3DRender {
class QTextureDataPrivate;
-class QT3DRENDERSHARED_EXPORT QTextureData
+class Q_3DRENDERSHARED_EXPORT QTextureData
{
public:
QTextureData();
diff --git a/src/render/texture/qtexturegenerator.h b/src/render/texture/qtexturegenerator.h
index 10f0cde57..7ae3d3a84 100644
--- a/src/render/texture/qtexturegenerator.h
+++ b/src/render/texture/qtexturegenerator.h
@@ -52,7 +52,7 @@ namespace Qt3DRender {
class QTextureData;
typedef QSharedPointer<QTextureData> QTextureDataPtr;
-class QT3DRENDERSHARED_EXPORT QTextureGenerator : public QAbstractFunctor
+class Q_3DRENDERSHARED_EXPORT QTextureGenerator : public QAbstractFunctor
{
public:
virtual ~QTextureGenerator();
diff --git a/src/render/texture/qtextureimage.h b/src/render/texture/qtextureimage.h
index d3fccde70..7d08c8e6e 100644
--- a/src/render/texture/qtextureimage.h
+++ b/src/render/texture/qtextureimage.h
@@ -49,7 +49,7 @@ namespace Qt3DRender {
class QTextureImagePrivate;
-class QT3DRENDERSHARED_EXPORT QTextureImage : public QAbstractTextureImage
+class Q_3DRENDERSHARED_EXPORT QTextureImage : public QAbstractTextureImage
{
Q_OBJECT
Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
diff --git a/src/render/texture/qtextureimage_p.h b/src/render/texture/qtextureimage_p.h
index 5a4ea8f5a..3cb704cf8 100644
--- a/src/render/texture/qtextureimage_p.h
+++ b/src/render/texture/qtextureimage_p.h
@@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_PRIVATE_EXPORT QTextureImagePrivate : public QAbstractTextureImagePrivate
+class Q_3DRENDERSHARED_PRIVATE_EXPORT QTextureImagePrivate : public QAbstractTextureImagePrivate
{
public:
QTextureImagePrivate()
diff --git a/src/render/texture/qtextureimagedata.h b/src/render/texture/qtextureimagedata.h
index 6d66f2390..68ceebabc 100644
--- a/src/render/texture/qtextureimagedata.h
+++ b/src/render/texture/qtextureimagedata.h
@@ -51,7 +51,7 @@ namespace Qt3DRender {
class QTextureImageDataPrivate;
-class QT3DRENDERSHARED_EXPORT QTextureImageData
+class Q_3DRENDERSHARED_EXPORT QTextureImageData
{
public:
QTextureImageData();
diff --git a/src/render/texture/qtextureimagedatagenerator.h b/src/render/texture/qtextureimagedatagenerator.h
index 0e7e6c782..7c58b3878 100644
--- a/src/render/texture/qtextureimagedatagenerator.h
+++ b/src/render/texture/qtextureimagedatagenerator.h
@@ -55,7 +55,7 @@ namespace Qt3DRender {
class QTextureImageData;
typedef QSharedPointer<QTextureImageData> QTextureImageDataPtr;
-class QT3DRENDERSHARED_EXPORT QTextureImageDataGenerator : public QAbstractFunctor
+class Q_3DRENDERSHARED_EXPORT QTextureImageDataGenerator : public QAbstractFunctor
{
public:
virtual ~QTextureImageDataGenerator() {}
diff --git a/src/render/texture/qtexturewrapmode.h b/src/render/texture/qtexturewrapmode.h
index 36af013a8..b31ccc17b 100644
--- a/src/render/texture/qtexturewrapmode.h
+++ b/src/render/texture/qtexturewrapmode.h
@@ -49,7 +49,7 @@ namespace Qt3DRender {
class QTextureWrapModePrivate;
-class QT3DRENDERSHARED_EXPORT QTextureWrapMode : public QObject
+class Q_3DRENDERSHARED_EXPORT QTextureWrapMode : public QObject
{
Q_OBJECT
Q_PROPERTY(WrapMode x READ x WRITE setX NOTIFY xChanged)
diff --git a/src/render/texture/texture.cpp b/src/render/texture/texture.cpp
index 749b85802..17fd47be3 100644
--- a/src/render/texture/texture.cpp
+++ b/src/render/texture/texture.cpp
@@ -115,6 +115,7 @@ void Texture::cleanup()
// texture is being referenced by a shared API specific texture (GLTexture)
m_dataFunctor.reset();
m_textureImageIds.clear();
+ m_sharedTextureId = -1;
// set default values
m_properties = {};
@@ -181,6 +182,9 @@ void Texture::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
dirty = DirtyProperties;
} else if (propertyChange->propertyName() == QByteArrayLiteral("generator")) {
setDataGenerator(propertyChange->value().value<QTextureGeneratorPtr>());
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("textureId")) {
+ m_sharedTextureId = propertyChange->value().toInt();
+ dirty = DirtySharedTextureId;
}
}
break;
@@ -219,7 +223,7 @@ void Texture::setDataGenerator(const QTextureGeneratorPtr &generator)
// Called by sendTextureChangesToFrontendJob once GLTexture and sharing
// has been performed
-void Texture::updatePropertiesAndNotify(const TextureProperties &properties)
+void Texture::updatePropertiesAndNotify(const TextureUpdateInfo &updateInfo)
{
// If we are Dirty, some property has changed and the properties we have
// received are potentially already outdated
@@ -228,57 +232,73 @@ void Texture::updatePropertiesAndNotify(const TextureProperties &properties)
// Note we don't update target has it is constant for frontend nodes
- if (properties.width != m_properties.width) {
- m_properties.width = properties.width;
+ if (updateInfo.properties.width != m_properties.width) {
+ m_properties.width = updateInfo.properties.width;
auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
change->setDeliveryFlags(Qt3DCore::QSceneChange::Nodes);
change->setPropertyName("width");
- change->setValue(properties.width);
+ change->setValue(updateInfo.properties.width);
notifyObservers(change);
}
- if (properties.height != m_properties.height) {
- m_properties.height = properties.height;
+ if (updateInfo.properties.height != m_properties.height) {
+ m_properties.height = updateInfo.properties.height;
auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
change->setDeliveryFlags(Qt3DCore::QSceneChange::Nodes);
change->setPropertyName("height");
- change->setValue(properties.height);
+ change->setValue(updateInfo.properties.height);
notifyObservers(change);
}
- if (properties.depth != m_properties.depth) {
- m_properties.depth = properties.depth;
+ if (updateInfo.properties.depth != m_properties.depth) {
+ m_properties.depth = updateInfo.properties.depth;
auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
change->setDeliveryFlags(Qt3DCore::QSceneChange::Nodes);
change->setPropertyName("depth");
- change->setValue(properties.depth);
+ change->setValue(updateInfo.properties.depth);
notifyObservers(change);
}
- if (properties.layers != m_properties.layers) {
- m_properties.layers = properties.layers;
+ if (updateInfo.properties.layers != m_properties.layers) {
+ m_properties.layers = updateInfo.properties.layers;
auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
change->setDeliveryFlags(Qt3DCore::QSceneChange::Nodes);
change->setPropertyName("layers");
- change->setValue(properties.layers);
+ change->setValue(updateInfo.properties.layers);
notifyObservers(change);
}
- if (properties.format != m_properties.format) {
- m_properties.format = properties.format;
+ if (updateInfo.properties.format != m_properties.format) {
+ m_properties.format = updateInfo.properties.format;
auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
change->setDeliveryFlags(Qt3DCore::QSceneChange::Nodes);
change->setPropertyName("format");
- change->setValue(properties.format);
+ change->setValue(updateInfo.properties.format);
notifyObservers(change);
}
- if (properties.status != m_properties.status) {
- m_properties.status = properties.status;
+ if (updateInfo.properties.status != m_properties.status) {
+ m_properties.status = updateInfo.properties.status;
auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
change->setDeliveryFlags(Qt3DCore::QSceneChange::Nodes);
change->setPropertyName("status");
- change->setValue(properties.status);
+ change->setValue(updateInfo.properties.status);
+ notifyObservers(change);
+ }
+
+ {
+ auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
+ change->setDeliveryFlags(Qt3DCore::QSceneChange::Nodes);
+ change->setPropertyName("handleType");
+ change->setValue(updateInfo.handleType);
+ notifyObservers(change);
+ }
+
+ {
+ auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
+ change->setDeliveryFlags(Qt3DCore::QSceneChange::Nodes);
+ change->setPropertyName("handle");
+ change->setValue(updateInfo.handle);
notifyObservers(change);
}
}
@@ -315,11 +335,14 @@ void Texture::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &chan
m_parameters.comparisonFunction = data.comparisonFunction;
m_parameters.comparisonMode = data.comparisonMode;
m_dataFunctor = data.dataFunctor;
+ m_sharedTextureId = data.sharedTextureId;
for (const QNodeId imgId : data.textureImageIds)
addTextureImage(imgId);
addDirtyFlag(DirtyFlags(DirtyImageGenerators|DirtyProperties|DirtyParameters));
+ if (m_sharedTextureId > 0)
+ addDirtyFlag(DirtySharedTextureId);
}
diff --git a/src/render/texture/texture_p.h b/src/render/texture/texture_p.h
index 86c49f695..c60e90181 100644
--- a/src/render/texture/texture_p.h
+++ b/src/render/texture/texture_p.h
@@ -137,10 +137,18 @@ public:
DirtyProperties = 0x1,
DirtyParameters = 0x2,
DirtyImageGenerators = 0x4,
- DirtyDataGenerator = 0x8
+ DirtyDataGenerator = 0x8,
+ DirtySharedTextureId = 0x16
};
Q_DECLARE_FLAGS(DirtyFlags, DirtyFlag)
+ struct TextureUpdateInfo
+ {
+ TextureProperties properties;
+ QVariant handle;
+ QAbstractTexture::HandleType handleType;
+ };
+
void addDirtyFlag(DirtyFlags flags);
DirtyFlags dirtyFlags();
void unsetDirty();
@@ -155,9 +163,10 @@ public:
inline const TextureParameters& parameters() const { return m_parameters; }
inline const Qt3DCore::QNodeIdVector textureImageIds() const { return m_textureImageIds; }
inline const QTextureGeneratorPtr& dataGenerator() const { return m_dataFunctor; }
+ inline int sharedTextureId() const { return m_sharedTextureId; }
void setDataGenerator(const QTextureGeneratorPtr &generator);
- void updatePropertiesAndNotify(const TextureProperties &propreties);
+ void updatePropertiesAndNotify(const TextureUpdateInfo &updateInfo);
bool isValid(TextureImageManager *manager) const;
private:
void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) final;
@@ -165,6 +174,7 @@ private:
DirtyFlags m_dirty;
TextureProperties m_properties;
TextureParameters m_parameters;
+ int m_sharedTextureId;
QTextureGeneratorPtr m_dataFunctor;
Qt3DCore::QNodeIdVector m_textureImageIds;
diff --git a/tests/auto/core/qentity/tst_qentity.cpp b/tests/auto/core/qentity/tst_qentity.cpp
index bc0707f05..7770a2632 100644
--- a/tests/auto/core/qentity/tst_qentity.cpp
+++ b/tests/auto/core/qentity/tst_qentity.cpp
@@ -53,6 +53,8 @@ private slots:
void addComponentsSeveralParentsSingleAggregations();
void addComponentsSeveralParentsSeveralAggregations();
+ void retrieveSingleComponent();
+
void removeComponentSingleParentSingleAggregation();
void removeComponentSingleParentSeveralAggregations();
void removeComponentsSeveralParentsSingleAggreation();
@@ -76,6 +78,14 @@ public:
{}
};
+class MyQ2Component : public Qt3DCore::QComponent
+{
+ Q_OBJECT
+public:
+ explicit MyQ2Component(Qt3DCore::QNode *parent = 0)
+ : QComponent(parent)
+ {}
+};
class MyEntity : public Qt3DCore::QEntity
{
@@ -504,6 +514,29 @@ void tst_Entity::removeComponentsSeveralParentsSeveralAggregations()
QCOMPARE(comp3->entities().size(), 0);
}
+void tst_Entity::retrieveSingleComponent()
+{
+ // GIVEN
+ QScopedPointer<Qt3DCore::QEntity> entity1(new QEntity());
+
+ MyQComponent *comp1 = new MyQComponent(entity1.data());
+ MyQComponent *comp2 = new MyQComponent(entity1.data());
+ QCoreApplication::processEvents();
+ entity1->addComponent(comp1);
+ entity1->addComponent(comp2);
+
+ // WHEN
+ QVector<MyQComponent*> myQComponentsInEntity = entity1->componentsOfType<MyQComponent>();
+ QVector<MyQ2Component*> myQ2ComponentsInEntity = entity1->componentsOfType<MyQ2Component>();
+
+ // THEN
+ QVERIFY(myQComponentsInEntity.size() == 2);
+ QVERIFY(myQComponentsInEntity[0] == comp1);
+ QVERIFY(myQComponentsInEntity[1] == comp2);
+
+ QVERIFY(myQ2ComponentsInEntity.size() == 0);
+}
+
void tst_Entity::addSeveralTimesSameComponent()
{
// GIVEN
diff --git a/tests/auto/core/threadpooler/tst_threadpooler.cpp b/tests/auto/core/threadpooler/tst_threadpooler.cpp
index bc4552c66..98cbbc92d 100644
--- a/tests/auto/core/threadpooler/tst_threadpooler.cpp
+++ b/tests/auto/core/threadpooler/tst_threadpooler.cpp
@@ -332,13 +332,13 @@ public:
m_globalAtomic.fetchAndAddOrdered(qPow(3, index));
}
- int globalAtomicValue() const
+ quint64 globalAtomicValue() const
{
return m_globalAtomic.load();
}
private:
- QAtomicInt m_globalAtomic;
+ QAtomicInteger<quint64> m_globalAtomic;
QAtomicInt m_currentIndex;
};
@@ -353,7 +353,7 @@ void tst_ThreadPooler::perThreadUniqueCall()
// GIVEN
PerThreadUniqueTester tester;
const int maxThreads = QThread::idealThreadCount();
- int maxValue = 0;
+ quint64 maxValue = 0;
for (int i = 0; i < maxThreads; ++i) {
maxValue += qPow(3, i);
}
diff --git a/tests/auto/quick3d/3drender/3drender.qml b/tests/auto/quick3d/3drender/3drender.qml
index 112031282..c20ce6c45 100644
--- a/tests/auto/quick3d/3drender/3drender.qml
+++ b/tests/auto/quick3d/3drender/3drender.qml
@@ -30,6 +30,7 @@
import Qt3D.Render 2.0 as QQ3Render20
import Qt3D.Render 2.1 as QQ3Render21
import Qt3D.Render 2.10 as QQ3Render210
+import Qt3D.Render 2.13 as QQ3Render213
import QtQuick 2.0
Item {
@@ -79,6 +80,9 @@ Item {
QQ3Render20.TextureLoader {} //Qt3DRender::QTextureLoader, Qt3DRender::Render::Quick::Quick3DTextureExtension
//QQ3Render20.QAbstractTextureImage // (uncreatable) Qt3DRender::QAbstractTextureImage
QQ3Render20.TextureImage {} //Qt3DRender::QTextureImage
+ QQ3Render213.SharedGLTexture {} //Qt3DRender::QSharedGLTexture
+ QQ3Render213.WaitFence {} //Qt3DRender::QWaitFence
+ QQ3Render213.SetFence {} //Qt3DRender::QSetFence
// Geometry
QQ3Render20.Attribute {} //Qt3DRender::QAttribute
diff --git a/tests/auto/render/attribute/tst_attribute.cpp b/tests/auto/render/attribute/tst_attribute.cpp
index a673a327b..e0f6f6b5c 100644
--- a/tests/auto/render/attribute/tst_attribute.cpp
+++ b/tests/auto/render/attribute/tst_attribute.cpp
@@ -53,7 +53,7 @@ private Q_SLOTS:
attribute.setVertexBaseType(Qt3DRender::QAttribute::UnsignedShort);
attribute.setVertexSize(3);
- Qt3DRender::QBuffer buffer(Qt3DRender::QBuffer::IndexBuffer);
+ Qt3DRender::QBuffer buffer;
buffer.setUsage(Qt3DRender::QBuffer::DynamicCopy);
buffer.setData(QByteArrayLiteral("Corvette"));
attribute.setBuffer(&buffer);
@@ -105,7 +105,7 @@ private Q_SLOTS:
attribute.setName(QStringLiteral("C3"));
attribute.setVertexBaseType(Qt3DRender::QAttribute::Double);
attribute.setVertexSize(4);
- Qt3DRender::QBuffer buffer(Qt3DRender::QBuffer::IndexBuffer);
+ Qt3DRender::QBuffer buffer;
buffer.setUsage(Qt3DRender::QBuffer::DynamicCopy);
buffer.setData(QByteArrayLiteral("C7"));
attribute.setBuffer(&buffer);
diff --git a/tests/auto/render/blitframebuffer/tst_blitframebuffer.cpp b/tests/auto/render/blitframebuffer/tst_blitframebuffer.cpp
index 26c43b5c2..9232aa70f 100644
--- a/tests/auto/render/blitframebuffer/tst_blitframebuffer.cpp
+++ b/tests/auto/render/blitframebuffer/tst_blitframebuffer.cpp
@@ -118,6 +118,8 @@ private Q_SLOTS:
// THEN
QCOMPARE(backendBlitFramebuffer.isEnabled(), newValue);
+ QVERIFY(renderer.dirtyBits() & Qt3DRender::Render::AbstractRenderer::FrameGraphDirty);
+ renderer.clearDirtyBits(Qt3DRender::Render::AbstractRenderer::AllDirty);
}
{
// WHEN
@@ -130,6 +132,8 @@ private Q_SLOTS:
// THEN
QCOMPARE(backendBlitFramebuffer.sourceRenderTargetId(), newValue);
+ QVERIFY(renderer.dirtyBits() & Qt3DRender::Render::AbstractRenderer::FrameGraphDirty);
+ renderer.clearDirtyBits(Qt3DRender::Render::AbstractRenderer::AllDirty);
}
{
// WHEN
@@ -142,6 +146,8 @@ private Q_SLOTS:
// THEN
QCOMPARE(backendBlitFramebuffer.destinationRenderTargetId(), newValue);
+ QVERIFY(renderer.dirtyBits() & Qt3DRender::Render::AbstractRenderer::FrameGraphDirty);
+ renderer.clearDirtyBits(Qt3DRender::Render::AbstractRenderer::AllDirty);
}
{
// WHEN
@@ -153,6 +159,8 @@ private Q_SLOTS:
// THEN
QCOMPARE(backendBlitFramebuffer.sourceRect(), newValue);
+ QVERIFY(renderer.dirtyBits() & Qt3DRender::Render::AbstractRenderer::FrameGraphDirty);
+ renderer.clearDirtyBits(Qt3DRender::Render::AbstractRenderer::AllDirty);
}
{
// WHEN
@@ -164,6 +172,8 @@ private Q_SLOTS:
// THEN
QCOMPARE(backendBlitFramebuffer.destinationRect(), newValue);
+ QVERIFY(renderer.dirtyBits() & Qt3DRender::Render::AbstractRenderer::FrameGraphDirty);
+ renderer.clearDirtyBits(Qt3DRender::Render::AbstractRenderer::AllDirty);
}
{
// WHEN
@@ -175,6 +185,8 @@ private Q_SLOTS:
// THEN
QCOMPARE(backendBlitFramebuffer.sourceAttachmentPoint(), newValue);
+ QVERIFY(renderer.dirtyBits() & Qt3DRender::Render::AbstractRenderer::FrameGraphDirty);
+ renderer.clearDirtyBits(Qt3DRender::Render::AbstractRenderer::AllDirty);
}
{
// WHEN
@@ -186,6 +198,8 @@ private Q_SLOTS:
// THEN
QCOMPARE(backendBlitFramebuffer.destinationAttachmentPoint(), newValue);
+ QVERIFY(renderer.dirtyBits() & Qt3DRender::Render::AbstractRenderer::FrameGraphDirty);
+ renderer.clearDirtyBits(Qt3DRender::Render::AbstractRenderer::AllDirty);
}
}
diff --git a/tests/auto/render/boundingsphere/tst_boundingsphere.cpp b/tests/auto/render/boundingsphere/tst_boundingsphere.cpp
index b35c6d31a..40d992347 100644
--- a/tests/auto/render/boundingsphere/tst_boundingsphere.cpp
+++ b/tests/auto/render/boundingsphere/tst_boundingsphere.cpp
@@ -123,6 +123,7 @@ void runRequiredJobs(Qt3DRender::TestAspect *test)
Qt3DRender::Render::UpdateWorldTransformJob updateWorldTransform;
updateWorldTransform.setRoot(test->sceneRoot());
+ updateWorldTransform.setManagers(test->nodeManagers());
updateWorldTransform.run();
// For each buffer
@@ -144,6 +145,7 @@ void runRequiredJobs(Qt3DRender::TestAspect *test)
Qt3DRender::Render::ExpandBoundingVolumeJob expandBVolume;
expandBVolume.setRoot(test->sceneRoot());
+ expandBVolume.setManagers(test->nodeManagers());
expandBVolume.run();
Qt3DRender::Render::UpdateMeshTriangleListJob updateTriangleList;
diff --git a/tests/auto/render/buffer/tst_buffer.cpp b/tests/auto/render/buffer/tst_buffer.cpp
index a3098f0bd..da853d4e9 100644
--- a/tests/auto/render/buffer/tst_buffer.cpp
+++ b/tests/auto/render/buffer/tst_buffer.cpp
@@ -71,7 +71,7 @@ private Q_SLOTS:
{
// GIVEN
Qt3DRender::Render::Buffer renderBuffer;
- Qt3DRender::QBuffer buffer(Qt3DRender::QBuffer::IndexBuffer);
+ Qt3DRender::QBuffer buffer;
Qt3DRender::Render::BufferManager bufferManager;
TestRenderer renderer;
@@ -268,7 +268,7 @@ private Q_SLOTS:
{
// GIVEN
Qt3DRender::Render::Buffer renderBuffer;
- Qt3DRender::QBuffer buffer(Qt3DRender::QBuffer::IndexBuffer);
+ Qt3DRender::QBuffer buffer;
Qt3DRender::Render::BufferManager bufferManager;
TestRenderer renderer;
@@ -294,7 +294,7 @@ private Q_SLOTS:
{
// GIVEN
Qt3DRender::Render::Buffer renderBuffer;
- Qt3DRender::QBuffer buffer(Qt3DRender::QBuffer::IndexBuffer);
+ Qt3DRender::QBuffer buffer;
Qt3DRender::Render::BufferManager bufferManager;
TestRenderer renderer;
diff --git a/tests/auto/render/commons/testrenderer.h b/tests/auto/render/commons/testrenderer.h
index 466cebe14..f19b3211b 100644
--- a/tests/auto/render/commons/testrenderer.h
+++ b/tests/auto/render/commons/testrenderer.h
@@ -57,6 +57,7 @@ public:
bool isRunning() const override { return true; }
bool shouldRender() override { return true; }
void skipNextFrame() override {}
+ QVector<Qt3DCore::QAspectJobPtr> preRenderingJobs() override { return QVector<Qt3DCore::QAspectJobPtr>(); }
QVector<Qt3DCore::QAspectJobPtr> renderBinJobs() override { return QVector<Qt3DCore::QAspectJobPtr>(); }
Qt3DCore::QAspectJobPtr pickBoundingVolumeJob() override { return Qt3DCore::QAspectJobPtr(); }
Qt3DCore::QAspectJobPtr rayCastingJob() override { return Qt3DCore::QAspectJobPtr(); }
diff --git a/tests/auto/render/computecommand/tst_computecommand.cpp b/tests/auto/render/computecommand/tst_computecommand.cpp
index 13688d299..1c8380f73 100644
--- a/tests/auto/render/computecommand/tst_computecommand.cpp
+++ b/tests/auto/render/computecommand/tst_computecommand.cpp
@@ -31,9 +31,11 @@
#include <Qt3DRender/qcomputecommand.h>
#include <Qt3DRender/private/qcomputecommand_p.h>
#include <Qt3DRender/private/computecommand_p.h>
+#include <Qt3DCore/private/qbackendnode_p.h>
#include <Qt3DCore/qpropertyupdatedchange.h>
#include "qbackendnodetester.h"
#include "testrenderer.h"
+#include "testpostmanarbiter.h"
class tst_ComputeCommand : public Qt3DCore::QBackendNodeTester
{
@@ -52,6 +54,8 @@ private Q_SLOTS:
QCOMPARE(backendComputeCommand.x(), 1);
QCOMPARE(backendComputeCommand.y(), 1);
QCOMPARE(backendComputeCommand.z(), 1);
+ QCOMPARE(backendComputeCommand.runType(), Qt3DRender::QComputeCommand::Continuous);
+ QCOMPARE(backendComputeCommand.frameCount(), 0);
}
void checkCleanupState()
@@ -75,6 +79,8 @@ private Q_SLOTS:
computeCommand.setWorkGroupX(256);
computeCommand.setWorkGroupY(512);
computeCommand.setWorkGroupZ(128);
+ computeCommand.setRunType(Qt3DRender::QComputeCommand::Manual);
+ computeCommand.trigger(6);
{
// WHEN
@@ -87,6 +93,8 @@ private Q_SLOTS:
QCOMPARE(backendComputeCommand.x(), computeCommand.workGroupX());
QCOMPARE(backendComputeCommand.y(), computeCommand.workGroupY());
QCOMPARE(backendComputeCommand.z(), computeCommand.workGroupZ());
+ QCOMPARE(backendComputeCommand.runType(), computeCommand.runType());
+ QCOMPARE(backendComputeCommand.frameCount(), 6);
}
{
// WHEN
@@ -151,8 +159,75 @@ private Q_SLOTS:
// THEN
QCOMPARE(backendComputeCommand.z(), newValue);
}
+ {
+ // WHEN
+ const Qt3DRender::QComputeCommand::RunType newValue = Qt3DRender::QComputeCommand::Manual;
+ const auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(Qt3DCore::QNodeId());
+ change->setPropertyName("runType");
+ change->setValue(newValue);
+ backendComputeCommand.sceneChangeEvent(change);
+
+ // THEN
+ QCOMPARE(backendComputeCommand.runType(), newValue);
+ }
+ {
+ // WHEN
+ const int newValue = 32;
+ const auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(Qt3DCore::QNodeId());
+ change->setPropertyName("frameCount");
+ change->setValue(newValue);
+ backendComputeCommand.sceneChangeEvent(change);
+
+ // THEN
+ QCOMPARE(backendComputeCommand.frameCount(), newValue);
+ }
}
+ void checkUpdateFrameCount()
+ {
+ // GIVEN
+ TestRenderer renderer;
+ TestArbiter arbiter;
+
+ Qt3DRender::QComputeCommand computeCommand;
+ Qt3DRender::Render::ComputeCommand backendComputeCommand;
+
+ computeCommand.setWorkGroupX(256);
+ computeCommand.setWorkGroupY(512);
+ computeCommand.setWorkGroupZ(128);
+ computeCommand.setRunType(Qt3DRender::QComputeCommand::Manual);
+ computeCommand.trigger(6);
+
+
+ Qt3DCore::QBackendNodePrivate::get(&backendComputeCommand)->setArbiter(&arbiter);
+
+ backendComputeCommand.setRenderer(&renderer);
+ simulateInitialization(&computeCommand, &backendComputeCommand);
+
+ for (int i = 0; i < 5; ++i) {
+ // WHEN
+ backendComputeCommand.updateFrameCount();
+
+ // THEN
+ QCOMPARE(backendComputeCommand.frameCount(), 6 - (i + 1));
+ QCOMPARE(backendComputeCommand.isEnabled(), true);
+ QCOMPARE(arbiter.events.size(), 0);
+ }
+
+ // WHEN
+ backendComputeCommand.updateFrameCount();
+
+ // THEN
+ QCOMPARE(backendComputeCommand.frameCount(), false);
+ QCOMPARE(backendComputeCommand.isEnabled(), false);
+ QCOMPARE(arbiter.events.size(), 1);
+ {
+ auto change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "enabled");
+ QCOMPARE(change->value().value<int>(), false);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+ }
+ }
};
QTEST_MAIN(tst_ComputeCommand)
diff --git a/tests/auto/render/entity/tst_entity.cpp b/tests/auto/render/entity/tst_entity.cpp
index 123a648d6..cd0616bbe 100644
--- a/tests/auto/render/entity/tst_entity.cpp
+++ b/tests/auto/render/entity/tst_entity.cpp
@@ -30,6 +30,8 @@
#include <Qt3DRender/private/entity_p.h>
#include <Qt3DRender/private/nodemanagers_p.h>
#include <Qt3DRender/private/managers_p.h>
+#include <Qt3DRender/private/entityvisitor_p.h>
+#include <Qt3DRender/private/entityaccumulator_p.h>
#include <Qt3DRender/QCameraLens>
#include <Qt3DCore/QPropertyUpdatedChange>
@@ -69,6 +71,24 @@ QVector<QNodeId> layersUuid(Entity *entity) { return entity->componentsUuid<Laye
QVector<QNodeId> shadersUuid(Entity *entity) { return entity->componentsUuid<ShaderData>(); }
QVector<QNodeId> environmentLightsUuid(Entity *entity) { return entity->componentsUuid<EnvironmentLight>(); }
+class CompleteVisitor : public EntityVisitor
+{
+public:
+ CompleteVisitor(NodeManagers *manager) : EntityVisitor(manager) { }
+
+ int count = 0;
+ Operation visit(Entity *) { count++; return Continue; }
+};
+
+class EnabledVisitor : public EntityVisitor
+{
+public:
+ EnabledVisitor(NodeManagers *manager) : EntityVisitor(manager) { }
+
+ int count = 0;
+ Operation visit(Entity *e) { count++; return e->isEnabled() ? Continue : Prune; }
+};
+
class tst_RenderEntity : public QObject
{
Q_OBJECT
@@ -419,6 +439,172 @@ private slots:
qDeleteAll(components);
}
+
+ void traversal() {
+ // GIVEN
+ TestRenderer renderer;
+ NodeManagers nodeManagers;
+ Qt3DCore::QEntity frontendEntityA, frontendEntityB, frontendEntityC;
+
+ auto entityCreator = [&nodeManagers, &renderer](const Qt3DCore::QEntity &frontEndEntity) {
+ HEntity renderNodeHandle = nodeManagers.renderNodesManager()->getOrAcquireHandle(frontEndEntity.id());
+ Entity *entity = nodeManagers.renderNodesManager()->data(renderNodeHandle);
+ entity->setNodeManagers(&nodeManagers);
+ entity->setHandle(renderNodeHandle);
+ entity->setRenderer(&renderer);
+ return entity;
+ };
+
+ auto backendA = entityCreator(frontendEntityA);
+ auto backendB = entityCreator(frontendEntityB);
+ auto backendC = entityCreator(frontendEntityC);
+
+ auto sendParentChange = [&nodeManagers](const Qt3DCore::QEntity &entity) {
+ const auto parentChange = QPropertyUpdatedChangePtr::create(entity.id());
+ parentChange->setPropertyName("parentEntityUpdated");
+ auto parent = entity.parentEntity();
+ parentChange->setValue(QVariant::fromValue(parent ? parent->id() : Qt3DCore::QNodeId()));
+
+ Entity *backendEntity = nodeManagers.renderNodesManager()->getOrCreateResource(entity.id());
+ backendEntity->sceneChangeEvent(parentChange);
+ };
+
+ // reparent B to A and C to B.
+ frontendEntityB.setParent(&frontendEntityA);
+ sendParentChange(frontendEntityB);
+ frontendEntityC.setParent(&frontendEntityB);
+ sendParentChange(frontendEntityC);
+
+ auto rebuildHierarchy = [](Entity *backend) {
+ backend->clearEntityHierarchy();
+ backend->rebuildEntityHierarchy();
+ };
+ rebuildHierarchy(backendA);
+ rebuildHierarchy(backendB);
+ rebuildHierarchy(backendC);
+
+ // WHEN
+ int visitCount = 0;
+ auto counter = [&visitCount](const Entity *) { ++visitCount; };
+ backendA->traverse(counter);
+
+ // THEN
+ QCOMPARE(visitCount, 3);
+ }
+
+ void visitor()
+ {
+ // GIVEN
+ TestRenderer renderer;
+ NodeManagers nodeManagers;
+ Qt3DCore::QEntity frontendEntityA, frontendEntityB, frontendEntityC;
+
+ auto entityCreator = [&nodeManagers, &renderer](const Qt3DCore::QEntity &frontEndEntity) {
+ HEntity renderNodeHandle = nodeManagers.renderNodesManager()->getOrAcquireHandle(frontEndEntity.id());
+ Entity *entity = nodeManagers.renderNodesManager()->data(renderNodeHandle);
+ entity->setNodeManagers(&nodeManagers);
+ entity->setHandle(renderNodeHandle);
+ entity->setRenderer(&renderer);
+ return entity;
+ };
+
+ auto backendA = entityCreator(frontendEntityA);
+ auto backendB = entityCreator(frontendEntityB);
+ auto backendC = entityCreator(frontendEntityC);
+
+ auto sendParentChange = [&nodeManagers](const Qt3DCore::QEntity &entity) {
+ const auto parentChange = QPropertyUpdatedChangePtr::create(entity.id());
+ parentChange->setPropertyName("parentEntityUpdated");
+ auto parent = entity.parentEntity();
+ parentChange->setValue(QVariant::fromValue(parent ? parent->id() : Qt3DCore::QNodeId()));
+
+ Entity *backendEntity = nodeManagers.renderNodesManager()->getOrCreateResource(entity.id());
+ backendEntity->sceneChangeEvent(parentChange);
+ };
+
+ // reparent B to A and C to B.
+ frontendEntityB.setParent(&frontendEntityA);
+ sendParentChange(frontendEntityB);
+ frontendEntityC.setParent(&frontendEntityB);
+ sendParentChange(frontendEntityC);
+
+ auto rebuildHierarchy = [](Entity *backend) {
+ backend->clearEntityHierarchy();
+ backend->rebuildEntityHierarchy();
+ };
+ rebuildHierarchy(backendA);
+ rebuildHierarchy(backendB);
+ rebuildHierarchy(backendC);
+
+ // WHEN
+ CompleteVisitor v1(&nodeManagers);
+ EnabledVisitor v2(&nodeManagers);
+ CompleteVisitor v3(&nodeManagers);
+ v3.setPruneDisabled(true);
+ v1.apply(backendA);
+ v2.apply(backendA);
+ v3.apply(backendA);
+
+ // THEN
+ QCOMPARE(v1.count, 3);
+ QCOMPARE(v2.count, 1); // nodes disabled by default but the first one is still visited before visitation finds out it's disabled
+ QCOMPARE(v3.count, 0); // nodes disabled by default
+ }
+
+ void accumulator()
+ {
+ // GIVEN
+ TestRenderer renderer;
+ NodeManagers nodeManagers;
+ Qt3DCore::QEntity frontendEntityA, frontendEntityB, frontendEntityC;
+
+ auto entityCreator = [&nodeManagers, &renderer](const Qt3DCore::QEntity &frontEndEntity) {
+ HEntity renderNodeHandle = nodeManagers.renderNodesManager()->getOrAcquireHandle(frontEndEntity.id());
+ Entity *entity = nodeManagers.renderNodesManager()->data(renderNodeHandle);
+ entity->setNodeManagers(&nodeManagers);
+ entity->setHandle(renderNodeHandle);
+ entity->setRenderer(&renderer);
+ return entity;
+ };
+
+ auto backendA = entityCreator(frontendEntityA);
+ auto backendB = entityCreator(frontendEntityB);
+ auto backendC = entityCreator(frontendEntityC);
+
+ auto sendParentChange = [&nodeManagers](const Qt3DCore::QEntity &entity) {
+ const auto parentChange = QPropertyUpdatedChangePtr::create(entity.id());
+ parentChange->setPropertyName("parentEntityUpdated");
+ auto parent = entity.parentEntity();
+ parentChange->setValue(QVariant::fromValue(parent ? parent->id() : Qt3DCore::QNodeId()));
+
+ Entity *backendEntity = nodeManagers.renderNodesManager()->getOrCreateResource(entity.id());
+ backendEntity->sceneChangeEvent(parentChange);
+ };
+
+ // reparent B to A and C to B.
+ frontendEntityB.setParent(&frontendEntityA);
+ sendParentChange(frontendEntityB);
+ frontendEntityC.setParent(&frontendEntityB);
+ sendParentChange(frontendEntityC);
+
+ auto rebuildHierarchy = [](Entity *backend) {
+ backend->clearEntityHierarchy();
+ backend->rebuildEntityHierarchy();
+ };
+ rebuildHierarchy(backendA);
+ rebuildHierarchy(backendB);
+ rebuildHierarchy(backendC);
+
+ // WHEN
+ EntityAccumulator v1(&nodeManagers);
+ EntityAccumulator v2([](Entity *e) { return e->isEnabled(); }, &nodeManagers);
+ const auto r1 = v1.apply(backendA);
+ const auto r2 = v2.apply(backendA);
+
+ // THEN
+ QCOMPARE(r1.count(), 3);
+ QCOMPARE(r2.count(), 0);
+ }
};
QTEST_APPLESS_MAIN(tst_RenderEntity)
diff --git a/tests/auto/render/geometry/tst_geometry.cpp b/tests/auto/render/geometry/tst_geometry.cpp
index 958edfd09..7e65d27aa 100644
--- a/tests/auto/render/geometry/tst_geometry.cpp
+++ b/tests/auto/render/geometry/tst_geometry.cpp
@@ -34,7 +34,9 @@
#include <Qt3DCore/qpropertyupdatedchange.h>
#include <Qt3DCore/qpropertynodeaddedchange.h>
#include <Qt3DCore/qpropertynoderemovedchange.h>
+#include <Qt3DCore/private/qbackendnode_p.h>
#include "testrenderer.h"
+#include "testpostmanarbiter.h"
class DummyAttribute : public Qt3DRender::QAttribute
{
@@ -187,6 +189,32 @@ private Q_SLOTS:
QVERIFY(renderer.dirtyBits() & Qt3DRender::Render::AbstractRenderer::GeometryDirty);
renderer.clearDirtyBits(Qt3DRender::Render::AbstractRenderer::AllDirty);
}
+
+ void checkExtentTransmission()
+ {
+ // GIVEN
+ TestRenderer renderer;
+ TestArbiter arbiter;
+ Qt3DRender::Render::Geometry renderGeometry;
+
+ Qt3DCore::QBackendNodePrivate::get(&renderGeometry)->setArbiter(&arbiter);
+ renderGeometry.setRenderer(&renderer);
+
+ // WHEN
+ renderGeometry.updateExtent(QVector3D(-1.0f, -1.0f, -1.0f), QVector3D(1.0f, 1.0f, 1.0f));
+ renderGeometry.notifyExtentChanged();
+
+ // THEN
+ QCOMPARE(arbiter.events.count(), 1);
+
+ Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "extent");
+ const QPair<QVector3D, QVector3D> v = change->value().value<QPair<QVector3D, QVector3D>>();
+ QCOMPARE(v.first, QVector3D(-1.0f, -1.0f, -1.0f));
+ QCOMPARE(v.second, QVector3D(1.0f, 1.0f, 1.0f));
+
+ arbiter.events.clear();
+ }
};
diff --git a/tests/auto/render/gltfplugins/tst_gltfplugins.cpp b/tests/auto/render/gltfplugins/tst_gltfplugins.cpp
index e5a0eef21..0de94a931 100644
--- a/tests/auto/render/gltfplugins/tst_gltfplugins.cpp
+++ b/tests/auto/render/gltfplugins/tst_gltfplugins.cpp
@@ -516,7 +516,7 @@ void tst_gltfPlugins::createTestScene()
Qt3DRender::QGeometryRenderer *boxMesh = createCustomCube();
Qt3DRender::QBuffer *colorDataBuffer =
- new Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer, boxMesh->geometry());
+ new Qt3DRender::QBuffer(boxMesh->geometry());
QByteArray colorBufferData;
colorBufferData.resize(8 * 4 * sizeof(float));
@@ -571,7 +571,7 @@ void tst_gltfPlugins::createTestScene()
transform->setRotation(Qt3DCore::QTransform::fromAxisAndAngle(1.0f, 2.0f, 3.0f, 90.0f));
Qt3DRender::QGeometryRenderer *boxMesh = createCustomCube();
Qt3DRender::QBuffer *offsetBuffer =
- new Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer, boxMesh->geometry());
+ new Qt3DRender::QBuffer(boxMesh->geometry());
QByteArray offsetBufferData;
offsetBufferData.resize(8 * 3 * sizeof(float));
@@ -587,8 +587,8 @@ void tst_gltfPlugins::createTestScene()
Qt3DRender::QAttribute *customAttribute = new Qt3DRender::QAttribute();
customAttribute->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
customAttribute->setBuffer(offsetBuffer);
- customAttribute->setDataType(Qt3DRender::QAttribute::Float);
- customAttribute->setDataSize(3);
+ customAttribute->setVertexBaseType(Qt3DRender::QAttribute::Float);
+ customAttribute->setVertexSize(3);
customAttribute->setByteOffset(0);
customAttribute->setByteStride(0);
customAttribute->setCount(8);
@@ -620,8 +620,8 @@ void tst_gltfPlugins::addPositionAttributeToGeometry(Qt3DRender::QGeometry *geom
Qt3DRender::QAttribute *posAttribute = new Qt3DRender::QAttribute();
posAttribute->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
posAttribute->setBuffer(buffer);
- posAttribute->setDataType(Qt3DRender::QAttribute::Float);
- posAttribute->setDataSize(3);
+ posAttribute->setVertexBaseType(Qt3DRender::QAttribute::Float);
+ posAttribute->setVertexSize(3);
posAttribute->setByteOffset(0);
posAttribute->setByteStride(0);
posAttribute->setCount(count);
@@ -636,8 +636,8 @@ void tst_gltfPlugins::addIndexAttributeToGeometry(Qt3DRender::QGeometry *geometr
Qt3DRender::QAttribute *indexAttribute = new Qt3DRender::QAttribute();
indexAttribute->setAttributeType(Qt3DRender::QAttribute::IndexAttribute);
indexAttribute->setBuffer(buffer);
- indexAttribute->setDataType(Qt3DRender::QAttribute::UnsignedShort);
- indexAttribute->setDataSize(1);
+ indexAttribute->setVertexBaseType(Qt3DRender::QAttribute::UnsignedShort);
+ indexAttribute->setVertexSize(1);
indexAttribute->setByteOffset(0);
indexAttribute->setByteStride(0);
indexAttribute->setCount(count);
@@ -651,8 +651,8 @@ void tst_gltfPlugins::addColorAttributeToGeometry(Qt3DRender::QGeometry *geometr
Qt3DRender::QAttribute *colorAttribute = new Qt3DRender::QAttribute();
colorAttribute->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
colorAttribute->setBuffer(buffer);
- colorAttribute->setDataType(Qt3DRender::QAttribute::Float);
- colorAttribute->setDataSize(4);
+ colorAttribute->setVertexBaseType(Qt3DRender::QAttribute::Float);
+ colorAttribute->setVertexSize(4);
colorAttribute->setByteOffset(0);
colorAttribute->setByteStride(0);
colorAttribute->setCount(count);
@@ -964,9 +964,9 @@ Qt3DRender::QGeometryRenderer *tst_gltfPlugins::createCustomCube()
Qt3DRender::QGeometryRenderer *boxMesh = new Qt3DRender::QGeometryRenderer;
Qt3DRender::QGeometry *boxGeometry = new Qt3DRender::QGeometry(boxMesh);
Qt3DRender::QBuffer *boxDataBuffer =
- new Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer, boxGeometry);
+ new Qt3DRender::QBuffer(boxGeometry);
Qt3DRender::QBuffer *indexDataBuffer =
- new Qt3DRender::QBuffer(Qt3DRender::QBuffer::IndexBuffer, boxGeometry);
+ new Qt3DRender::QBuffer(boxGeometry);
QByteArray vertexBufferData;
QByteArray indexBufferData;
diff --git a/tests/auto/render/graphicshelpergl2/tst_graphicshelpergl2.cpp b/tests/auto/render/graphicshelpergl2/tst_graphicshelpergl2.cpp
index 584b675ee..6c756957f 100644
--- a/tests/auto/render/graphicshelpergl2/tst_graphicshelpergl2.cpp
+++ b/tests/auto/render/graphicshelpergl2/tst_graphicshelpergl2.cpp
@@ -926,6 +926,9 @@ private Q_SLOTS:
SUPPORTS_FEATURE(GraphicsHelperInterface::DrawBuffersBlend, false);
SUPPORTS_FEATURE(GraphicsHelperInterface::Tessellation, false);
SUPPORTS_FEATURE(GraphicsHelperInterface::BlitFramebuffer, false);
+ SUPPORTS_FEATURE(GraphicsHelperInterface::IndirectDrawing, false);
+ SUPPORTS_FEATURE(GraphicsHelperInterface::MapBuffer, true);
+ SUPPORTS_FEATURE(GraphicsHelperInterface::Fences, false);
}
@@ -1524,6 +1527,36 @@ private Q_SLOTS:
// Not supported by GL2
}
+ void fenceSync()
+ {
+ QSKIP("Initialization failed, OpenGL 2.0 functions not supported");
+ // Not supported by GL2
+ }
+
+ void clientWaitSync()
+ {
+ QSKIP("Initialization failed, OpenGL 2.0 functions not supported");
+ // Not supported by GL2
+ }
+
+ void waitSync()
+ {
+ QSKIP("Initialization failed, OpenGL 2.0 functions not supported");
+ // Not supported by GL2
+ }
+
+ void wasSyncSignaled()
+ {
+ QSKIP("Initialization failed, OpenGL 2.0 functions not supported");
+ // Not supported by GL2
+ }
+
+ void deleteSync()
+ {
+ QSKIP("Initialization failed, OpenGL 2.0 functions not supported");
+ // Not supported by GL2
+ }
+
private:
QScopedPointer<QWindow> m_window;
QOpenGLContext m_glContext;
@@ -1537,17 +1570,11 @@ QT_END_NAMESPACE
#endif
-
-QT_BEGIN_NAMESPACE
-QTEST_ADD_GPU_BLACKLIST_SUPPORT_DEFS
-QT_END_NAMESPACE
-
int main(int argc, char *argv[])
{
#ifdef TEST_SHOULD_BE_PERFORMED
QGuiApplication app(argc, argv);
app.setAttribute(Qt::AA_Use96Dpi, true);
- QTEST_ADD_GPU_BLACKLIST_SUPPORT
tst_GraphicsHelperGL2 tc;
QTEST_SET_MAIN_SOURCE_PATH
return QTest::qExec(&tc, argc, argv);
diff --git a/tests/auto/render/graphicshelpergl3_2/tst_graphicshelpergl3_2.cpp b/tests/auto/render/graphicshelpergl3_2/tst_graphicshelpergl3_2.cpp
index 648eaaddb..5eb171827 100644
--- a/tests/auto/render/graphicshelpergl3_2/tst_graphicshelpergl3_2.cpp
+++ b/tests/auto/render/graphicshelpergl3_2/tst_graphicshelpergl3_2.cpp
@@ -2151,6 +2151,105 @@ private Q_SLOTS:
QCOMPARE(p, GL_FRONT);
}
+ void fenceSync()
+ {
+ if (!m_initializationSuccessful)
+ QSKIP("Initialization failed, OpenGL 4.3 Core functions not supported");
+
+ m_func->glGetError();
+
+ // WHEN
+ GLsync sync = reinterpret_cast<GLsync>(m_glHelper.fenceSync());
+
+ // THEN
+ QVERIFY(sync != nullptr);
+ QCOMPARE(m_func->glIsSync(sync), GL_TRUE);
+ const GLint error = m_func->glGetError();
+ QVERIFY(error == 0);
+ }
+
+ void clientWaitSync()
+ {
+ if (!m_initializationSuccessful)
+ QSKIP("Initialization failed, OpenGL 4.3 Core functions not supported");
+
+ m_func->glGetError();
+
+ // WHEN
+ QElapsedTimer t;
+ t.start();
+
+ GLsync sync = reinterpret_cast<GLsync>(m_glHelper.fenceSync());
+
+ m_glHelper.clientWaitSync(sync, 1000000);
+
+ // THEN
+ const GLint error = m_func->glGetError();
+ QVERIFY(error == 0);
+ qDebug() << t.nsecsElapsed();
+ }
+
+ void waitSync()
+ {
+ if (!m_initializationSuccessful)
+ QSKIP("Initialization failed, OpenGL 4.3 Core functions not supported");
+
+ m_func->glGetError();
+
+ // WHEN
+ GLsync sync = reinterpret_cast<GLsync>(m_glHelper.fenceSync());
+ m_func->glFlush();
+ m_glHelper.waitSync(sync);
+
+ // THEN
+ const GLint error = m_func->glGetError();
+ QVERIFY(error == 0);
+ }
+
+ void wasSyncSignaled()
+ {
+ if (!m_initializationSuccessful)
+ QSKIP("Initialization failed, OpenGL 4.3 Core functions not supported");
+
+ m_func->glGetError();
+
+ // WHEN
+ GLsync sync = reinterpret_cast<GLsync>(m_glHelper.fenceSync());
+ m_func->glFlush();
+ m_glHelper.waitSync(sync);
+
+ // THEN
+ const GLint error = m_func->glGetError();
+ QVERIFY(error == 0);
+
+ // Shouldn't loop forever
+ while (!m_glHelper.wasSyncSignaled(sync))
+ ;
+ }
+
+ void deleteSync()
+ {
+ if (!m_initializationSuccessful)
+ QSKIP("Initialization failed, OpenGL 4.3 Core functions not supported");
+
+ m_func->glGetError();
+
+ // WHEN
+ GLsync sync = reinterpret_cast<GLsync>(m_glHelper.fenceSync());
+ m_glHelper.clientWaitSync(sync, GLuint64(-1));
+
+ // THEN
+ const GLint error = m_func->glGetError();
+ QVERIFY(error == 0);
+ QVERIFY(m_glHelper.wasSyncSignaled(sync) == true);
+
+ // WHEN
+ m_glHelper.deleteSync(sync);
+
+ // THEN
+ QCOMPARE(m_func->glIsSync(sync), GL_FALSE);
+ }
+
private:
QScopedPointer<QWindow> m_window;
QOpenGLContext m_glContext;
@@ -2161,16 +2260,11 @@ private:
#endif
-QT_BEGIN_NAMESPACE
-QTEST_ADD_GPU_BLACKLIST_SUPPORT_DEFS
-QT_END_NAMESPACE
-
int main(int argc, char *argv[])
{
#ifdef TEST_SHOULD_BE_PERFORMED
QGuiApplication app(argc, argv);
app.setAttribute(Qt::AA_Use96Dpi, true);
- QTEST_ADD_GPU_BLACKLIST_SUPPORT
tst_GraphicsHelperGL3_2 tc;
QTEST_SET_MAIN_SOURCE_PATH
return QTest::qExec(&tc, argc, argv);
diff --git a/tests/auto/render/graphicshelpergl3_3/tst_graphicshelpergl3_3.cpp b/tests/auto/render/graphicshelpergl3_3/tst_graphicshelpergl3_3.cpp
index 06a3c41cd..a88e36d5e 100644
--- a/tests/auto/render/graphicshelpergl3_3/tst_graphicshelpergl3_3.cpp
+++ b/tests/auto/render/graphicshelpergl3_3/tst_graphicshelpergl3_3.cpp
@@ -2251,6 +2251,105 @@ private Q_SLOTS:
QCOMPARE(p, GL_FRONT);
}
+ void fenceSync()
+ {
+ if (!m_initializationSuccessful)
+ QSKIP("Initialization failed, OpenGL 4.3 Core functions not supported");
+
+ m_func->glGetError();
+
+ // WHEN
+ GLsync sync = reinterpret_cast<GLsync>(m_glHelper.fenceSync());
+
+ // THEN
+ QVERIFY(sync != nullptr);
+ QCOMPARE(m_func->glIsSync(sync), GL_TRUE);
+ const GLint error = m_func->glGetError();
+ QVERIFY(error == 0);
+ }
+
+ void clientWaitSync()
+ {
+ if (!m_initializationSuccessful)
+ QSKIP("Initialization failed, OpenGL 4.3 Core functions not supported");
+
+ m_func->glGetError();
+
+ // WHEN
+ QElapsedTimer t;
+ t.start();
+
+ GLsync sync = reinterpret_cast<GLsync>(m_glHelper.fenceSync());
+
+ m_glHelper.clientWaitSync(sync, 1000000);
+
+ // THEN
+ const GLint error = m_func->glGetError();
+ QVERIFY(error == 0);
+ qDebug() << t.nsecsElapsed();
+ }
+
+ void waitSync()
+ {
+ if (!m_initializationSuccessful)
+ QSKIP("Initialization failed, OpenGL 4.3 Core functions not supported");
+
+ m_func->glGetError();
+
+ // WHEN
+ GLsync sync = reinterpret_cast<GLsync>(m_glHelper.fenceSync());
+ m_func->glFlush();
+ m_glHelper.waitSync(sync);
+
+ // THEN
+ const GLint error = m_func->glGetError();
+ QVERIFY(error == 0);
+ }
+
+ void wasSyncSignaled()
+ {
+ if (!m_initializationSuccessful)
+ QSKIP("Initialization failed, OpenGL 4.3 Core functions not supported");
+
+ m_func->glGetError();
+
+ // WHEN
+ GLsync sync = reinterpret_cast<GLsync>(m_glHelper.fenceSync());
+ m_func->glFlush();
+ m_glHelper.waitSync(sync);
+
+ // THEN
+ const GLint error = m_func->glGetError();
+ QVERIFY(error == 0);
+
+ // Shouldn't loop forever
+ while (!m_glHelper.wasSyncSignaled(sync))
+ ;
+ }
+
+ void deleteSync()
+ {
+ if (!m_initializationSuccessful)
+ QSKIP("Initialization failed, OpenGL 4.3 Core functions not supported");
+
+ m_func->glGetError();
+
+ // WHEN
+ GLsync sync = reinterpret_cast<GLsync>(m_glHelper.fenceSync());
+ m_glHelper.clientWaitSync(sync, GLuint64(-1));
+
+ // THEN
+ const GLint error = m_func->glGetError();
+ QVERIFY(error == 0);
+ QVERIFY(m_glHelper.wasSyncSignaled(sync) == true);
+
+ // WHEN
+ m_glHelper.deleteSync(sync);
+
+ // THEN
+ QCOMPARE(m_func->glIsSync(sync), GL_FALSE);
+ }
+
private:
QScopedPointer<QWindow> m_window;
QOpenGLContext m_glContext;
@@ -2261,16 +2360,11 @@ private:
#endif
-QT_BEGIN_NAMESPACE
-QTEST_ADD_GPU_BLACKLIST_SUPPORT_DEFS
-QT_END_NAMESPACE
-
int main(int argc, char *argv[])
{
#ifdef TEST_SHOULD_BE_PERFORMED
QGuiApplication app(argc, argv);
app.setAttribute(Qt::AA_Use96Dpi, true);
- QTEST_ADD_GPU_BLACKLIST_SUPPORT
tst_GraphicsHelperGL3_3 tc;
QTEST_SET_MAIN_SOURCE_PATH
return QTest::qExec(&tc, argc, argv);
diff --git a/tests/auto/render/graphicshelpergl4/tst_graphicshelpergl4.cpp b/tests/auto/render/graphicshelpergl4/tst_graphicshelpergl4.cpp
index 39bd15021..87eee19ac 100644
--- a/tests/auto/render/graphicshelpergl4/tst_graphicshelpergl4.cpp
+++ b/tests/auto/render/graphicshelpergl4/tst_graphicshelpergl4.cpp
@@ -1430,7 +1430,7 @@ private Q_SLOTS:
void supportsFeature()
{
- for (int i = 0; i <= GraphicsHelperInterface::BlitFramebuffer; ++i)
+ for (int i = 0; i <= GraphicsHelperInterface::Fences; ++i)
QVERIFY(m_glHelper.supportsFeature(static_cast<GraphicsHelperInterface::Feature>(i)));
}
@@ -2349,6 +2349,105 @@ private Q_SLOTS:
QCOMPARE(p, GL_FRONT);
}
+ void fenceSync()
+ {
+ if (!m_initializationSuccessful)
+ QSKIP("Initialization failed, OpenGL 4.3 Core functions not supported");
+
+ m_func->glGetError();
+
+ // WHEN
+ GLsync sync = reinterpret_cast<GLsync>(m_glHelper.fenceSync());
+
+ // THEN
+ QVERIFY(sync != nullptr);
+ QCOMPARE(m_func->glIsSync(sync), GL_TRUE);
+ const GLint error = m_func->glGetError();
+ QVERIFY(error == 0);
+ }
+
+ void clientWaitSync()
+ {
+ if (!m_initializationSuccessful)
+ QSKIP("Initialization failed, OpenGL 4.3 Core functions not supported");
+
+ m_func->glGetError();
+
+ // WHEN
+ QElapsedTimer t;
+ t.start();
+
+ GLsync sync = reinterpret_cast<GLsync>(m_glHelper.fenceSync());
+
+ m_glHelper.clientWaitSync(sync, 1000000);
+
+ // THEN
+ const GLint error = m_func->glGetError();
+ QVERIFY(error == 0);
+ qDebug() << t.nsecsElapsed();
+ }
+
+ void waitSync()
+ {
+ if (!m_initializationSuccessful)
+ QSKIP("Initialization failed, OpenGL 4.3 Core functions not supported");
+
+ m_func->glGetError();
+
+ // WHEN
+ GLsync sync = reinterpret_cast<GLsync>(m_glHelper.fenceSync());
+ m_func->glFlush();
+ m_glHelper.waitSync(sync);
+
+ // THEN
+ const GLint error = m_func->glGetError();
+ QVERIFY(error == 0);
+ }
+
+ void wasSyncSignaled()
+ {
+ if (!m_initializationSuccessful)
+ QSKIP("Initialization failed, OpenGL 4.3 Core functions not supported");
+
+ m_func->glGetError();
+
+ // WHEN
+ GLsync sync = reinterpret_cast<GLsync>(m_glHelper.fenceSync());
+ m_func->glFlush();
+ m_glHelper.waitSync(sync);
+
+ // THEN
+ const GLint error = m_func->glGetError();
+ QVERIFY(error == 0);
+
+ // Shouldn't loop forever
+ while (!m_glHelper.wasSyncSignaled(sync))
+ ;
+ }
+
+ void deleteSync()
+ {
+ if (!m_initializationSuccessful)
+ QSKIP("Initialization failed, OpenGL 4.3 Core functions not supported");
+
+ m_func->glGetError();
+
+ // WHEN
+ GLsync sync = reinterpret_cast<GLsync>(m_glHelper.fenceSync());
+ m_glHelper.clientWaitSync(sync, GLuint64(-1));
+
+ // THEN
+ const GLint error = m_func->glGetError();
+ QVERIFY(error == 0);
+ QVERIFY(m_glHelper.wasSyncSignaled(sync) == true);
+
+ // WHEN
+ m_glHelper.deleteSync(sync);
+
+ // THEN
+ QCOMPARE(m_func->glIsSync(sync), GL_FALSE);
+ }
+
private:
QScopedPointer<QWindow> m_window;
QOpenGLContext m_glContext;
@@ -2359,16 +2458,11 @@ private:
#endif
-QT_BEGIN_NAMESPACE
-QTEST_ADD_GPU_BLACKLIST_SUPPORT_DEFS
-QT_END_NAMESPACE
-
int main(int argc, char *argv[])
{
#ifdef TEST_SHOULD_BE_PERFORMED
QGuiApplication app(argc, argv);
app.setAttribute(Qt::AA_Use96Dpi, true);
- QTEST_ADD_GPU_BLACKLIST_SUPPORT
tst_GraphicsHelperGL4 tc;
QTEST_SET_MAIN_SOURCE_PATH
return QTest::qExec(&tc, argc, argv);
diff --git a/tests/auto/render/layerfiltering/tst_layerfiltering.cpp b/tests/auto/render/layerfiltering/tst_layerfiltering.cpp
index 9b8636f49..8c72829e0 100644
--- a/tests/auto/render/layerfiltering/tst_layerfiltering.cpp
+++ b/tests/auto/render/layerfiltering/tst_layerfiltering.cpp
@@ -640,6 +640,7 @@ private Q_SLOTS:
Qt3DRender::Render::UpdateTreeEnabledJob updateTreeEnabledJob;
updateTreeEnabledJob.setRoot(backendRoot);
+ updateTreeEnabledJob.setManagers(aspect->nodeManagers());
updateTreeEnabledJob.run();
// WHEN
diff --git a/tests/auto/render/memorybarrier/tst_memorybarrier.cpp b/tests/auto/render/memorybarrier/tst_memorybarrier.cpp
index f0d4931d9..33a1247fa 100644
--- a/tests/auto/render/memorybarrier/tst_memorybarrier.cpp
+++ b/tests/auto/render/memorybarrier/tst_memorybarrier.cpp
@@ -98,6 +98,8 @@ private Q_SLOTS:
// THEN
QCOMPARE(backendMemoryBarrier.isEnabled(), newValue);
+ QVERIFY(renderer.dirtyBits() & Qt3DRender::Render::AbstractRenderer::FrameGraphDirty);
+ renderer.clearDirtyBits(Qt3DRender::Render::AbstractRenderer::AllDirty);
}
{
// WHEN
@@ -109,6 +111,8 @@ private Q_SLOTS:
// THEN
QCOMPARE(backendMemoryBarrier.waitOperations(), newValue);
+ QVERIFY(renderer.dirtyBits() & Qt3DRender::Render::AbstractRenderer::FrameGraphDirty);
+ renderer.clearDirtyBits(Qt3DRender::Render::AbstractRenderer::AllDirty);
}
}
diff --git a/tests/auto/render/objectpicker/tst_objectpicker.cpp b/tests/auto/render/objectpicker/tst_objectpicker.cpp
index c1b06ccd8..644849102 100644
--- a/tests/auto/render/objectpicker/tst_objectpicker.cpp
+++ b/tests/auto/render/objectpicker/tst_objectpicker.cpp
@@ -47,6 +47,7 @@ private Q_SLOTS:
Qt3DRender::Render::ObjectPicker objectPicker;
Qt3DRender::QObjectPicker picker;
picker.setHoverEnabled(true);
+ picker.setPriority(883);
// WHEN
simulateInitialization(&picker, &objectPicker);
@@ -54,6 +55,7 @@ private Q_SLOTS:
// THEN
QVERIFY(!objectPicker.peerId().isNull());
QCOMPARE(objectPicker.isHoverEnabled(), true);
+ QCOMPARE(objectPicker.priority(), 883);
}
void checkInitialAndCleanedUpState()
@@ -64,10 +66,14 @@ private Q_SLOTS:
// THEN
QVERIFY(objectPicker.peerId().isNull());
QCOMPARE(objectPicker.isHoverEnabled(), false);
+ QCOMPARE(objectPicker.isDragEnabled(), false);
+ QCOMPARE(objectPicker.priority(), 0);
// GIVEN
Qt3DRender::QObjectPicker picker;
picker.setHoverEnabled(true);
+ picker.setDragEnabled(true);
+ picker.setPriority(1584);
// WHEN
simulateInitialization(&picker, &objectPicker);
@@ -75,6 +81,8 @@ private Q_SLOTS:
// THEN
QCOMPARE(objectPicker.isHoverEnabled(), false);
+ QCOMPARE(objectPicker.isDragEnabled(), false);
+ QCOMPARE(objectPicker.priority(), 0);
}
void checkPropertyChanges()
@@ -95,6 +103,34 @@ private Q_SLOTS:
QCOMPARE(objectPicker.isHoverEnabled(), true);
QVERIFY(renderer.dirtyBits() != 0);
}
+ {
+ Qt3DRender::Render::ObjectPicker objectPicker;
+ objectPicker.setRenderer(&renderer);
+
+ // WHEN
+ Qt3DCore::QPropertyUpdatedChangePtr updateChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ updateChange->setValue(true);
+ updateChange->setPropertyName("dragEnabled");
+ objectPicker.sceneChangeEvent(updateChange);
+
+ // THEN
+ QCOMPARE(objectPicker.isDragEnabled(), true);
+ QVERIFY(renderer.dirtyBits() != 0);
+ }
+ {
+ Qt3DRender::Render::ObjectPicker objectPicker;
+ objectPicker.setRenderer(&renderer);
+
+ // WHEN
+ Qt3DCore::QPropertyUpdatedChangePtr updateChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ updateChange->setValue(15);
+ updateChange->setPropertyName("priority");
+ objectPicker.sceneChangeEvent(updateChange);
+
+ // THEN
+ QCOMPARE(objectPicker.priority(), 15);
+ QVERIFY(renderer.dirtyBits() != 0);
+ }
}
void checkBackendPropertyNotifications()
diff --git a/tests/auto/render/pickboundingvolumejob/pickboundingvolumejob.qrc b/tests/auto/render/pickboundingvolumejob/pickboundingvolumejob.qrc
index feef480e2..e1506de86 100644
--- a/tests/auto/render/pickboundingvolumejob/pickboundingvolumejob.qrc
+++ b/tests/auto/render/pickboundingvolumejob/pickboundingvolumejob.qrc
@@ -10,5 +10,6 @@
<file>testscene_parententity.qml</file>
<file>testscene_viewports.qml</file>
<file>testscene_cameraposition.qml</file>
+ <file>testscene_priorityoverlapping.qml</file>
</qresource>
</RCC>
diff --git a/tests/auto/render/pickboundingvolumejob/testscene_priorityoverlapping.qml b/tests/auto/render/pickboundingvolumejob/testscene_priorityoverlapping.qml
new file mode 100644
index 000000000..7cacb3d2d
--- /dev/null
+++ b/tests/auto/render/pickboundingvolumejob/testscene_priorityoverlapping.qml
@@ -0,0 +1,135 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Klaralvdalens 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.13
+import Qt3D.Extras 2.0
+import QtQuick.Window 2.0
+
+Entity {
+ id: sceneRoot
+
+ Window {
+ id: win
+ width: 600
+ height: 600
+ visible: true
+ }
+
+ 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 )
+ }
+
+ components: [
+ RenderSettings {
+ activeFrameGraph: Viewport {
+ normalizedRect: Qt.rect(0.0, 0.0, 1.0, 1.0)
+
+ RenderSurfaceSelector {
+ surface: win
+
+ ClearBuffers {
+ buffers : ClearBuffers.ColorDepthBuffer
+ NoDraw {}
+ }
+
+ CameraSelector {
+ camera: camera
+ }
+ }
+ }
+ pickingSettings {
+ pickResultMode: PickingSettings.NearestPriorityPick
+ pickMethod: PickingSettings.TrianglePicking
+ faceOrientationPickingMode: PickingSettings.FrontAndBackFace
+ }
+ }
+ ]
+
+ CuboidMesh { id: cubeMesh }
+ PhongMaterial { id: material }
+
+ // Entity 1
+ Entity {
+ property ObjectPicker picker: ObjectPicker {
+ id: picker1
+ objectName: "Picker1"
+ }
+
+ property Transform transform: Transform {
+ translation: Qt.vector3d(0, 0, 0)
+ scale: 2.0
+ }
+
+ components: [cubeMesh, material, picker1, transform]
+ }
+
+ // Entity 2
+ Entity {
+ property ObjectPicker picker: ObjectPicker {
+ id: picker2
+ objectName: "Picker2"
+ }
+
+ property Transform transform: Transform {
+ translation: Qt.vector3d(0, 0, 10)
+ scale: 2.5
+ }
+
+ components: [cubeMesh, material, picker2, transform]
+ }
+}
diff --git a/tests/auto/render/pickboundingvolumejob/tst_pickboundingvolumejob.cpp b/tests/auto/render/pickboundingvolumejob/tst_pickboundingvolumejob.cpp
index 21f75b7a4..d7903b8f7 100644
--- a/tests/auto/render/pickboundingvolumejob/tst_pickboundingvolumejob.cpp
+++ b/tests/auto/render/pickboundingvolumejob/tst_pickboundingvolumejob.cpp
@@ -114,6 +114,7 @@ void runRequiredJobs(Qt3DRender::TestAspect *test)
Qt3DRender::Render::UpdateWorldTransformJob updateWorldTransform;
updateWorldTransform.setRoot(test->sceneRoot());
+ updateWorldTransform.setManagers(test->nodeManagers());
updateWorldTransform.run();
// For each buffer
@@ -135,6 +136,7 @@ void runRequiredJobs(Qt3DRender::TestAspect *test)
Qt3DRender::Render::ExpandBoundingVolumeJob expandBVolume;
expandBVolume.setRoot(test->sceneRoot());
+ expandBVolume.setManagers(test->nodeManagers());
expandBVolume.run();
Qt3DRender::Render::UpdateMeshTriangleListJob updateTriangleList;
@@ -249,40 +251,6 @@ private Q_SLOTS:
QCOMPARE(vca.viewport, QRectF(0.0f, 0.0f, 1.0f, 1.0f));
}
- void entityGatherer()
- {
- // GIVEN
- QmlSceneReader sceneReader(QUrl("qrc:/testscene_dragenabled.qml"));
- QScopedPointer<Qt3DCore::QNode> root(qobject_cast<Qt3DCore::QNode *>(sceneReader.root()));
- QVERIFY(root);
- QScopedPointer<Qt3DRender::TestAspect> test(new Qt3DRender::TestAspect(root.data()));
-
- Qt3DRender::Render::UpdateEntityHierarchyJob updateEntitiesJob;
- updateEntitiesJob.setManager(test->nodeManagers());
- updateEntitiesJob.run();
-
- // THEN
- QList<Qt3DCore::QEntity *> frontendEntities;
- frontendEntities << qobject_cast<Qt3DCore::QEntity *>(root.data()) << root->findChildren<Qt3DCore::QEntity *>();
- QCOMPARE(frontendEntities.size(), 4);
-
- // WHEN
- Qt3DRender::Render::PickingUtils::EntityGatherer gatherer(test->nodeManagers()->lookupResource<Qt3DRender::Render::Entity, Qt3DRender::Render::EntityManager>(root->id()));
- QVector<Qt3DRender::Render::Entity *> entities = gatherer.entities();
-
- // THEN
- QCOMPARE(frontendEntities.size(), entities.size());
-
- std::sort(frontendEntities.begin(), frontendEntities.end(),
- [] (Qt3DCore::QEntity *a, Qt3DCore::QEntity *b) { return a->id() > b->id(); });
-
- std::sort(entities.begin(), entities.end(),
- [] (Qt3DRender::Render::Entity *a, Qt3DRender::Render::Entity *b) { return a->peerId() > b->peerId(); });
-
- for (int i = 0, e = frontendEntities.size(); i < e; ++i)
- QCOMPARE(frontendEntities.at(i)->id(), entities.at(i)->peerId());
- }
-
void checkCurrentPickerChange_data()
{
generateAllPickingSettingsCombinations();
@@ -1482,6 +1450,111 @@ private Q_SLOTS:
arbiter.events.clear();
}
+ void checkPriorityPicking()
+ {
+ // GIVEN
+ QmlSceneReader sceneReader(QUrl("qrc:/testscene_priorityoverlapping.qml"));
+ QScopedPointer<Qt3DCore::QNode> root(qobject_cast<Qt3DCore::QNode *>(sceneReader.root()));
+ QVERIFY(root);
+
+ QScopedPointer<Qt3DRender::TestAspect> test(new Qt3DRender::TestAspect(root.data()));
+ TestArbiter arbiter1;
+ TestArbiter arbiter2;
+
+ // Runs Required jobs
+ runRequiredJobs(test.data());
+
+ // THEN
+ QList<Qt3DRender::QObjectPicker *> pickers = root->findChildren<Qt3DRender::QObjectPicker *>();
+ QCOMPARE(pickers.size(), 2);
+
+ Qt3DRender::QObjectPicker *picker1 = nullptr;
+ Qt3DRender::QObjectPicker *picker2 = nullptr;
+ if (pickers.first()->objectName() == QLatin1String("Picker1")) {
+ picker1 = pickers.first();
+ picker2 = pickers.last();
+ } else {
+ picker1 = pickers.last();
+ picker2 = pickers.first();
+ }
+
+ Qt3DRender::Render::ObjectPicker *backendPicker1 = test->nodeManagers()->objectPickerManager()->lookupResource(picker1->id());
+ QVERIFY(backendPicker1);
+ Qt3DCore::QBackendNodePrivate::get(backendPicker1)->setArbiter(&arbiter1);
+
+ Qt3DRender::Render::ObjectPicker *backendPicker2 = test->nodeManagers()->objectPickerManager()->lookupResource(picker2->id());
+ QVERIFY(backendPicker2);
+ Qt3DCore::QBackendNodePrivate::get(backendPicker2)->setArbiter(&arbiter2);
+
+
+ // WHEN both have priority == 0, select closest
+ {
+ Qt3DRender::Render::PickBoundingVolumeJob pickBVJob;
+ initializePickBoundingVolumeJob(&pickBVJob, test.data());
+
+ // WHEN -> Pressed on object
+ QList<QPair<QObject *, QMouseEvent>> events;
+ events.push_back({nullptr, QMouseEvent(QMouseEvent::MouseButtonPress, QPointF(300.0f, 300.0f),
+ Qt::LeftButton, Qt::LeftButton, Qt::NoModifier)});
+ pickBVJob.setMouseEvents(events);
+ bool earlyReturn = !pickBVJob.runHelper();
+
+ // THEN -> Select picker with highest priority
+ QVERIFY(!earlyReturn);
+ QVERIFY(backendPicker1->isPressed());
+ Qt3DCore::QPropertyUpdatedChangePtr change = arbiter1.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "pressed");
+
+ QVERIFY(!backendPicker2->isPressed());
+ QVERIFY(arbiter2.events.isEmpty());
+
+ events.push_back({nullptr, QMouseEvent(QMouseEvent::MouseButtonRelease, QPointF(300.0f, 300.0f),
+ Qt::LeftButton, Qt::LeftButton, Qt::NoModifier)});
+ pickBVJob.setMouseEvents(events);
+ pickBVJob.runHelper();
+ arbiter1.events.clear();
+ arbiter2.events.clear();
+
+ QVERIFY(!backendPicker1->isPressed());
+ QVERIFY(!backendPicker2->isPressed());
+ }
+
+ // WHEN furthest one has higher priority, select furthest one
+ {
+ backendPicker2->setPriority(1000);
+ QCOMPARE(backendPicker2->priority(), 1000);
+
+ Qt3DRender::Render::PickBoundingVolumeJob pickBVJob;
+ initializePickBoundingVolumeJob(&pickBVJob, test.data());
+
+ // WHEN -> Pressed on object
+ QList<QPair<QObject *, QMouseEvent>> events;
+ events.push_back({nullptr, QMouseEvent(QMouseEvent::MouseButtonPress, QPointF(300.0f, 300.0f),
+ Qt::LeftButton, Qt::LeftButton, Qt::NoModifier)});
+ pickBVJob.setMouseEvents(events);
+ bool earlyReturn = !pickBVJob.runHelper();
+
+ // THEN -> Select picker with highest priority
+ QVERIFY(!earlyReturn);
+ QVERIFY(backendPicker2->isPressed());
+ Qt3DCore::QPropertyUpdatedChangePtr change = arbiter2.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "pressed");
+
+ QVERIFY(!backendPicker1->isPressed());
+ QVERIFY(arbiter1.events.isEmpty());
+
+ events.push_back({nullptr, QMouseEvent(QMouseEvent::MouseButtonRelease, QPointF(300.0f, 300.0f),
+ Qt::LeftButton, Qt::LeftButton, Qt::NoModifier)});
+ pickBVJob.setMouseEvents(events);
+ pickBVJob.runHelper();
+ arbiter1.events.clear();
+ arbiter2.events.clear();
+
+ QVERIFY(!backendPicker1->isPressed());
+ QVERIFY(!backendPicker2->isPressed());
+ }
+ }
+
};
QTEST_MAIN(tst_PickBoundingVolumeJob)
diff --git a/tests/auto/render/proximityfilter/tst_proximityfilter.cpp b/tests/auto/render/proximityfilter/tst_proximityfilter.cpp
index 774e2dd1f..ac9cc610c 100644
--- a/tests/auto/render/proximityfilter/tst_proximityfilter.cpp
+++ b/tests/auto/render/proximityfilter/tst_proximityfilter.cpp
@@ -101,6 +101,8 @@ private Q_SLOTS:
// THEN
QCOMPARE(backendProximityFilter.isEnabled(), newValue);
+ QVERIFY(renderer.dirtyBits() & Qt3DRender::Render::AbstractRenderer::FrameGraphDirty);
+ renderer.clearDirtyBits(Qt3DRender::Render::AbstractRenderer::AllDirty);
}
{
// WHEN
@@ -112,6 +114,8 @@ private Q_SLOTS:
// THEN
QCOMPARE(backendProximityFilter.distanceThreshold(), newValue);
+ QVERIFY(renderer.dirtyBits() & Qt3DRender::Render::AbstractRenderer::FrameGraphDirty);
+ renderer.clearDirtyBits(Qt3DRender::Render::AbstractRenderer::AllDirty);
}
{
// WHEN
@@ -123,6 +127,8 @@ private Q_SLOTS:
// THEN
QCOMPARE(backendProximityFilter.entityId(), newValue);
+ QVERIFY(renderer.dirtyBits() & Qt3DRender::Render::AbstractRenderer::FrameGraphDirty);
+ renderer.clearDirtyBits(Qt3DRender::Render::AbstractRenderer::AllDirty);
}
}
diff --git a/tests/auto/render/proximityfiltering/tst_proximityfiltering.cpp b/tests/auto/render/proximityfiltering/tst_proximityfiltering.cpp
index 7bb3c16a7..c8d862b2e 100644
--- a/tests/auto/render/proximityfiltering/tst_proximityfiltering.cpp
+++ b/tests/auto/render/proximityfiltering/tst_proximityfiltering.cpp
@@ -253,10 +253,12 @@ private Q_SLOTS:
Qt3DRender::Render::UpdateTreeEnabledJob updateTreeEnabledJob;
updateTreeEnabledJob.setRoot(backendRoot);
+ updateTreeEnabledJob.setManagers(aspect->nodeManagers());
updateTreeEnabledJob.run();
Qt3DRender::Render::UpdateWorldTransformJob updateWorldTransform;
updateWorldTransform.setRoot(backendRoot);
+ updateWorldTransform.setManagers(aspect->nodeManagers());
updateWorldTransform.run();
Qt3DRender::Render::CalculateBoundingVolumeJob calcBVolume;
@@ -270,6 +272,7 @@ private Q_SLOTS:
Qt3DRender::Render::ExpandBoundingVolumeJob expandBVolume;
expandBVolume.setRoot(backendRoot);
+ expandBVolume.setManagers(aspect->nodeManagers());
expandBVolume.run();
// WHEN
diff --git a/tests/auto/render/qabstracttexture/tst_qabstracttexture.cpp b/tests/auto/render/qabstracttexture/tst_qabstracttexture.cpp
index c7158f4de..73c882619 100644
--- a/tests/auto/render/qabstracttexture/tst_qabstracttexture.cpp
+++ b/tests/auto/render/qabstracttexture/tst_qabstracttexture.cpp
@@ -42,6 +42,17 @@
class FakeTexture : public Qt3DRender::QAbstractTexture
{
+public:
+ int sharedTextureId() const
+ {
+ return static_cast<Qt3DRender::QAbstractTexturePrivate *>(d_ptr.get())->m_sharedTextureId;
+ }
+
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override
+ {
+ Qt3DRender::QAbstractTexture::sceneChangeEvent(change);
+ }
+
};
class FakeTextureImage : public Qt3DRender::QAbstractTextureImage
@@ -91,6 +102,10 @@ private Q_SLOTS:
QCOMPARE(abstractTexture.layers(), 1);
QCOMPARE(abstractTexture.samples(), 1);
QCOMPARE(abstractTexture.textureImages().size(), 0);
+ QCOMPARE(abstractTexture.samples(), 1);
+ QCOMPARE(abstractTexture.sharedTextureId(), -1);
+ QCOMPARE(abstractTexture.handleType(), Qt3DRender::QAbstractTexture::NoHandle);
+ QCOMPARE(abstractTexture.handle(), QVariant());
}
void checkPropertyChanges()
@@ -383,6 +398,7 @@ private Q_SLOTS:
QCOMPARE(abstractTexture.comparisonMode(), cloneData.comparisonMode);
QCOMPARE(abstractTexture.layers(), cloneData.layers);
QCOMPARE(abstractTexture.samples(), cloneData.samples);
+ QCOMPARE(abstractTexture.sharedTextureId(), cloneData.sharedTextureId);
QCOMPARE(abstractTexture.textureImages().size(), cloneData.textureImageIds.size());
for (int i = 0, m = abstractTexture.textureImages().size(); i < m; ++i)
@@ -425,6 +441,7 @@ private Q_SLOTS:
QCOMPARE(abstractTexture.comparisonMode(), cloneData.comparisonMode);
QCOMPARE(abstractTexture.layers(), cloneData.layers);
QCOMPARE(abstractTexture.samples(), cloneData.samples);
+ QCOMPARE(abstractTexture.sharedTextureId(), cloneData.sharedTextureId);
QCOMPARE(abstractTexture.textureImages().size(), cloneData.textureImageIds.size());
for (int i = 0, m = abstractTexture.textureImages().size(); i < m; ++i)
@@ -882,6 +899,238 @@ private Q_SLOTS:
}
}
+ void checkSceneChangedEvent()
+ {
+ // GIVEN
+ TestArbiter arbiter;
+ FakeTexture abstractTexture;
+ arbiter.setArbiterOnNode(&abstractTexture);
+
+ qRegisterMetaType<Qt3DRender::QAbstractTexture::Status>("Status");
+ qRegisterMetaType<Qt3DRender::QAbstractTexture::TextureFormat>("TextureFormat");
+ qRegisterMetaType<Qt3DRender::QAbstractTexture::HandleType>("HandleType");
+
+
+ {
+ QSignalSpy spy(&abstractTexture, SIGNAL(widthChanged(int)));
+
+ // THEN
+ QVERIFY(spy.isValid());
+
+ // WHEN
+ Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ valueChange->setPropertyName("width");
+ valueChange->setValue(883);
+ abstractTexture.sceneChangeEvent(valueChange);
+
+ // THEN
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(arbiter.events.size(), 0);
+ QCOMPARE(abstractTexture.width(), 883);
+
+ // WHEN
+ spy.clear();
+ abstractTexture.sceneChangeEvent(valueChange);
+
+ // THEN
+ QCOMPARE(spy.count(), 0);
+ QCOMPARE(arbiter.events.size(), 0);
+ QCOMPARE(abstractTexture.width(), 883);
+ }
+
+ {
+ QSignalSpy spy(&abstractTexture, SIGNAL(heightChanged(int)));
+
+ // THEN
+ QVERIFY(spy.isValid());
+
+ // WHEN
+ Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ valueChange->setPropertyName("height");
+ valueChange->setValue(1584);
+ abstractTexture.sceneChangeEvent(valueChange);
+
+ // THEN
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(arbiter.events.size(), 0);
+ QCOMPARE(abstractTexture.height(), 1584);
+
+ // WHEN
+ spy.clear();
+ abstractTexture.sceneChangeEvent(valueChange);
+
+ // THEN
+ QCOMPARE(spy.count(), 0);
+ QCOMPARE(arbiter.events.size(), 0);
+ QCOMPARE(abstractTexture.height(), 1584);
+ }
+
+ {
+ QSignalSpy spy(&abstractTexture, SIGNAL(depthChanged(int)));
+
+ // THEN
+ QVERIFY(spy.isValid());
+
+ // WHEN
+ Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ valueChange->setPropertyName("depth");
+ valueChange->setValue(8);
+ abstractTexture.sceneChangeEvent(valueChange);
+
+ // THEN
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(arbiter.events.size(), 0);
+ QCOMPARE(abstractTexture.depth(), 8);
+
+ // WHEN
+ spy.clear();
+ abstractTexture.sceneChangeEvent(valueChange);
+
+ // THEN
+ QCOMPARE(spy.count(), 0);
+ QCOMPARE(arbiter.events.size(), 0);
+ QCOMPARE(abstractTexture.depth(), 8);
+ }
+
+ {
+ QSignalSpy spy(&abstractTexture, SIGNAL(layersChanged(int)));
+
+ // THEN
+ QVERIFY(spy.isValid());
+
+ // WHEN
+ Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ valueChange->setPropertyName("layers");
+ valueChange->setValue(256);
+ abstractTexture.sceneChangeEvent(valueChange);
+
+ // THEN
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(arbiter.events.size(), 0);
+ QCOMPARE(abstractTexture.layers(), 256);
+
+ // WHEN
+ spy.clear();
+ abstractTexture.sceneChangeEvent(valueChange);
+
+ // THEN
+ QCOMPARE(spy.count(), 0);
+ QCOMPARE(arbiter.events.size(), 0);
+ QCOMPARE(abstractTexture.layers(), 256);
+ }
+
+ {
+ QSignalSpy spy(&abstractTexture, SIGNAL(formatChanged(TextureFormat)));
+
+ // THEN
+ QVERIFY(spy.isValid());
+
+ // WHEN
+ Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ valueChange->setPropertyName("format");
+ const auto newFormat = Qt3DRender::QAbstractTexture::R8I;
+ valueChange->setValue(QVariant::fromValue(newFormat));
+ abstractTexture.sceneChangeEvent(valueChange);
+
+ // THEN
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(arbiter.events.size(), 0);
+ QCOMPARE(abstractTexture.format(), newFormat);
+
+ // WHEN
+ spy.clear();
+ abstractTexture.sceneChangeEvent(valueChange);
+
+ // THEN
+ QCOMPARE(spy.count(), 0);
+ QCOMPARE(arbiter.events.size(), 0);
+ QCOMPARE(abstractTexture.format(), newFormat);
+ }
+
+ {
+ QSignalSpy spy(&abstractTexture, SIGNAL(statusChanged(Status)));
+
+ // THEN
+ QVERIFY(spy.isValid());
+
+ // WHEN
+ Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ valueChange->setPropertyName("status");
+ const auto newStatus = Qt3DRender::QAbstractTexture::Error;
+ valueChange->setValue(QVariant::fromValue(newStatus));
+ abstractTexture.sceneChangeEvent(valueChange);
+
+ // THEN
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(arbiter.events.size(), 0);
+ QCOMPARE(abstractTexture.status(), newStatus);
+
+ // WHEN
+ spy.clear();
+ abstractTexture.sceneChangeEvent(valueChange);
+
+ // THEN
+ QCOMPARE(spy.count(), 0);
+ QCOMPARE(arbiter.events.size(), 0);
+ QCOMPARE(abstractTexture.status(), newStatus);
+ }
+
+ {
+ QSignalSpy spy(&abstractTexture, SIGNAL(handleTypeChanged(HandleType)));
+
+ // THEN
+ QVERIFY(spy.isValid());
+
+ // WHEN
+ Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ valueChange->setPropertyName("handleType");
+ const auto newType = Qt3DRender::QAbstractTexture::OpenGLTextureId;
+ valueChange->setValue(QVariant::fromValue(newType));
+ abstractTexture.sceneChangeEvent(valueChange);
+
+ // THEN
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(arbiter.events.size(), 0);
+ QCOMPARE(abstractTexture.handleType(), newType);
+
+ // WHEN
+ spy.clear();
+ abstractTexture.sceneChangeEvent(valueChange);
+
+ // THEN
+ QCOMPARE(spy.count(), 0);
+ QCOMPARE(arbiter.events.size(), 0);
+ QCOMPARE(abstractTexture.handleType(), newType);
+ }
+
+ {
+ QSignalSpy spy(&abstractTexture, SIGNAL(handleChanged(QVariant)));
+
+ // THEN
+ QVERIFY(spy.isValid());
+
+ // WHEN
+ Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ valueChange->setPropertyName("handle");
+ valueChange->setValue(QVariant(1));
+ abstractTexture.sceneChangeEvent(valueChange);
+
+ // THEN
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(arbiter.events.size(), 0);
+ QCOMPARE(abstractTexture.handle(), QVariant(1));
+
+ // WHEN
+ spy.clear();
+ abstractTexture.sceneChangeEvent(valueChange);
+
+ // THEN
+ QCOMPARE(spy.count(), 0);
+ QCOMPARE(arbiter.events.size(), 0);
+ QCOMPARE(abstractTexture.handle(), QVariant(1));
+ }
+ }
+
};
QTEST_MAIN(tst_QAbstractTexture)
diff --git a/tests/auto/render/qbuffer/tst_qbuffer.cpp b/tests/auto/render/qbuffer/tst_qbuffer.cpp
index c0d96d10b..21bedf744 100644
--- a/tests/auto/render/qbuffer/tst_qbuffer.cpp
+++ b/tests/auto/render/qbuffer/tst_qbuffer.cpp
@@ -76,13 +76,13 @@ private Q_SLOTS:
Qt3DRender::QBuffer *defaultConstructed = new Qt3DRender::QBuffer();
QTest::newRow("defaultConstructed") << defaultConstructed;
- Qt3DRender::QBuffer *buffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer);
+ auto buffer = new Qt3DRender::QBuffer;
buffer->setUsage(Qt3DRender::QBuffer::DynamicRead);
buffer->setData(QByteArrayLiteral("There's no replacement"));
buffer->setDataGenerator(Qt3DRender::QBufferDataGeneratorPtr(new TestFunctor(883)));
QTest::newRow("vertex") << buffer;
- Qt3DRender::QBuffer *indexBuffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::IndexBuffer);
+ auto indexBuffer = new Qt3DRender::QBuffer;
indexBuffer->setUsage(Qt3DRender::QBuffer::StaticCopy);
indexBuffer->setData(QByteArrayLiteral("For displacement"));
indexBuffer->setDataGenerator(Qt3DRender::QBufferDataGeneratorPtr(new TestFunctor(1340)));
@@ -125,28 +125,16 @@ private Q_SLOTS:
{
// GIVEN
TestArbiter arbiter;
- QScopedPointer<Qt3DRender::QBuffer> buffer(new Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer));
+ QScopedPointer<Qt3DRender::QBuffer> buffer(new Qt3DRender::QBuffer);
arbiter.setArbiterOnNode(buffer.data());
// WHEN
- buffer->setType(Qt3DRender::QBuffer::IndexBuffer);
- QCoreApplication::processEvents();
-
- // THEN
- QCOMPARE(arbiter.events.size(), 1);
- Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
- QCOMPARE(change->propertyName(), "type");
- QCOMPARE(change->value().value<int>(), static_cast<int>(Qt3DRender::QBuffer::IndexBuffer));
-
- arbiter.events.clear();
-
- // WHEN
buffer->setUsage(Qt3DRender::QBuffer::DynamicCopy);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ auto change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "usage");
QCOMPARE(change->value().value<int>(), static_cast<int>(Qt3DRender::QBuffer::DynamicCopy));
diff --git a/tests/auto/render/qcamera/tst_qcamera.cpp b/tests/auto/render/qcamera/tst_qcamera.cpp
index 7aef2af7d..fb2d3ea64 100644
--- a/tests/auto/render/qcamera/tst_qcamera.cpp
+++ b/tests/auto/render/qcamera/tst_qcamera.cpp
@@ -106,6 +106,7 @@ void runRequiredJobs(Qt3DRender::TestAspect *test)
Qt3DRender::Render::UpdateWorldTransformJob updateWorldTransform;
updateWorldTransform.setRoot(test->sceneRoot());
+ updateWorldTransform.setManagers(test->nodeManagers());
updateWorldTransform.run();
}
diff --git a/tests/auto/render/qcomputecommand/tst_qcomputecommand.cpp b/tests/auto/render/qcomputecommand/tst_qcomputecommand.cpp
index 94609c129..cc07120a2 100644
--- a/tests/auto/render/qcomputecommand/tst_qcomputecommand.cpp
+++ b/tests/auto/render/qcomputecommand/tst_qcomputecommand.cpp
@@ -52,6 +52,7 @@ private Q_SLOTS:
QCOMPARE(computeCommand.workGroupX(), 1);
QCOMPARE(computeCommand.workGroupY(), 1);
QCOMPARE(computeCommand.workGroupZ(), 1);
+ QCOMPARE(computeCommand.runType(), Qt3DRender::QComputeCommand::Continuous);
}
void checkPropertyChanges()
@@ -116,6 +117,25 @@ private Q_SLOTS:
QCOMPARE(computeCommand.workGroupZ(), newValue);
QCOMPARE(spy.count(), 0);
}
+ {
+ // WHEN
+ QSignalSpy spy(&computeCommand, SIGNAL(runTypeChanged()));
+ const Qt3DRender::QComputeCommand::RunType newValue = Qt3DRender::QComputeCommand::Manual;
+ computeCommand.setRunType(newValue);
+
+ // THEN
+ QVERIFY(spy.isValid());
+ QCOMPARE(computeCommand.runType(), newValue);
+ QCOMPARE(spy.count(), 1);
+
+ // WHEN
+ spy.clear();
+ computeCommand.setRunType(newValue);
+
+ // THEN
+ QCOMPARE(computeCommand.runType(), newValue);
+ QCOMPARE(spy.count(), 0);
+ }
}
void checkCreationData()
@@ -126,6 +146,7 @@ private Q_SLOTS:
computeCommand.setWorkGroupX(128);
computeCommand.setWorkGroupY(512);
computeCommand.setWorkGroupZ(1024);
+ computeCommand.setRunType(Qt3DRender::QComputeCommand::Manual);
// WHEN
QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges;
@@ -145,6 +166,8 @@ private Q_SLOTS:
QCOMPARE(computeCommand.workGroupX(), cloneData.workGroupX);
QCOMPARE(computeCommand.workGroupY(), cloneData.workGroupY);
QCOMPARE(computeCommand.workGroupZ(), cloneData.workGroupZ);
+ QCOMPARE(computeCommand.runType(), cloneData.runType);
+ QCOMPARE(0, cloneData.frameCount);
QCOMPARE(computeCommand.id(), creationChangeData->subjectId());
QCOMPARE(computeCommand.isEnabled(), true);
QCOMPARE(computeCommand.isEnabled(), creationChangeData->isNodeEnabled());
@@ -171,6 +194,8 @@ private Q_SLOTS:
QCOMPARE(computeCommand.workGroupZ(), cloneData.workGroupZ);
QCOMPARE(computeCommand.id(), creationChangeData->subjectId());
QCOMPARE(computeCommand.isEnabled(), false);
+ QCOMPARE(computeCommand.runType(), cloneData.runType);
+ QCOMPARE(0, cloneData.frameCount);
QCOMPARE(computeCommand.isEnabled(), creationChangeData->isNodeEnabled());
QCOMPARE(computeCommand.metaObject(), creationChangeData->metaObject());
}
@@ -275,6 +300,144 @@ private Q_SLOTS:
}
+ void checkRunTypeUpdate()
+ {
+ // GIVEN
+ TestArbiter arbiter;
+ Qt3DRender::QComputeCommand computeCommand;
+ arbiter.setArbiterOnNode(&computeCommand);
+
+ {
+ // WHEN
+ computeCommand.setRunType(Qt3DRender::QComputeCommand::Manual);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 1);
+ auto change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "runType");
+ QCOMPARE(change->value().value<int>(), int(computeCommand.runType()));
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+
+ arbiter.events.clear();
+ }
+
+ {
+ // WHEN
+ computeCommand.setRunType(Qt3DRender::QComputeCommand::Manual);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 0);
+ }
+ }
+
+ void checkTrigger()
+ {
+ // GIVEN
+ TestArbiter arbiter;
+ Qt3DRender::QComputeCommand computeCommand;
+ arbiter.setArbiterOnNode(&computeCommand);
+ computeCommand.setRunType(Qt3DRender::QComputeCommand::Manual);
+ computeCommand.setEnabled(false);
+ QCoreApplication::processEvents();
+ arbiter.events.clear();
+
+ {
+ // WHEN
+ computeCommand.trigger(1);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 2);
+ {
+ auto change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "frameCount");
+ QCOMPARE(change->value().value<int>(), 1);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+ }
+ {
+ auto change = arbiter.events.last().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "enabled");
+ QCOMPARE(change->value().value<bool>(), true);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+ }
+
+ computeCommand.setEnabled(false);
+ QCoreApplication::processEvents();
+ arbiter.events.clear();
+ }
+
+ {
+ // WHEN
+ computeCommand.trigger(2);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 2);
+ {
+ auto change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "frameCount");
+ QCOMPARE(change->value().value<int>(), 2);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+ }
+ {
+ auto change = arbiter.events.last().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "enabled");
+ QCOMPARE(change->value().value<bool>(), true);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+ }
+
+
+ computeCommand.setEnabled(false);
+ QCoreApplication::processEvents();
+ arbiter.events.clear();
+ }
+
+ {
+ // WHEN
+ computeCommand.trigger(10, 11, 12, 1);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 5);
+ {
+ auto change = arbiter.events.at(0).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "workGroupX");
+ QCOMPARE(change->value().value<int>(), 10);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+ }
+ {
+ auto change = arbiter.events.at(1).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "workGroupY");
+ QCOMPARE(change->value().value<int>(), 11);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+ }
+ {
+ auto change = arbiter.events.at(2).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "workGroupZ");
+ QCOMPARE(change->value().value<int>(), 12);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+ }
+ {
+ auto change = arbiter.events.at(3).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "frameCount");
+ QCOMPARE(change->value().value<int>(), 1);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+ }
+ {
+ auto change = arbiter.events.last().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "enabled");
+ QCOMPARE(change->value().value<bool>(), true);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+ }
+
+ computeCommand.setEnabled(false);
+ QCoreApplication::processEvents();
+ arbiter.events.clear();
+ }
+ }
+
};
QTEST_MAIN(tst_QComputeCommand)
diff --git a/tests/auto/render/qgeometry/tst_qgeometry.cpp b/tests/auto/render/qgeometry/tst_qgeometry.cpp
index b9271a8c0..55b7e752c 100644
--- a/tests/auto/render/qgeometry/tst_qgeometry.cpp
+++ b/tests/auto/render/qgeometry/tst_qgeometry.cpp
@@ -39,9 +39,21 @@
#include <Qt3DCore/QPropertyUpdatedChange>
#include <Qt3DCore/QPropertyNodeAddedChange>
#include <Qt3DCore/QPropertyNodeRemovedChange>
+#include <QSignalSpy>
#include "testpostmanarbiter.h"
+class FakeGeometry : public Qt3DRender::QGeometry
+{
+ Q_OBJECT
+
+public:
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override
+ {
+ Qt3DRender::QGeometry::sceneChangeEvent(change);
+ }
+};
+
class tst_QGeometry: public QObject
{
Q_OBJECT
@@ -180,6 +192,49 @@ private Q_SLOTS:
// THEN Should not crash when the attribute is destroyed (tests for failed removal of destruction helper)
}
}
+
+ void checkExtentUpdates()
+ {
+ // GIVEN
+ TestArbiter arbiter;
+ QScopedPointer<FakeGeometry> geometry(new FakeGeometry());
+ arbiter.setArbiterOnNode(geometry.data());
+ QSignalSpy spyMinExtent(geometry.data(), SIGNAL(minExtentChanged(QVector3D)));
+ QSignalSpy spyMaxExtent(geometry.data(), SIGNAL(maxExtentChanged(QVector3D)));
+
+ // THEN
+ QVERIFY(spyMinExtent.isValid());
+ QVERIFY(spyMaxExtent.isValid());
+ QCOMPARE(geometry->minExtent(), QVector3D());
+ QCOMPARE(geometry->maxExtent(), QVector3D());
+
+ // WHEN
+ Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ valueChange->setPropertyName("extent");
+ valueChange->setValue(QVariant::fromValue(QPair<QVector3D, QVector3D>(QVector3D(10.0f, 10.f, 10.0f),
+ QVector3D())));
+ geometry->sceneChangeEvent(valueChange);
+
+ // THEN
+ QCOMPARE(spyMinExtent.count(), 1);
+ QCOMPARE(spyMaxExtent.count(), 0);
+ QCOMPARE(geometry->minExtent(), QVector3D(10.0f, 10.0f, 10.0f));
+
+ spyMinExtent.clear();
+
+ // WHEN
+ valueChange->setPropertyName("extent");
+ valueChange->setValue(QVariant::fromValue(QPair<QVector3D, QVector3D>(QVector3D(10.0f, 10.f, 10.0f),
+ QVector3D(11.0f, 11.f, 11.0f))));
+ geometry->sceneChangeEvent(valueChange);
+
+ // THEN
+ QCOMPARE(spyMinExtent.count(), 0);
+ QCOMPARE(spyMaxExtent.count(), 1);
+ QCOMPARE(geometry->maxExtent(), QVector3D(11.0f, 11.0f, 11.0f));
+
+ spyMaxExtent.clear();
+ }
};
QTEST_MAIN(tst_QGeometry)
diff --git a/tests/auto/render/qobjectpicker/tst_qobjectpicker.cpp b/tests/auto/render/qobjectpicker/tst_qobjectpicker.cpp
index 6714d8a06..bd486774c 100644
--- a/tests/auto/render/qobjectpicker/tst_qobjectpicker.cpp
+++ b/tests/auto/render/qobjectpicker/tst_qobjectpicker.cpp
@@ -31,8 +31,10 @@
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
#include <Qt3DRender/QObjectPicker>
+#include <Qt3DRender/private/qobjectpicker_p.h>
#include <Qt3DRender/QPickEvent>
-
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
+#include <Qt3DCore/qnodecreatedchange.h>
#include "testpostmanarbiter.h"
class MyObjectPicker : public Qt3DRender::QObjectPicker
@@ -71,6 +73,162 @@ public:
private Q_SLOTS:
+ void checkInitialState()
+ {
+ // GIVEN
+ Qt3DRender::QObjectPicker picker;
+
+ // THEN
+ QCOMPARE(picker.priority(), 0);
+ QCOMPARE(picker.isDragEnabled(), false);
+ QCOMPARE(picker.isHoverEnabled(), false);
+ }
+
+ void checkCreationData()
+ {
+ // GIVEN
+ Qt3DRender::QObjectPicker picker;
+
+ picker.setPriority(1584);
+ picker.setDragEnabled(true);
+ picker.setHoverEnabled(true);
+
+ // WHEN
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges;
+
+ {
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&picker);
+ creationChanges = creationChangeGenerator.creationChanges();
+ }
+
+ // THEN
+ {
+ QCOMPARE(creationChanges.size(), 1);
+
+ const auto creationChangeData = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QObjectPickerData>>(creationChanges.first());
+ const Qt3DRender::QObjectPickerData cloneData = creationChangeData->data;
+
+ QCOMPARE(cloneData.priority, 1584);
+ QCOMPARE(cloneData.hoverEnabled, true);
+ QCOMPARE(cloneData.dragEnabled, true);
+ QCOMPARE(picker.id(), creationChangeData->subjectId());
+ QCOMPARE(picker.isEnabled(), true);
+ QCOMPARE(picker.isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(picker.metaObject(), creationChangeData->metaObject());
+ }
+
+ // WHEN
+ picker.setEnabled(false);
+
+ {
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&picker);
+ creationChanges = creationChangeGenerator.creationChanges();
+ }
+
+ // THEN
+ {
+ QCOMPARE(creationChanges.size(), 1);
+
+ const auto creationChangeData = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QObjectPickerData>>(creationChanges.first());
+ const Qt3DRender::QObjectPickerData cloneData = creationChangeData->data;
+
+ QCOMPARE(cloneData.priority, 1584);
+ QCOMPARE(cloneData.hoverEnabled, true);
+ QCOMPARE(cloneData.dragEnabled, true);
+ QCOMPARE(picker.id(), creationChangeData->subjectId());
+ QCOMPARE(picker.isEnabled(), false);
+ QCOMPARE(picker.isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(picker.metaObject(), creationChangeData->metaObject());
+ }
+ }
+
+ void checkPropertyUpdate()
+ {
+ // GIVEN
+ TestArbiter arbiter;
+ Qt3DRender::QObjectPicker picker;
+ arbiter.setArbiterOnNode(&picker);
+
+ {
+ {
+ // WHEN
+ picker.setPriority(883);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 1);
+ QCOMPARE(picker.priority(), 883);
+ auto change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "priority");
+ QCOMPARE(change->value().value<int>(), picker.priority());
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+
+ arbiter.events.clear();
+ }
+
+ {
+ // WHEN
+ picker.setPriority(883);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 0);
+ }
+ }
+ {
+ {
+ // WHEN
+ picker.setDragEnabled(true);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 1);
+ QCOMPARE(picker.isDragEnabled(), true);
+ auto change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "dragEnabled");
+ QCOMPARE(change->value().value<bool>(), picker.isDragEnabled());
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+
+ arbiter.events.clear();
+ }
+
+ {
+ // WHEN
+ picker.setDragEnabled(true);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 0);
+ }
+ }
+ {
+ {
+ // WHEN
+ picker.setHoverEnabled(true);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 1);
+ QCOMPARE(picker.isHoverEnabled(), true);
+ auto change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "hoverEnabled");
+ QCOMPARE(change->value().value<bool>(), picker.isHoverEnabled());
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+
+ arbiter.events.clear();
+ }
+
+ {
+ // WHEN
+ picker.setHoverEnabled(true);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 0);
+ }
+ }
+ }
+
void checkCloning_data()
{
QTest::addColumn<Qt3DRender::QObjectPicker *>("objectPicker");
diff --git a/tests/auto/render/qsetfence/qsetfence.pro b/tests/auto/render/qsetfence/qsetfence.pro
new file mode 100644
index 000000000..4e70559c9
--- /dev/null
+++ b/tests/auto/render/qsetfence/qsetfence.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+
+TARGET = tst_qsetfence
+
+QT += 3dcore 3dcore-private 3drender 3drender-private testlib
+
+CONFIG += testcase
+
+SOURCES += tst_qsetfence.cpp
+
+include(../../core/common/common.pri)
+include(../commons/commons.pri)
diff --git a/tests/auto/render/qsetfence/tst_qsetfence.cpp b/tests/auto/render/qsetfence/tst_qsetfence.cpp
new file mode 100644
index 000000000..c602e6f5c
--- /dev/null
+++ b/tests/auto/render/qsetfence/tst_qsetfence.cpp
@@ -0,0 +1,190 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** 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 <QtTest/QTest>
+#include <Qt3DRender/qsetfence.h>
+#include <Qt3DRender/private/qsetfence_p.h>
+#include <QObject>
+#include <QSignalSpy>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
+#include <Qt3DCore/qnodecreatedchange.h>
+#include <Qt3DCore/private/qscene_p.h>
+#include "testpostmanarbiter.h"
+
+class MySetFence : public Qt3DRender::QSetFence
+{
+public:
+ using Qt3DRender::QSetFence::sceneChangeEvent;
+};
+
+class tst_QSetFence : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+
+ void initTestCase()
+ {
+ qRegisterMetaType<Qt3DRender::QSetFence::HandleType>("HandleType");
+ }
+
+ void checkDefaultConstruction()
+ {
+ // GIVEN
+ Qt3DRender::QSetFence setFence;
+
+ // THEN
+ QCOMPARE(setFence.handleType(), Qt3DRender::QSetFence::NoHandle);
+ QCOMPARE(setFence.handle(), QVariant());
+ }
+
+ void checkPropertyChanges()
+ {
+ // GIVEN
+ Qt3DCore::QScene scene;
+ MySetFence setFence;
+
+ Qt3DCore::QNodePrivate::get(&setFence)->setScene(&scene);
+
+ {
+ // WHEN
+ QSignalSpy spy(&setFence, SIGNAL(handleTypeChanged(HandleType)));
+
+ // THEN
+ QVERIFY(spy.isValid());
+
+ // THEN
+ Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ valueChange->setPropertyName("handleType");
+ valueChange->setValue(QVariant::fromValue(Qt3DRender::QSetFence::OpenGLFenceId));
+ setFence.sceneChangeEvent(valueChange);
+
+ // THEN
+ QCOMPARE(setFence.handleType(), Qt3DRender::QSetFence::OpenGLFenceId);
+ QCOMPARE(spy.count(), 1);
+
+ // WHEN
+ spy.clear();
+ setFence.sceneChangeEvent(valueChange);
+
+ // THEN
+ QCOMPARE(spy.count(), 0);
+ }
+
+ {
+ // WHEN
+ QSignalSpy spy(&setFence, SIGNAL(handleChanged(QVariant)));
+
+ // THEN
+ QVERIFY(spy.isValid());
+
+ // WHEN
+ Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ valueChange->setPropertyName("handle");
+ valueChange->setValue(QVariant(984));
+ setFence.sceneChangeEvent(valueChange);
+
+ // THEN
+ QCOMPARE(setFence.handle(),QVariant(984));
+ QCOMPARE(spy.count(), 1);
+
+ // WHEN
+ spy.clear();
+ setFence.sceneChangeEvent(valueChange);
+
+ // THEN
+ QCOMPARE(spy.count(), 0);
+ }
+ }
+
+ void checkCreationData()
+ {
+ // GIVEN
+ Qt3DRender::QSetFence setFence;
+
+
+ // WHEN
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges;
+
+ {
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&setFence);
+ creationChanges = creationChangeGenerator.creationChanges();
+ }
+
+ // THEN
+ {
+ QCOMPARE(creationChanges.size(), 1);
+
+ const auto creationChangeData = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QSetFenceData>>(creationChanges.first());
+ const Qt3DRender::QSetFenceData cloneData = creationChangeData->data;
+
+ QCOMPARE(setFence.id(), creationChangeData->subjectId());
+ QCOMPARE(setFence.isEnabled(), true);
+ QCOMPARE(setFence.isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(setFence.metaObject(), creationChangeData->metaObject());
+ }
+
+ // WHEN
+ setFence.setEnabled(false);
+
+ {
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&setFence);
+ creationChanges = creationChangeGenerator.creationChanges();
+ }
+
+ // THEN
+ {
+ QCOMPARE(creationChanges.size(), 1);
+
+ const auto creationChangeData = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QSetFenceData>>(creationChanges.first());
+ const Qt3DRender::QSetFenceData cloneData = creationChangeData->data;
+
+ QCOMPARE(setFence.id(), creationChangeData->subjectId());
+ QCOMPARE(setFence.isEnabled(), false);
+ QCOMPARE(setFence.isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(setFence.metaObject(), creationChangeData->metaObject());
+ }
+ }
+
+};
+
+QTEST_MAIN(tst_QSetFence)
+
+#include "tst_qsetfence.moc"
diff --git a/tests/auto/render/qshaderprogrambuilder/tst_qshaderprogrambuilder.cpp b/tests/auto/render/qshaderprogrambuilder/tst_qshaderprogrambuilder.cpp
index 93bee22cc..021a3d6c1 100644
--- a/tests/auto/render/qshaderprogrambuilder/tst_qshaderprogrambuilder.cpp
+++ b/tests/auto/render/qshaderprogrambuilder/tst_qshaderprogrambuilder.cpp
@@ -38,12 +38,12 @@
#include <Qt3DCore/qnodecreatedchange.h>
#include "testpostmanarbiter.h"
-class tst_QShaderProgramBuilder : public QObject
+class tst_QShaderProgramBuilder : public Qt3DRender::QShaderProgramBuilder
{
Q_OBJECT
public:
tst_QShaderProgramBuilder()
- : QObject()
+ : Qt3DRender::QShaderProgramBuilder()
{
qRegisterMetaType<Qt3DRender::QShaderProgram*>("Qt3DRender::QShaderProgram*");
}
@@ -63,6 +63,12 @@ private Q_SLOTS:
QCOMPARE(builder.geometryShaderGraph(), QUrl());
QCOMPARE(builder.fragmentShaderGraph(), QUrl());
QCOMPARE(builder.computeShaderGraph(), QUrl());
+ QCOMPARE(builder.vertexShaderCode(), QByteArray());
+ QCOMPARE(builder.fragmentShaderCode(), QByteArray());
+ QCOMPARE(builder.computeShaderCode(), QByteArray());
+ QCOMPARE(builder.geometryShaderCode(), QByteArray());
+ QCOMPARE(builder.tessellationEvaluationShaderCode(), QByteArray());
+ QCOMPARE(builder.tessellationControlShaderCode(), QByteArray());
}
void checkPropertyChanges()
@@ -592,8 +598,90 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 0);
}
+ }
+
+ void checkGeneratedCodePropertyUpdates()
+ {
+ {
+ // WHEN
+ QSignalSpy spy(this, SIGNAL(vertexShaderCodeChanged(QByteArray)));
+ Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ valueChange->setPropertyName("generatedShaderCode");
+ valueChange->setValue(QVariant::fromValue(QPair<int, QByteArray>(int(Qt3DRender::QShaderProgram::Vertex), QByteArrayLiteral("vertex"))));
+ sceneChangeEvent(valueChange);
+
+ // THEN
+ QVERIFY(spy.isValid());
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(vertexShaderCode(), QByteArrayLiteral("vertex"));
+ }
+ {
+ // WHEN
+ QSignalSpy spy(this, SIGNAL(fragmentShaderCodeChanged(QByteArray)));
+ Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ valueChange->setPropertyName("generatedShaderCode");
+ valueChange->setValue(QVariant::fromValue(QPair<int, QByteArray>(int(Qt3DRender::QShaderProgram::Fragment), QByteArrayLiteral("fragment"))));
+ sceneChangeEvent(valueChange);
+ // THEN
+ QVERIFY(spy.isValid());
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(fragmentShaderCode(), QByteArrayLiteral("fragment"));
+ }
+ {
+ // WHEN
+ QSignalSpy spy(this, SIGNAL(geometryShaderCodeChanged(QByteArray)));
+ Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ valueChange->setPropertyName("generatedShaderCode");
+ valueChange->setValue(QVariant::fromValue(QPair<int, QByteArray>(int(Qt3DRender::QShaderProgram::Geometry), QByteArrayLiteral("geometry"))));
+ sceneChangeEvent(valueChange);
+
+ // THEN
+ QVERIFY(spy.isValid());
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(geometryShaderCode(), QByteArrayLiteral("geometry"));
+ }
+ {
+ // WHEN
+ QSignalSpy spy(this, SIGNAL(computeShaderCodeChanged(QByteArray)));
+ Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ valueChange->setPropertyName("generatedShaderCode");
+ valueChange->setValue(QVariant::fromValue(QPair<int, QByteArray>(int(Qt3DRender::QShaderProgram::Compute), QByteArrayLiteral("compute"))));
+ sceneChangeEvent(valueChange);
+
+ // THEN
+ QVERIFY(spy.isValid());
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(computeShaderCode(), QByteArrayLiteral("compute"));
+ }
+ {
+ // WHEN
+ QSignalSpy spy(this, SIGNAL(tessellationControlShaderCodeChanged(QByteArray)));
+ Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ valueChange->setPropertyName("generatedShaderCode");
+ valueChange->setValue(QVariant::fromValue(QPair<int, QByteArray>(int(Qt3DRender::QShaderProgram::TessellationControl), QByteArrayLiteral("control"))));
+ sceneChangeEvent(valueChange);
+
+ // THEN
+ QVERIFY(spy.isValid());
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(tessellationControlShaderCode(), QByteArrayLiteral("control"));
+ }
+ {
+ // WHEN
+ QSignalSpy spy(this, SIGNAL(tessellationEvaluationShaderCodeChanged(QByteArray)));
+ Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ valueChange->setPropertyName("generatedShaderCode");
+ valueChange->setValue(QVariant::fromValue(QPair<int, QByteArray>(int(Qt3DRender::QShaderProgram::TessellationEvaluation), QByteArrayLiteral("eval"))));
+ sceneChangeEvent(valueChange);
+
+ // THEN
+ QVERIFY(spy.isValid());
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(tessellationEvaluationShaderCode(), QByteArrayLiteral("eval"));
+ }
}
+
};
QTEST_MAIN(tst_QShaderProgramBuilder)
diff --git a/tests/auto/render/qsharedgltexture/qsharedgltexture.pro b/tests/auto/render/qsharedgltexture/qsharedgltexture.pro
new file mode 100644
index 000000000..a5c76aa7d
--- /dev/null
+++ b/tests/auto/render/qsharedgltexture/qsharedgltexture.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+
+TARGET = tst_qsharedgltexture
+
+QT += 3dcore 3dcore-private 3drender 3drender-private testlib
+
+CONFIG += testcase
+
+SOURCES += tst_qsharedgltexture.cpp
+
+include(../../core/common/common.pri)
+include(../commons/commons.pri)
diff --git a/tests/auto/render/qsharedgltexture/tst_qsharedgltexture.cpp b/tests/auto/render/qsharedgltexture/tst_qsharedgltexture.cpp
new file mode 100644
index 000000000..1a1db60e4
--- /dev/null
+++ b/tests/auto/render/qsharedgltexture/tst_qsharedgltexture.cpp
@@ -0,0 +1,171 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Klaralvdalens 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/qtexture.h>
+#include <Qt3DRender/private/qtexture_p.h>
+#include <QObject>
+#include <QSignalSpy>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
+#include <Qt3DCore/qnodecreatedchange.h>
+#include "testpostmanarbiter.h"
+
+class tst_QSharedGLTexture : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+
+ void checkDefaultConstruction()
+ {
+ // GIVEN
+ Qt3DRender::QSharedGLTexture glTexture;
+
+ // THEN
+ QCOMPARE(glTexture.textureId(), -1);
+ QCOMPARE(glTexture.target(), Qt3DRender::QAbstractTexture::TargetAutomatic);
+ }
+
+ void checkPropertyChanges()
+ {
+ // GIVEN
+ Qt3DRender::QSharedGLTexture glTexture;
+
+ {
+ // WHEN
+ QSignalSpy spy(&glTexture, SIGNAL(textureIdChanged(int)));
+ const int newValue = 883;
+ glTexture.setTextureId(newValue);
+
+ // THEN
+ QVERIFY(spy.isValid());
+ QCOMPARE(glTexture.textureId(), newValue);
+ QCOMPARE(spy.count(), 1);
+
+ // WHEN
+ spy.clear();
+ glTexture.setTextureId(newValue);
+
+ // THEN
+ QCOMPARE(glTexture.textureId(), newValue);
+ QCOMPARE(spy.count(), 0);
+ }
+ }
+
+ void checkCreationData()
+ {
+ // GIVEN
+ Qt3DRender::QSharedGLTexture glTexture;
+
+ glTexture.setTextureId(1200);
+
+ // WHEN
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges;
+
+ {
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&glTexture);
+ creationChanges = creationChangeGenerator.creationChanges();
+ }
+
+ // THEN
+ {
+ QCOMPARE(creationChanges.size(), 1);
+
+ const auto creationChangeData = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QAbstractTextureData>>(creationChanges.first());
+ const Qt3DRender::QAbstractTextureData cloneData = creationChangeData->data;
+
+ QCOMPARE(glTexture.id(), creationChangeData->subjectId());
+ QCOMPARE(glTexture.isEnabled(), true);
+ QCOMPARE(glTexture.isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(glTexture.metaObject(), creationChangeData->metaObject());
+ QCOMPARE(cloneData.sharedTextureId, 1200);
+ }
+
+ // WHEN
+ glTexture.setEnabled(false);
+
+ {
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&glTexture);
+ creationChanges = creationChangeGenerator.creationChanges();
+ }
+
+ // THEN
+ {
+ QCOMPARE(creationChanges.size(), 1);
+
+ const auto creationChangeData = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QAbstractTextureData>>(creationChanges.first());
+ const Qt3DRender::QAbstractTextureData cloneData = creationChangeData->data;
+
+ QCOMPARE(glTexture.id(), creationChangeData->subjectId());
+ QCOMPARE(glTexture.isEnabled(), false);
+ QCOMPARE(glTexture.isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(glTexture.metaObject(), creationChangeData->metaObject());
+ QCOMPARE(cloneData.sharedTextureId, 1200);
+ }
+ }
+
+ void checkTextureIdUpdate()
+ {
+ // GIVEN
+ TestArbiter arbiter;
+ Qt3DRender::QSharedGLTexture glTexture;
+ arbiter.setArbiterOnNode(&glTexture);
+
+ {
+ // WHEN
+ glTexture.setTextureId(1584);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 1);
+ const auto change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "textureId");
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+ QCOMPARE(change->value().toInt(), 1584);
+
+ arbiter.events.clear();
+ }
+
+ {
+ // WHEN
+ glTexture.setTextureId(1584);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 0);
+ }
+
+ }
+
+};
+
+QTEST_MAIN(tst_QSharedGLTexture)
+
+#include "tst_qsharedgltexture.moc"
diff --git a/tests/auto/render/qwaitfence/qwaitfence.pro b/tests/auto/render/qwaitfence/qwaitfence.pro
new file mode 100644
index 000000000..18ac21088
--- /dev/null
+++ b/tests/auto/render/qwaitfence/qwaitfence.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+
+TARGET = tst_qwaitfence
+
+QT += 3dcore 3dcore-private 3drender 3drender-private testlib
+
+CONFIG += testcase
+
+SOURCES += tst_qwaitfence.cpp
+
+include(../../core/common/common.pri)
+include(../commons/commons.pri)
diff --git a/tests/auto/render/qwaitfence/tst_qwaitfence.cpp b/tests/auto/render/qwaitfence/tst_qwaitfence.cpp
new file mode 100644
index 000000000..ab3ae9b4d
--- /dev/null
+++ b/tests/auto/render/qwaitfence/tst_qwaitfence.cpp
@@ -0,0 +1,349 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** 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 <QtTest/QTest>
+#include <Qt3DRender/qwaitfence.h>
+#include <Qt3DRender/private/qwaitfence_p.h>
+#include <QObject>
+#include <QSignalSpy>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
+#include <Qt3DCore/qnodecreatedchange.h>
+#include "testpostmanarbiter.h"
+
+class tst_QWaitFence : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+
+ void initTestCase()
+ {
+ qRegisterMetaType<Qt3DRender::QWaitFence::HandleType>("HandleType");
+ }
+
+ void checkDefaultConstruction()
+ {
+ // GIVEN
+ Qt3DRender::QWaitFence waitFence;
+
+ // THEN
+ QCOMPARE(waitFence.handleType(), Qt3DRender::QWaitFence::NoHandle);
+ QCOMPARE(waitFence.handle(), QVariant());
+ QCOMPARE(waitFence.waitOnCPU(), false);
+ QCOMPARE(waitFence.timeout(), quint64(-1));
+ }
+
+ void checkPropertyChanges()
+ {
+ // GIVEN
+ Qt3DRender::QWaitFence waitFence;
+
+ {
+ // WHEN
+ QSignalSpy spy(&waitFence, SIGNAL(handleTypeChanged(HandleType)));
+ const Qt3DRender::QWaitFence::HandleType newValue = Qt3DRender::QWaitFence::OpenGLFenceId;
+ waitFence.setHandleType(newValue);
+
+ // THEN
+ QVERIFY(spy.isValid());
+ QCOMPARE(waitFence.handleType(), newValue);
+ QCOMPARE(spy.count(), 1);
+
+ // WHEN
+ spy.clear();
+ waitFence.setHandleType(newValue);
+
+ // THEN
+ QCOMPARE(waitFence.handleType(), newValue);
+ QCOMPARE(spy.count(), 0);
+ }
+ {
+ // WHEN
+ QSignalSpy spy(&waitFence, SIGNAL(handleChanged(QVariant)));
+ const QVariant newValue(883);
+ waitFence.setHandle(newValue);
+
+ // THEN
+ QVERIFY(spy.isValid());
+ QCOMPARE(waitFence.handle(), newValue);
+ QCOMPARE(spy.count(), 1);
+
+ // WHEN
+ spy.clear();
+ waitFence.setHandle(newValue);
+
+ // THEN
+ QCOMPARE(waitFence.handle(), newValue);
+ QCOMPARE(spy.count(), 0);
+ }
+ {
+ // WHEN
+ QSignalSpy spy(&waitFence, SIGNAL(waitOnCPUChanged(bool)));
+ const bool newValue = true;
+ waitFence.setWaitOnCPU(newValue);
+
+ // THEN
+ QVERIFY(spy.isValid());
+ QCOMPARE(waitFence.waitOnCPU(), newValue);
+ QCOMPARE(spy.count(), 1);
+
+ // WHEN
+ spy.clear();
+ waitFence.setWaitOnCPU(newValue);
+
+ // THEN
+ QCOMPARE(waitFence.waitOnCPU(), newValue);
+ QCOMPARE(spy.count(), 0);
+ }
+ {
+ // WHEN
+ QSignalSpy spy(&waitFence, SIGNAL(timeoutChanged(quint64)));
+ const quint64 newValue = 984;
+ waitFence.setTimeout(newValue);
+
+ // THEN
+ QVERIFY(spy.isValid());
+ QCOMPARE(waitFence.timeout(), newValue);
+ QCOMPARE(spy.count(), 1);
+
+ // WHEN
+ spy.clear();
+ waitFence.setTimeout(newValue);
+
+ // THEN
+ QCOMPARE(waitFence.timeout(), newValue);
+ QCOMPARE(spy.count(), 0);
+ }
+ }
+
+ void checkCreationData()
+ {
+ // GIVEN
+ Qt3DRender::QWaitFence waitFence;
+
+ waitFence.setHandleType(Qt3DRender::QWaitFence::OpenGLFenceId);
+ waitFence.setHandle(QVariant(1200));
+ waitFence.setWaitOnCPU(true);
+ waitFence.setTimeout(1584);
+
+ // WHEN
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges;
+
+ {
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&waitFence);
+ creationChanges = creationChangeGenerator.creationChanges();
+ }
+
+ // THEN
+ {
+ QCOMPARE(creationChanges.size(), 1);
+
+ const auto creationChangeData = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QWaitFenceData>>(creationChanges.first());
+ const Qt3DRender::QWaitFenceData cloneData = creationChangeData->data;
+
+ QCOMPARE(waitFence.handleType(), cloneData.handleType);
+ QCOMPARE(waitFence.handle(), cloneData.handle);
+ QCOMPARE(waitFence.waitOnCPU(), cloneData.waitOnCPU);
+ QCOMPARE(waitFence.timeout(), cloneData.timeout);
+ QCOMPARE(waitFence.id(), creationChangeData->subjectId());
+ QCOMPARE(waitFence.isEnabled(), true);
+ QCOMPARE(waitFence.isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(waitFence.metaObject(), creationChangeData->metaObject());
+ }
+
+ // WHEN
+ waitFence.setEnabled(false);
+
+ {
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&waitFence);
+ creationChanges = creationChangeGenerator.creationChanges();
+ }
+
+ // THEN
+ {
+ QCOMPARE(creationChanges.size(), 1);
+
+ const auto creationChangeData = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QWaitFenceData>>(creationChanges.first());
+ const Qt3DRender::QWaitFenceData cloneData = creationChangeData->data;
+
+ QCOMPARE(waitFence.handleType(), cloneData.handleType);
+ QCOMPARE(waitFence.handle(), cloneData.handle);
+ QCOMPARE(waitFence.waitOnCPU(), cloneData.waitOnCPU);
+ QCOMPARE(waitFence.timeout(), cloneData.timeout);
+ QCOMPARE(waitFence.id(), creationChangeData->subjectId());
+ QCOMPARE(waitFence.isEnabled(), false);
+ QCOMPARE(waitFence.isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(waitFence.metaObject(), creationChangeData->metaObject());
+ }
+ }
+
+ void checkHandleTypeUpdate()
+ {
+ // GIVEN
+ TestArbiter arbiter;
+ Qt3DRender::QWaitFence waitFence;
+ arbiter.setArbiterOnNode(&waitFence);
+
+ {
+ // WHEN
+ waitFence.setHandleType(Qt3DRender::QWaitFence::OpenGLFenceId);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 1);
+ auto change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "handleType");
+ QCOMPARE(change->value().value<Qt3DRender::QWaitFence::HandleType>(), waitFence.handleType());
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+
+ arbiter.events.clear();
+ }
+
+ {
+ // WHEN
+ waitFence.setHandleType(Qt3DRender::QWaitFence::OpenGLFenceId);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 0);
+ }
+ }
+
+ void checkHandleUpdate()
+ {
+ // GIVEN
+ TestArbiter arbiter;
+ Qt3DRender::QWaitFence waitFence;
+ arbiter.setArbiterOnNode(&waitFence);
+
+ {
+ // WHEN
+ waitFence.setHandle(QVariant(883));
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 1);
+ auto change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "handle");
+ QCOMPARE(change->value().value<QVariant>(), waitFence.handle());
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+
+ arbiter.events.clear();
+ }
+
+ {
+ // WHEN
+ waitFence.setHandle(QVariant(883));
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 0);
+ }
+ }
+
+ void checkWaitOnCPUUpdate()
+ {
+ // GIVEN
+ TestArbiter arbiter;
+ Qt3DRender::QWaitFence waitFence;
+ arbiter.setArbiterOnNode(&waitFence);
+
+ {
+ // WHEN
+ waitFence.setWaitOnCPU(true);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 1);
+ auto change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "waitOnCPU");
+ QCOMPARE(change->value().value<bool>(), waitFence.waitOnCPU());
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+
+ arbiter.events.clear();
+ }
+
+ {
+ // WHEN
+ waitFence.setWaitOnCPU(true);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 0);
+ }
+ }
+
+ void checkTimeoutUpdate()
+ {
+ // GIVEN
+ TestArbiter arbiter;
+ Qt3DRender::QWaitFence waitFence;
+ arbiter.setArbiterOnNode(&waitFence);
+
+ {
+ // WHEN
+ waitFence.setTimeout(quint64(600));
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 1);
+ auto change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "timeout");
+ QCOMPARE(change->value().value<quint64>(), waitFence.timeout());
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+
+ arbiter.events.clear();
+ }
+
+ {
+ // WHEN
+ waitFence.setTimeout(quint64(600));
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 0);
+ }
+ }
+};
+
+QTEST_MAIN(tst_QWaitFence)
+
+#include "tst_qwaitfence.moc"
diff --git a/tests/auto/render/raycastingjob/tst_raycastingjob.cpp b/tests/auto/render/raycastingjob/tst_raycastingjob.cpp
index 411bb9160..9477947ac 100644
--- a/tests/auto/render/raycastingjob/tst_raycastingjob.cpp
+++ b/tests/auto/render/raycastingjob/tst_raycastingjob.cpp
@@ -113,6 +113,7 @@ void runRequiredJobs(Qt3DRender::TestAspect *test)
Qt3DRender::Render::UpdateWorldTransformJob updateWorldTransform;
updateWorldTransform.setRoot(test->sceneRoot());
+ updateWorldTransform.setManagers(test->nodeManagers());
updateWorldTransform.run();
// For each buffer
@@ -134,6 +135,7 @@ void runRequiredJobs(Qt3DRender::TestAspect *test)
Qt3DRender::Render::ExpandBoundingVolumeJob expandBVolume;
expandBVolume.setRoot(test->sceneRoot());
+ expandBVolume.setManagers(test->nodeManagers());
expandBVolume.run();
Qt3DRender::Render::UpdateMeshTriangleListJob updateTriangleList;
diff --git a/tests/auto/render/render.pro b/tests/auto/render/render.pro
index 2fa8538f9..edf6fa101 100644
--- a/tests/auto/render/render.pro
+++ b/tests/auto/render/render.pro
@@ -59,6 +59,7 @@ qtConfig(private_tests) {
qparameter \
parameter \
qtextureloader \
+ qsharedgltexture \
qtextureimage \
qabstracttexture \
qabstracttextureimage \
@@ -98,7 +99,11 @@ qtConfig(private_tests) {
raycaster \
qscreenraycaster \
raycastingjob \
- qcamera
+ qcamera \
+ qsetfence \
+ qwaitfence \
+ setfence \
+ waitfence
QT_FOR_CONFIG = 3dcore-private
# TO DO: These could be restored to be executed in all cases
@@ -153,5 +158,5 @@ qtConfig(qt3d-opengl-renderer):qtConfig(private_tests) {
!macos: SUBDIRS += graphicshelpergl4
qtConfig(qt3d-simd-avx2): SUBDIRS += alignedresourcesmanagers-avx
- qtConfig(qt3d-simd-sse2): SUBDIRS += alignedresourcesmanagers-sse
+ qtConfig(qt3d-simd-sse2):!qtConfig(qt3d-simd-avx2): SUBDIRS += alignedresourcesmanagers-sse
}
diff --git a/tests/auto/render/renderer/tst_renderer.cpp b/tests/auto/render/renderer/tst_renderer.cpp
index 892e13b25..2fc76c792 100644
--- a/tests/auto/render/renderer/tst_renderer.cpp
+++ b/tests/auto/render/renderer/tst_renderer.cpp
@@ -45,6 +45,88 @@ public :
~tst_Renderer() {}
private Q_SLOTS:
+
+ void checkPreRenderBinJobs()
+ {
+ // GIVEN
+ Qt3DRender::Render::NodeManagers nodeManagers;
+ Qt3DRender::Render::Renderer renderer(Qt3DRender::QRenderAspect::Synchronous);
+ Qt3DRender::Render::OffscreenSurfaceHelper offscreenHelper(&renderer);
+ Qt3DRender::Render::RenderSettings settings;
+ // owned by FG manager
+ Qt3DRender::Render::ViewportNode *fgRoot = new Qt3DRender::Render::ViewportNode();
+ const Qt3DCore::QNodeId fgRootId = Qt3DCore::QNodeId::createId();
+
+ nodeManagers.frameGraphManager()->appendNode(fgRootId, fgRoot);
+ settings.setActiveFrameGraphId(fgRootId);
+
+ renderer.setNodeManagers(&nodeManagers);
+ renderer.setSettings(&settings);
+ renderer.setOffscreenSurfaceHelper(&offscreenHelper);
+ renderer.initialize();
+
+ // Ensure invoke calls are performed
+ QCoreApplication::processEvents();
+
+ // WHEN (nothing dirty, no buffers, no layers to be rebuilt, no materials to be rebuilt)
+ QVector<Qt3DCore::QAspectJobPtr> jobs = renderer.preRenderingJobs();
+
+ // THEN
+ QCOMPARE(jobs.size(),
+ 1 + // PickBoundingVolumeJob
+ 1); // RayCastingJob
+
+ // WHEN
+ renderer.addRenderCaptureSendRequest(Qt3DCore::QNodeId::createId());
+ jobs = renderer.preRenderingJobs();
+
+ // THEN
+ QCOMPARE(jobs.size(),
+ 1 + // PickBoundingVolumeJob
+ 1 + // RayCastingJob
+ 1); // SendRenderCaptureJob
+
+ // WHEN
+ renderer.m_sendBufferCaptureJob->addRequest({nullptr, {}});
+ jobs = renderer.preRenderingJobs();
+
+ // THEN
+ QCOMPARE(jobs.size(),
+ 1 + // PickBoundingVolumeJob
+ 1 + // RayCastingJob
+ 1); // SendBufferCaptureJob
+ // Note: pending render buffer captures are only cleared when the job is run
+
+ // WHEN
+ renderer.m_updatedSetFences.push_back({Qt3DCore::QNodeId(), nullptr});
+ jobs = renderer.preRenderingJobs();
+
+ // THEN
+ QCOMPARE(jobs.size(),
+ 1 + // PickBoundingVolumeJob
+ 1 + // RayCastingJob
+ 1 + // SendBufferCaptureJob
+ 1); // SendSetFenceHandlesJob
+ // Note: pending set fence handles are only cleared when the job is run
+
+ // WHEN
+ renderer.m_updatedTextureProperties.push_back({{}, {}});
+ jobs = renderer.preRenderingJobs();
+
+ // THEN
+ QCOMPARE(jobs.size(),
+ 1 + // PickBoundingVolumeJob
+ 1 + // RayCastingJob
+ 1 + // SendBufferCaptureJob
+ 1 + // SendSetFenceHandlesJob
+ 1); // SendTextureChangesToFrontend
+
+ // Note: pending texture changes are only cleared when the job is run
+
+ // Properly shutdown command thread
+ renderer.shutdown();
+ }
+
void checkRenderBinJobs()
{
// GIVEN
@@ -95,7 +177,6 @@ private Q_SLOTS:
QCOMPARE(jobs.size(),
1 + // updateLevelOfDetailJob
1 + // cleanupJob
- 1 + // sendBufferCaptureJob
1 + // VAOGatherer
1 + // updateSkinningPaletteJob
singleRenderViewJobCount); // Only valid for the first call to renderBinJobs(), since subsequent calls won't have the renderqueue reset
@@ -104,23 +185,6 @@ private Q_SLOTS:
renderQueue->reset();
// WHEN
- renderer.addRenderCaptureSendRequest(Qt3DCore::QNodeId::createId());
- jobs = renderer.renderBinJobs();
-
- // THEN
- QCOMPARE(jobs.size(),
- 1 + // updateLevelOfDetailJob
- 1 + // cleanupJob
- 1 + // sendBufferCaptureJob
- 1 + // sendRenderCaptureJob
- 1 + // VAOGatherer
- 1 + // updateSkinningPaletteJob
- singleRenderViewJobCount);
-
- renderer.clearDirtyBits(Qt3DRender::Render::AbstractRenderer::AllDirty);
- renderQueue->reset();
-
- // WHEN
renderer.markDirty(Qt3DRender::Render::AbstractRenderer::EntityEnabledDirty, nullptr);
jobs = renderer.renderBinJobs();
@@ -128,7 +192,6 @@ private Q_SLOTS:
QCOMPARE(jobs.size(),
1 + // updateLevelOfDetailJob
1 + // cleanupJob
- 1 + // sendBufferCaptureJob
1 + // VAOGatherer
1 + // updateSkinningPaletteJob
1 + // EntityEnabledDirty
@@ -146,7 +209,6 @@ private Q_SLOTS:
QCOMPARE(jobs.size(),
1 + // updateLevelOfDetailJob
1 + // cleanupJob
- 1 + // sendBufferCaptureJob
1 + // VAOGatherer
1 + // WorldTransformJob
1 + // UpdateWorldBoundingVolume
@@ -168,7 +230,6 @@ private Q_SLOTS:
1 + // cleanupJob
1 + // VAOGatherer
1 + // updateSkinningPaletteJob
- 1 + // sendBufferCaptureJob
singleRenderViewJobCount +
renderViewBuilderMaterialCacheJobCount);
@@ -183,7 +244,6 @@ private Q_SLOTS:
QCOMPARE(jobs.size(),
1 + // updateLevelOfDetailJob
1 + // cleanupJob
- 1 + // sendBufferCaptureJob
1 + // VAOGatherer
1 + // CalculateBoundingVolumeJob
1 + // UpdateMeshTriangleListJob
@@ -204,7 +264,6 @@ private Q_SLOTS:
QCOMPARE(jobs.size(),
1 + // updateLevelOfDetailJob
1 + // cleanupJob
- 1 + // sendBufferCaptureJob
1 + // VAOGatherer
1 + // updateSkinningPaletteJob
1 + // CalculateBoundingVolumeJob
@@ -223,7 +282,6 @@ private Q_SLOTS:
QCOMPARE(jobs.size(),
1 + // updateLevelOfDetailJob
1 + // cleanupJob
- 1 + // sendBufferCaptureJob
1 + // VAOGatherer
1 + // TexturesGathererJob
1 + // updateSkinningPaletteJob
@@ -241,7 +299,6 @@ private Q_SLOTS:
1 + // updateLevelOfDetailJob
1 + // cleanupJob
1 + // VAOGatherer
- 1 + // sendBufferCaptureJob
1 + // updateSkinningPaletteJob
singleRenderViewJobCount +
layerCacheJobCount +
@@ -262,7 +319,6 @@ private Q_SLOTS:
1 + // UpdateWorldBoundingVolume
1 + // UpdateShaderDataTransform
1 + // ExpandBoundingVolumeJob
- 1 + // CalculateBoundingVolumeJob
1 + // UpdateEntityLayersJob
1 + // updateLevelOfDetailJob
1 + // updateSkinningPaletteJob
@@ -292,7 +348,6 @@ private Q_SLOTS:
1 + // updateSkinningPaletteJob
1 + // updateLevelOfDetailJob
1 + // cleanupJob
- 1 + // sendBufferCaptureJob
1 + // VAOGatherer
1 + // BufferGathererJob
1 + // TexturesGathererJob
diff --git a/tests/auto/render/setfence/setfence.pro b/tests/auto/render/setfence/setfence.pro
new file mode 100644
index 000000000..5e9793c36
--- /dev/null
+++ b/tests/auto/render/setfence/setfence.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+
+TARGET = tst_setfence
+
+QT += 3dcore 3dcore-private 3drender 3drender-private testlib
+
+CONFIG += testcase
+
+SOURCES += tst_setfence.cpp
+
+include(../../core/common/common.pri)
+include(../commons/commons.pri)
diff --git a/tests/auto/render/setfence/tst_setfence.cpp b/tests/auto/render/setfence/tst_setfence.cpp
new file mode 100644
index 000000000..82cee4b17
--- /dev/null
+++ b/tests/auto/render/setfence/tst_setfence.cpp
@@ -0,0 +1,163 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** 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 <QtTest/QTest>
+#include <Qt3DRender/qsetfence.h>
+#include <Qt3DRender/private/qsetfence_p.h>
+#include <Qt3DRender/private/setfence_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include "qbackendnodetester.h"
+#include "testrenderer.h"
+#include "testpostmanarbiter.h"
+
+class tst_SetFence : public Qt3DCore::QBackendNodeTester
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+
+ void checkInitialState()
+ {
+ // GIVEN
+ Qt3DRender::Render::SetFence backendSetFence;
+
+ // THEN
+ QCOMPARE(backendSetFence.isEnabled(), false);
+ QVERIFY(backendSetFence.peerId().isNull());
+ QCOMPARE(backendSetFence.nodeType(), Qt3DRender::Render::FrameGraphNode::SetFence);
+ }
+
+ void checkInitializeFromPeer()
+ {
+ // GIVEN
+ Qt3DRender::QSetFence setFence;
+
+ {
+ // WHEN
+ Qt3DRender::Render::SetFence backendSetFence;
+ simulateInitialization(&setFence, &backendSetFence);
+
+ // THEN
+ QCOMPARE(backendSetFence.isEnabled(), true);
+ QCOMPARE(backendSetFence.peerId(), setFence.id());
+ }
+ {
+ // WHEN
+ Qt3DRender::Render::SetFence backendSetFence;
+ setFence.setEnabled(false);
+ simulateInitialization(&setFence, &backendSetFence);
+
+ // THEN
+ QCOMPARE(backendSetFence.peerId(), setFence.id());
+ QCOMPARE(backendSetFence.isEnabled(), false);
+ }
+ }
+
+ void checkSceneChangeEvents()
+ {
+ // GIVEN
+ Qt3DRender::Render::SetFence backendSetFence;
+ TestRenderer renderer;
+ backendSetFence.setRenderer(&renderer);
+
+ {
+ // WHEN
+ const bool newValue = false;
+ const auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(Qt3DCore::QNodeId());
+ change->setPropertyName("enabled");
+ change->setValue(newValue);
+ backendSetFence.sceneChangeEvent(change);
+
+ // THEN
+ QCOMPARE(backendSetFence.isEnabled(), newValue);
+ QVERIFY(renderer.dirtyBits() & Qt3DRender::Render::AbstractRenderer::FrameGraphDirty);
+ renderer.clearDirtyBits(Qt3DRender::Render::AbstractRenderer::AllDirty);
+ }
+ }
+
+ void checkSetHandleType()
+ {
+ // GIVEN
+ Qt3DRender::Render::SetFence backendSetFence;
+ TestRenderer renderer;
+ TestArbiter arbiter;
+
+ Qt3DCore::QBackendNodePrivate::get(&backendSetFence)->setArbiter(&arbiter);
+ backendSetFence.setRenderer(&renderer);
+
+ // WHEN
+ backendSetFence.setHandleType(Qt3DRender::QSetFence::OpenGLFenceId);
+
+ // THEN
+ Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(arbiter.events.count(), 1);
+ QCOMPARE(change->propertyName(), "handleType");
+ QCOMPARE(change->value().value<Qt3DRender::QSetFence::HandleType>(), Qt3DRender::QSetFence::OpenGLFenceId);
+
+ arbiter.events.clear();
+ }
+
+ void checkSetHandle()
+ {
+ // GIVEN
+ Qt3DRender::Render::SetFence backendSetFence;
+ TestRenderer renderer;
+ TestArbiter arbiter;
+
+ Qt3DCore::QBackendNodePrivate::get(&backendSetFence)->setArbiter(&arbiter);
+ backendSetFence.setRenderer(&renderer);
+
+ // WHEN
+ backendSetFence.setHandle(QVariant(984));
+
+ // THEN
+ Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(arbiter.events.count(), 1);
+ QCOMPARE(change->propertyName(), "handle");
+ QCOMPARE(change->value(), QVariant(984));
+
+ arbiter.events.clear();
+ }
+};
+
+QTEST_MAIN(tst_SetFence)
+
+#include "tst_setfence.moc"
diff --git a/tests/auto/render/shaderbuilder/tst_shaderbuilder.cpp b/tests/auto/render/shaderbuilder/tst_shaderbuilder.cpp
index 71b42cc09..e365256cc 100644
--- a/tests/auto/render/shaderbuilder/tst_shaderbuilder.cpp
+++ b/tests/auto/render/shaderbuilder/tst_shaderbuilder.cpp
@@ -28,12 +28,15 @@
#include <QtTest/QTest>
#include <qbackendnodetester.h>
+#include <Qt3DCore/private/qbackendnode_p.h>
#include <Qt3DRender/private/shaderbuilder_p.h>
#include <Qt3DRender/qshaderprogram.h>
#include <Qt3DRender/qshaderprogrambuilder.h>
#include "testrenderer.h"
+#include "testpostmanarbiter.h"
Q_DECLARE_METATYPE(Qt3DRender::Render::ShaderBuilder::ShaderType)
+Q_DECLARE_METATYPE(Qt3DRender::QShaderProgram::ShaderType)
class tst_ShaderBuilder : public Qt3DCore::QBackendNodeTester
{
@@ -541,6 +544,82 @@ private slots:
QVERIFY(!backend.isShaderCodeDirty(type));
QCOMPARE(backend.shaderCode(type), es2Code);
}
+
+ void checkCodeUpdatedNotification_data()
+ {
+ QTest::addColumn<Qt3DRender::Render::ShaderBuilder::ShaderType>("type");
+ QTest::addColumn<Qt3DRender::QShaderProgram::ShaderType>("notificationType");
+
+ QTest::newRow("vertex") << Qt3DRender::Render::ShaderBuilder::Vertex << Qt3DRender::QShaderProgram::Vertex;
+ QTest::newRow("tessControl") << Qt3DRender::Render::ShaderBuilder::TessellationControl << Qt3DRender::QShaderProgram::TessellationControl;
+ QTest::newRow("tessEval") << Qt3DRender::Render::ShaderBuilder::TessellationEvaluation << Qt3DRender::QShaderProgram::TessellationEvaluation;
+ QTest::newRow("geometry") << Qt3DRender::Render::ShaderBuilder::Geometry << Qt3DRender::QShaderProgram::Geometry;
+ QTest::newRow("fragment") << Qt3DRender::Render::ShaderBuilder::Fragment << Qt3DRender::QShaderProgram::Fragment;
+ QTest::newRow("compute") << Qt3DRender::Render::ShaderBuilder::Compute << Qt3DRender::QShaderProgram::Compute;
+ }
+
+
+ void checkCodeUpdatedNotification()
+ {
+ // GIVEN
+ QSKIP("Disabled for Qt Base QShaderGenerator Integration");
+
+ Qt3DRender::Render::ShaderBuilder::setPrototypesFile(":/prototypes.json");
+ QVERIFY(!Qt3DRender::Render::ShaderBuilder::getPrototypeNames().isEmpty());
+ QFETCH(Qt3DRender::Render::ShaderBuilder::ShaderType, type);
+ QFETCH(Qt3DRender::QShaderProgram::ShaderType, notificationType);
+
+ const auto gl3Api = []{
+ auto api = Qt3DRender::GraphicsApiFilterData();
+ api.m_api = Qt3DRender::QGraphicsApiFilter::OpenGL;
+ api.m_profile = Qt3DRender::QGraphicsApiFilter::CoreProfile;
+ api.m_major = 3;
+ api.m_minor = 2;
+ return api;
+ }();
+
+ const auto readCode = [](const QString &suffix) -> QString {
+ const auto filePath = QStringLiteral(":/output.") + suffix;
+ QFile file(filePath);
+ if (!file.open(QFile::ReadOnly | QFile::Text))
+ qFatal("File open failed: %s", qPrintable(filePath));
+ return file.readAll();
+ };
+
+ const auto gl3Code = readCode("gl3");
+
+ Qt3DRender::Render::ShaderBuilder backend;
+ TestArbiter arbiter;
+ Qt3DCore::QBackendNodePrivate::get(&backend)->setArbiter(&arbiter);
+
+
+ // WHEN
+ const auto graphUrl = QUrl::fromEncoded("qrc:/input.json");
+ backend.setShaderGraph(type, graphUrl);
+
+ // THEN
+ QCOMPARE(backend.shaderGraph(type), graphUrl);
+ QVERIFY(backend.isShaderCodeDirty(type));
+ QVERIFY(backend.shaderCode(type).isEmpty());
+
+ // WHEN
+ backend.setGraphicsApi(gl3Api);
+ backend.generateCode(type);
+
+ // THEN
+ QCOMPARE(backend.shaderGraph(type), graphUrl);
+ QVERIFY(!backend.isShaderCodeDirty(type));
+ QCOMPARE(backend.shaderCode(type), gl3Code);
+
+ Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(arbiter.events.count(), 1);
+ QCOMPARE(change->propertyName(), "generatedShaderCode");
+ const QPair<int, QByteArray> value = change->value().value<QPair<int, QByteArray>>();
+ QCOMPARE(value.first, int(notificationType));
+ QCOMPARE(value.second, gl3Code);
+
+ arbiter.events.clear();
+ }
};
QTEST_MAIN(tst_ShaderBuilder)
diff --git a/tests/auto/render/texture/tst_texture.cpp b/tests/auto/render/texture/tst_texture.cpp
index d64533732..b0ce782a0 100644
--- a/tests/auto/render/texture/tst_texture.cpp
+++ b/tests/auto/render/texture/tst_texture.cpp
@@ -506,6 +506,19 @@ void tst_RenderTexture::checkPropertyChanges()
backend.unsetDirty();
// WHEN
+ updateChange = QSharedPointer<Qt3DCore::QPropertyUpdatedChange>::create(Qt3DCore::QNodeId());
+ updateChange->setValue(883);
+ updateChange->setPropertyName("textureId");
+ backend.sceneChangeEvent(updateChange);
+
+ // THEN
+ QCOMPARE(backend.sharedTextureId(), 883);
+ QVERIFY(renderer.dirtyBits() & Qt3DRender::Render::AbstractRenderer::TexturesDirty);
+ QVERIFY(backend.dirtyFlags() == Qt3DRender::Render::Texture::DirtySharedTextureId);
+ renderer.clearDirtyBits(Qt3DRender::Render::AbstractRenderer::AllDirty);
+ backend.unsetDirty();
+
+ // WHEN
Qt3DRender::QTextureImage img;
const auto imageAddChange = Qt3DCore::QPropertyNodeAddedChangePtr::create(Qt3DCore::QNodeId(), &img);
imageAddChange->setPropertyName("textureImage");
diff --git a/tests/auto/render/textures/tst_textures.cpp b/tests/auto/render/textures/tst_textures.cpp
index 010ed56a5..41e438d01 100644
--- a/tests/auto/render/textures/tst_textures.cpp
+++ b/tests/auto/render/textures/tst_textures.cpp
@@ -112,6 +112,24 @@ private:
Q_DECLARE_PRIVATE(TestTexture)
};
+class TestSharedGLTexturePrivate : public Qt3DRender::QAbstractTexturePrivate
+{
+};
+
+class TestSharedGLTexture : public Qt3DRender::QAbstractTexture
+{
+public:
+ TestSharedGLTexture(int textureId, Qt3DCore::QNode *p = nullptr)
+ : QAbstractTexture(*new TestSharedGLTexturePrivate(), p)
+ {
+ d_func()->m_sharedTextureId = textureId;
+ }
+
+private:
+ Q_DECLARE_PRIVATE(TestSharedGLTexture)
+};
+
+
/**
* @brief Test QTextureImage
*/
@@ -163,6 +181,11 @@ class tst_RenderTextures : public Qt3DCore::QBackendNodeTester
return tex;
}
+ Qt3DRender::QAbstractTexture *createQTextureWithTextureId(int textureId)
+ {
+ return new TestSharedGLTexture(textureId);
+ }
+
Qt3DRender::Render::Texture *createBackendTexture(Qt3DRender::QAbstractTexture *frontend,
Qt3DRender::Render::TextureManager *texMgr,
Qt3DRender::Render::TextureImageManager *texImgMgr,
@@ -270,6 +293,77 @@ private Q_SLOTS:
renderer.shutdown();
}
+ void shouldCreateDifferentGLTexturesWhenUsingSharedTextureIds()
+ {
+ QScopedPointer<Qt3DRender::Render::NodeManagers> mgrs(new Qt3DRender::Render::NodeManagers());
+ Qt3DRender::Render::Renderer renderer(Qt3DRender::QRenderAspect::Synchronous);
+ renderer.setNodeManagers(mgrs.data());
+
+ // both texture having the same sharedTextureId
+ {
+ // GIVEN
+ Qt3DRender::QAbstractTexture *tex1a = createQTextureWithTextureId(1);
+ Qt3DRender::QAbstractTexture *tex1b = createQTextureWithTextureId(1);
+
+ // WHEN
+ Qt3DRender::Render::Texture *bt1 = createBackendTexture(tex1a,
+ mgrs->textureManager(),
+ mgrs->textureImageManager(),
+ mgrs->textureImageDataManager());
+ Qt3DRender::Render::Texture *bt2 = createBackendTexture(tex1b,
+ mgrs->textureManager(),
+ mgrs->textureImageManager(),
+ mgrs->textureImageDataManager());
+ // THEN
+ QCOMPARE(bt1->sharedTextureId(), 1);
+ QCOMPARE(bt2->sharedTextureId(), 1);
+
+ // WHEN
+ renderer.updateTexture(bt1);
+ renderer.updateTexture(bt2);
+
+ // THEN
+ Qt3DRender::Render::GLTexture *glt1 = mgrs->glTextureManager()->lookupResource(bt1->peerId());
+ Qt3DRender::Render::GLTexture *glt2 = mgrs->glTextureManager()->lookupResource(bt2->peerId());
+ QVERIFY(glt1 != glt2);
+ QCOMPARE(glt1->sharedTextureId(), bt1->sharedTextureId());
+ QCOMPARE(glt2->sharedTextureId(), bt2->sharedTextureId());
+ }
+
+ // textures having a different sharedTextureId
+ {
+ // GIVEN
+ Qt3DRender::QAbstractTexture *tex1a = createQTextureWithTextureId(1);
+ Qt3DRender::QAbstractTexture *tex1b = createQTextureWithTextureId(2);
+
+ // WHEN
+ Qt3DRender::Render::Texture *bt1 = createBackendTexture(tex1a,
+ mgrs->textureManager(),
+ mgrs->textureImageManager(),
+ mgrs->textureImageDataManager());
+ Qt3DRender::Render::Texture *bt2 = createBackendTexture(tex1b,
+ mgrs->textureManager(),
+ mgrs->textureImageManager(),
+ mgrs->textureImageDataManager());
+ // THEN
+ QCOMPARE(bt1->sharedTextureId(), 1);
+ QCOMPARE(bt2->sharedTextureId(), 2);
+
+ // WHEN
+ renderer.updateTexture(bt1);
+ renderer.updateTexture(bt2);
+
+ // THEN
+ Qt3DRender::Render::GLTexture *glt1 = mgrs->glTextureManager()->lookupResource(bt1->peerId());
+ Qt3DRender::Render::GLTexture *glt2 = mgrs->glTextureManager()->lookupResource(bt2->peerId());
+ QVERIFY(glt1 != glt2);
+ QCOMPARE(glt1->sharedTextureId(), bt1->sharedTextureId());
+ QCOMPARE(glt2->sharedTextureId(), bt2->sharedTextureId());
+ }
+
+ renderer.shutdown();
+ }
+
void generatorsShouldCreateSameData()
{
QScopedPointer<Qt3DRender::Render::NodeManagers> mgrs(new Qt3DRender::Render::NodeManagers());
diff --git a/tests/auto/render/trianglesextractor/tst_trianglesextractor.cpp b/tests/auto/render/trianglesextractor/tst_trianglesextractor.cpp
index 2f6d283be..fa1cdd0de 100644
--- a/tests/auto/render/trianglesextractor/tst_trianglesextractor.cpp
+++ b/tests/auto/render/trianglesextractor/tst_trianglesextractor.cpp
@@ -53,8 +53,8 @@ Qt3DRender::QGeometryRenderer *customIndexedGeometryRenderer()
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);
+ auto vertexDataBuffer = new Qt3DRender::QBuffer(customGeometry);
+ auto indexDataBuffer = new Qt3DRender::QBuffer(customGeometry);
// vec3 for position
// vec3 for colors
@@ -196,7 +196,7 @@ Qt3DRender::QGeometryRenderer *customNonIndexedGeometryRenderer()
Qt3DRender::QGeometryRenderer *customMeshRenderer = new Qt3DRender::QGeometryRenderer;
Qt3DRender::QGeometry *customGeometry = new Qt3DRender::QGeometry(customMeshRenderer);
- Qt3DRender::QBuffer *vertexDataBuffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer, customGeometry);
+ auto vertexDataBuffer = new Qt3DRender::QBuffer(customGeometry);
// vec3 for position
// vec3 for colors
diff --git a/tests/auto/render/updateshaderdatatransformjob/tst_updateshaderdatatransformjob.cpp b/tests/auto/render/updateshaderdatatransformjob/tst_updateshaderdatatransformjob.cpp
index 4bab46423..e38d6ba08 100644
--- a/tests/auto/render/updateshaderdatatransformjob/tst_updateshaderdatatransformjob.cpp
+++ b/tests/auto/render/updateshaderdatatransformjob/tst_updateshaderdatatransformjob.cpp
@@ -95,6 +95,7 @@ void runRequiredJobs(Qt3DRender::TestAspect *test)
Qt3DRender::Render::UpdateWorldTransformJob updateWorldTransform;
updateWorldTransform.setRoot(test->sceneRoot());
+ updateWorldTransform.setManagers(test->nodeManagers());
updateWorldTransform.run();
}
diff --git a/tests/auto/render/waitfence/tst_waitfence.cpp b/tests/auto/render/waitfence/tst_waitfence.cpp
new file mode 100644
index 000000000..8141fbb1c
--- /dev/null
+++ b/tests/auto/render/waitfence/tst_waitfence.cpp
@@ -0,0 +1,186 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** 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 <QtTest/QTest>
+#include <Qt3DRender/qwaitfence.h>
+#include <Qt3DRender/private/qwaitfence_p.h>
+#include <Qt3DRender/private/waitfence_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include "qbackendnodetester.h"
+#include "testrenderer.h"
+
+class tst_WaitFence : public Qt3DCore::QBackendNodeTester
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+
+ void checkInitialState()
+ {
+ // GIVEN
+ Qt3DRender::Render::WaitFence backendWaitFence;
+
+ // THEN
+ QCOMPARE(backendWaitFence.isEnabled(), false);
+ QVERIFY(backendWaitFence.peerId().isNull());
+ QCOMPARE(backendWaitFence.nodeType(), Qt3DRender::Render::FrameGraphNode::WaitFence);
+ QCOMPARE(backendWaitFence.data().handleType, Qt3DRender::QWaitFence::NoHandle);
+ QCOMPARE(backendWaitFence.data().handle, QVariant());
+ QCOMPARE(backendWaitFence.data().waitOnCPU, false);
+ QCOMPARE(backendWaitFence.data().timeout, quint64(-1));
+ }
+
+ void checkInitializeFromPeer()
+ {
+ // GIVEN
+ Qt3DRender::QWaitFence waitFence;
+ waitFence.setHandle(QVariant(883));
+ waitFence.setWaitOnCPU(true);
+ waitFence.setTimeout(8);
+ waitFence.setHandleType(Qt3DRender::QWaitFence::OpenGLFenceId);
+
+ {
+ // WHEN
+ Qt3DRender::Render::WaitFence backendWaitFence;
+ simulateInitialization(&waitFence, &backendWaitFence);
+
+ // THEN
+ QCOMPARE(backendWaitFence.isEnabled(), true);
+ QCOMPARE(backendWaitFence.peerId(), waitFence.id());
+ QCOMPARE(backendWaitFence.data().handleType, Qt3DRender::QWaitFence::OpenGLFenceId);
+ QCOMPARE(backendWaitFence.data().handle, QVariant(883));
+ QCOMPARE(backendWaitFence.data().waitOnCPU, true);
+ QCOMPARE(backendWaitFence.data().timeout, quint64(8));
+ }
+ {
+ // WHEN
+ Qt3DRender::Render::WaitFence backendWaitFence;
+ waitFence.setEnabled(false);
+ simulateInitialization(&waitFence, &backendWaitFence);
+
+ // THEN
+ QCOMPARE(backendWaitFence.peerId(), waitFence.id());
+ QCOMPARE(backendWaitFence.isEnabled(), false);
+ QCOMPARE(backendWaitFence.data().handleType, Qt3DRender::QWaitFence::OpenGLFenceId);
+ QCOMPARE(backendWaitFence.data().handle, QVariant(883));
+ QCOMPARE(backendWaitFence.data().waitOnCPU, true);
+ QCOMPARE(backendWaitFence.data().timeout, quint64(8));
+ }
+ }
+
+ void checkSceneChangeEvents()
+ {
+ // GIVEN
+ Qt3DRender::Render::WaitFence backendWaitFence;
+ TestRenderer renderer;
+ backendWaitFence.setRenderer(&renderer);
+
+ {
+ // WHEN
+ const bool newValue = false;
+ const auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(Qt3DCore::QNodeId());
+ change->setPropertyName("enabled");
+ change->setValue(newValue);
+ backendWaitFence.sceneChangeEvent(change);
+
+ // THEN
+ QCOMPARE(backendWaitFence.isEnabled(), newValue);
+ QVERIFY(renderer.dirtyBits() & Qt3DRender::Render::AbstractRenderer::FrameGraphDirty);
+ renderer.clearDirtyBits(Qt3DRender::Render::AbstractRenderer::AllDirty);
+ }
+ {
+ // WHEN
+ const QVariant newValue(984);
+ const auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(Qt3DCore::QNodeId());
+ change->setPropertyName("handle");
+ change->setValue(QVariant::fromValue(newValue));
+ backendWaitFence.sceneChangeEvent(change);
+
+ // THEN
+ QCOMPARE(backendWaitFence.data().handle, QVariant(984));
+ QVERIFY(renderer.dirtyBits() & Qt3DRender::Render::AbstractRenderer::FrameGraphDirty);
+ renderer.clearDirtyBits(Qt3DRender::Render::AbstractRenderer::AllDirty);
+ }
+ {
+ // WHEN
+ const Qt3DRender::QWaitFence::HandleType newValue = Qt3DRender::QWaitFence::OpenGLFenceId;
+ const auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(Qt3DCore::QNodeId());
+ change->setPropertyName("handleType");
+ change->setValue(QVariant::fromValue(newValue));
+ backendWaitFence.sceneChangeEvent(change);
+
+ // THEN
+ QCOMPARE(backendWaitFence.data().handleType, Qt3DRender::QWaitFence::OpenGLFenceId);
+ QVERIFY(renderer.dirtyBits() & Qt3DRender::Render::AbstractRenderer::FrameGraphDirty);
+ renderer.clearDirtyBits(Qt3DRender::Render::AbstractRenderer::AllDirty);
+ }
+ {
+ // WHEN
+ const bool newValue = true;
+ const auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(Qt3DCore::QNodeId());
+ change->setPropertyName("waitOnCPU");
+ change->setValue(QVariant::fromValue(newValue));
+ backendWaitFence.sceneChangeEvent(change);
+
+ // THEN
+ QCOMPARE(backendWaitFence.data().waitOnCPU, true);
+ QVERIFY(renderer.dirtyBits() & Qt3DRender::Render::AbstractRenderer::FrameGraphDirty);
+ renderer.clearDirtyBits(Qt3DRender::Render::AbstractRenderer::AllDirty);
+ }
+ {
+ // WHEN
+ const quint64 newValue = 984;
+ const auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(Qt3DCore::QNodeId());
+ change->setPropertyName("timeout");
+ change->setValue(QVariant::fromValue(newValue));
+ backendWaitFence.sceneChangeEvent(change);
+
+ // THEN
+ QCOMPARE(backendWaitFence.data().timeout, quint64(984));
+ QVERIFY(renderer.dirtyBits() & Qt3DRender::Render::AbstractRenderer::FrameGraphDirty);
+ renderer.clearDirtyBits(Qt3DRender::Render::AbstractRenderer::AllDirty);
+ }
+ }
+};
+
+QTEST_MAIN(tst_WaitFence)
+
+#include "tst_waitfence.moc"
diff --git a/tests/auto/render/waitfence/waitfence.pro b/tests/auto/render/waitfence/waitfence.pro
new file mode 100644
index 000000000..cb8f71272
--- /dev/null
+++ b/tests/auto/render/waitfence/waitfence.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+
+TARGET = tst_waitfence
+
+QT += 3dcore 3dcore-private 3drender 3drender-private testlib
+
+CONFIG += testcase
+
+SOURCES += tst_waitfence.cpp
+
+include(../../core/common/common.pri)
+include(../commons/commons.pri)
diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro
index 5b197ff47..8554d4aba 100644
--- a/tests/manual/manual.pro
+++ b/tests/manual/manual.pro
@@ -64,6 +64,12 @@ SUBDIRS += \
qtbug-72236 \
qtbug-76766
+qtHaveModule(multimedia): {
+ SUBDIRS += \
+ sharedtexture \
+ sharedtextureqml
+}
+
qtHaveModule(widgets): {
SUBDIRS += \
assimp-cpp \
diff --git a/tests/manual/sharedtexture/main.cpp b/tests/manual/sharedtexture/main.cpp
new file mode 100644
index 000000000..a85f90ee6
--- /dev/null
+++ b/tests/manual/sharedtexture/main.cpp
@@ -0,0 +1,159 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Klaralvdalens 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 <QApplication>
+#include <QPropertyAnimation>
+
+#include <Qt3DCore/QEntity>
+#include <Qt3DCore/QTransform>
+#include <Qt3DCore/QAspectEngine>
+
+#include <Qt3DRender/QCamera>
+#include <Qt3DRender/QCameraLens>
+#include <Qt3DRender/QRenderAspect>
+#include <Qt3DRender/QTexture>
+#include <Qt3DRender/QDirectionalLight>
+
+#include <Qt3DInput/QInputAspect>
+
+#include <Qt3DExtras/QForwardRenderer>
+#include <Qt3DExtras/QDiffuseMapMaterial>
+#include <Qt3DExtras/QCuboidMesh>
+#include <Qt3DExtras/QOrbitCameraController>
+#include <Qt3DExtras/Qt3DWindow>
+
+#include "videoplayer.h"
+
+Qt3DCore::QEntity *createScene(Qt3DExtras::Qt3DWindow *view, Qt3DRender::QAbstractTexture *diffuseTexture)
+{
+ // Root entity
+ Qt3DCore::QEntity *rootEntity = new Qt3DCore::QEntity;
+
+ // Material
+ Qt3DExtras::QDiffuseMapMaterial *material = new Qt3DExtras::QDiffuseMapMaterial(rootEntity);
+ material->setDiffuse(diffuseTexture);
+ material->setAmbient(QColor(30, 30, 30));
+
+ // Sphere
+ Qt3DCore::QEntity *sphereEntity = new Qt3DCore::QEntity(rootEntity);
+ Qt3DExtras::QCuboidMesh *cuboidMesh = new Qt3DExtras::QCuboidMesh;
+ Qt3DCore::QTransform *transform = new Qt3DCore::QTransform;
+
+ transform->setRotationX(180);
+
+ QPropertyAnimation *cubeRotateTransformAnimation = new QPropertyAnimation(transform);
+ cubeRotateTransformAnimation->setTargetObject(transform);
+ cubeRotateTransformAnimation->setPropertyName("rotationY");
+ cubeRotateTransformAnimation->setStartValue(QVariant::fromValue(0));
+ cubeRotateTransformAnimation->setEndValue(QVariant::fromValue(360));
+ cubeRotateTransformAnimation->setDuration(10000);
+ cubeRotateTransformAnimation->setLoopCount(-1);
+ cubeRotateTransformAnimation->start();
+
+ sphereEntity->addComponent(cuboidMesh);
+ sphereEntity->addComponent(transform);
+ sphereEntity->addComponent(material);
+
+ // Camera
+ Qt3DRender::QCamera *camera = view->camera();
+ camera->lens()->setPerspectiveProjection(45.0f, 16.0f/9.0f, 0.1f, 1000.0f);
+ camera->setPosition(QVector3D(0, 0, -5.0f));
+ camera->setViewCenter(QVector3D(0, 0, 0));
+
+ // For camera controls
+ Qt3DExtras::QOrbitCameraController *camController = new Qt3DExtras::QOrbitCameraController(rootEntity);
+ camController->setLinearSpeed( 50.0f );
+ camController->setLookSpeed( 180.0f );
+ camController->setCamera(camera);
+
+ Qt3DRender::QDirectionalLight *light = new Qt3DRender::QDirectionalLight();
+ light->setIntensity(0.8f);
+ light->setWorldDirection(camera->viewVector());
+ rootEntity->addComponent(light);
+
+ return rootEntity;
+}
+
+int main(int argc, char* argv[])
+{
+ QSurfaceFormat format = QSurfaceFormat::defaultFormat();
+ format.setMajorVersion(4);
+ format.setMinorVersion(5);
+ format.setProfile(QSurfaceFormat::CoreProfile);
+ format.setRenderableType(QSurfaceFormat::OpenGL);
+ QSurfaceFormat::setDefaultFormat(format);
+
+ // Will make Qt3D and QOpenGLWidget share a common context
+ QApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
+
+ QApplication app(argc, argv);
+
+ // Multimedia player
+ TextureWidget textureWidget;
+ VideoPlayerThread *videoPlayer = new VideoPlayerThread(&textureWidget);
+ videoPlayer->start();
+
+ textureWidget.resize(800, 600);
+ textureWidget.show();
+
+ // Texture object that Qt3D uses to access the texture from the video player
+ Qt3DRender::QSharedGLTexture *sharedTexture = new Qt3DRender::QSharedGLTexture();
+
+ QObject::connect(&textureWidget, &TextureWidget::textureIdChanged,
+ sharedTexture, &Qt3DRender::QSharedGLTexture::setTextureId);
+
+ // Qt3D Scene
+ Qt3DExtras::Qt3DWindow view;
+ Qt3DCore::QEntity *scene = createScene(&view, sharedTexture);
+ view.setRootEntity(scene);
+ view.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/sharedtexture/sharedtexture.pro b/tests/manual/sharedtexture/sharedtexture.pro
new file mode 100644
index 000000000..b41f43d71
--- /dev/null
+++ b/tests/manual/sharedtexture/sharedtexture.pro
@@ -0,0 +1,12 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += widgets 3dcore 3drender 3dinput 3dextras multimedia
+
+SOURCES += \
+ videoplayer.cpp \
+ main.cpp
+
+HEADERS += \
+ videoplayer.h
diff --git a/tests/manual/sharedtexture/videoplayer.cpp b/tests/manual/sharedtexture/videoplayer.cpp
new file mode 100644
index 000000000..f970116b5
--- /dev/null
+++ b/tests/manual/sharedtexture/videoplayer.cpp
@@ -0,0 +1,233 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Klaralvdalens 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 <QMutexLocker>
+#include <QtMultimedia/QVideoFrame>
+
+#include "videoplayer.h"
+
+TextureWidget::TextureWidget(QWidget *parent)
+ : QOpenGLWidget(parent)
+ , m_texture(QOpenGLTexture::Target2D)
+{
+ // Lock mutex so that we never process a frame until we have been initialized
+ m_mutex.lock();
+}
+
+// Main thread
+void TextureWidget::initializeGL()
+{
+ initializeOpenGLFunctions();
+ glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
+
+ if (!m_shader.addShaderFromSourceCode(QOpenGLShader::Vertex,
+ "#version 330\n"
+ "out vec2 coords;\n"
+ "const vec2 positions[6] = vec2[] ("
+ " vec2(-1.0, 1.0),"
+ " vec2(-1.0, -1.0),"
+ " vec2(1.0, 1.0),"
+ " vec2(1.0, 1.0),"
+ " vec2(-1.0, -1.0),"
+ " vec2(1.0, -1.0));\n"
+ "const vec2 texCoords[6] = vec2[] ("
+ " vec2(0.0, 0.0),"
+ " vec2(0.0, 1.0),"
+ " vec2(1.0, 0.0),"
+ " vec2(1.0, 0.0),"
+ " vec2(0.0, 1.0),"
+ " vec2(1.0, 1.0));\n"
+ "void main() {\n"
+ " coords = texCoords[gl_VertexID];\n"
+ " gl_Position = vec4(positions[gl_VertexID], 0.0, 1.0);\n"
+ "}"))
+ qDebug() << "Failed to load vertex shader" << m_shader.log();
+ if (!m_shader.addShaderFromSourceCode(QOpenGLShader::Fragment,
+ "#version 330\n"
+ "in vec2 coords;\n"
+ "uniform sampler2D video_texture;\n"
+ "out vec4 fragColor;\n"
+ "void main() {\n"
+ " fragColor = texture(video_texture, coords);\n"
+ "}"))
+ qDebug() << "Failed to load fragment shader" << m_shader.log();
+ if (!m_shader.link())
+ qDebug() << "Failed to link shaders" << m_shader.log();
+
+ qDebug() << Q_FUNC_INFO << context()->shareContext();
+
+ m_vao.create();
+ // Allow rendering/frame acquisition to go on
+ m_mutex.unlock();
+}
+
+// Main thread
+void TextureWidget::paintGL()
+{
+ QMutexLocker lock(&m_mutex);
+ glViewport(0, 0, width(), height());
+
+ glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
+
+ if (!m_texture.isCreated())
+ return;
+
+ m_shader.bind();
+
+ m_texture.bind(0);
+ m_shader.setUniformValue("video_texture", 0);
+
+ m_vao.bind();
+ glDrawArrays(GL_TRIANGLES, 0, 6);
+
+ m_vao.release();
+ m_shader.release();
+}
+
+// Video Player thread
+void TextureWidget::setVideoFrame(const QVideoFrame &frame)
+{
+ // Ensure we won't be rendering while we are processing the frame
+ QMutexLocker lock(&m_mutex);
+
+ QVideoFrame f = frame;
+
+ // Map frame
+ if (!f.map(QAbstractVideoBuffer::ReadOnly))
+ return;
+
+ makeCurrent();
+
+ // Create or recreate texture
+ if (m_texture.width() != f.width() || m_texture.height() != f.height()) {
+ if (m_texture.isCreated())
+ m_texture.destroy();
+
+ m_texture.setSize(f.width(), f.height());
+ m_texture.setFormat(QOpenGLTexture::RGBA32F);
+ m_texture.setWrapMode(QOpenGLTexture::ClampToBorder);
+ m_texture.setMinificationFilter(QOpenGLTexture::Nearest);
+ m_texture.setMagnificationFilter(QOpenGLTexture::Nearest);
+ m_texture.allocateStorage();
+
+ m_texture.create();
+ emit textureIdChanged(m_texture.textureId());
+ }
+
+ const QVideoFrame::PixelFormat pFormat = f.pixelFormat();
+ if (pFormat == QVideoFrame::Format_RGB32) {
+ m_texture.setData(QOpenGLTexture::RGBA, QOpenGLTexture::UInt8, f.bits());
+ }
+
+ doneCurrent();
+
+ // Request display udpate
+ QOpenGLWidget::update();
+
+ // Unmap
+ f.unmap();
+}
+
+QList<QVideoFrame::PixelFormat> GLVideoSurface::supportedPixelFormats(QAbstractVideoBuffer::HandleType type) const
+{
+ if (type == QAbstractVideoBuffer::NoHandle)
+ return {
+ QVideoFrame::Format_RGB32,
+ QVideoFrame::Format_ARGB32,
+ QVideoFrame::Format_BGR32,
+ QVideoFrame::Format_BGRA32
+ };
+ return {};
+}
+
+// Video player thread
+bool GLVideoSurface::present(const QVideoFrame &frame)
+{
+ emit onNewFrame(frame);
+ return true;
+}
+
+VideoPlayerThread::VideoPlayerThread(TextureWidget *textureWidget)
+ : QThread(textureWidget)
+ , m_player(new QMediaPlayer(nullptr, QMediaPlayer::VideoSurface))
+ , m_surface(new GLVideoSurface())
+{
+ m_player->moveToThread(this);
+ m_player->setMedia(QUrl("https://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4"));
+
+ // Tell player to render on GLVideoSurface
+ m_surface->moveToThread(this);
+ m_player->setVideoOutput(m_surface.get());
+
+ // Display errors
+ QObject::connect(m_player.get(), QOverload<QMediaPlayer::Error>::of(&QMediaPlayer::error),
+ m_player.get(), [this] (QMediaPlayer::Error e) {
+ qDebug() << Q_FUNC_INFO << e << m_player->errorString();
+ });
+
+ // Repeat video indefinitely
+ QObject::connect(m_player.get(), &QMediaPlayer::stateChanged, m_player.get(), [this] (QMediaPlayer::State state) {
+ if (state == QMediaPlayer::StoppedState)
+ m_player->play();
+ });
+
+ // Start playing when thread starts
+ QObject::connect(this, &QThread::started, this, [this] { m_player->play(); });
+
+ // Direct connection between 2 objects living in different threads
+ QObject::connect(m_surface.get(), &GLVideoSurface::onNewFrame,
+ textureWidget, &TextureWidget::setVideoFrame, Qt::DirectConnection);
+}
+
+VideoPlayerThread::~VideoPlayerThread()
+{
+ exit(0);
+ wait();
+}
diff --git a/tests/manual/sharedtexture/videoplayer.h b/tests/manual/sharedtexture/videoplayer.h
new file mode 100644
index 000000000..377ea57fe
--- /dev/null
+++ b/tests/manual/sharedtexture/videoplayer.h
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Klaralvdalens 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 <QThread>
+#include <QMutex>
+
+#include <QOpenGLWidget>
+#include <QOpenGLFunctions>
+#include <QOpenGLVertexArrayObject>
+#include <QOpenGLBuffer>
+#include <QOpenGLTexture>
+#include <QOpenGLShaderProgram>
+
+#include <QtMultimedia/QAbstractVideoSurface>
+#include <QtMultimedia/QMediaPlayer>
+
+#include <memory>
+
+class TextureWidget : public QOpenGLWidget, private QOpenGLFunctions
+{
+ Q_OBJECT
+ Q_PROPERTY(int textureId READ textureId NOTIFY textureIdChanged)
+public:
+ TextureWidget(QWidget *parent = nullptr);
+
+ int textureId() { return m_texture.textureId(); }
+
+private:
+ // MainThread
+ void initializeGL() override;
+
+ // Main thread
+ void paintGL() override;
+
+public Q_SLOTS:
+ // Called from Video player thread
+ void setVideoFrame(const QVideoFrame &frame);
+
+Q_SIGNALS:
+ void textureIdChanged(int textureId);
+
+private:
+ QOpenGLVertexArrayObject m_vao;
+ QOpenGLShaderProgram m_shader;
+ QOpenGLTexture m_texture;
+ QMutex m_mutex;
+};
+
+
+class GLVideoSurface : public QAbstractVideoSurface
+{
+ Q_OBJECT
+public:
+ QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType type) const override;
+
+ // Call in VideaPlayerThread context
+ bool present(const QVideoFrame &frame) override;
+
+Q_SIGNALS:
+ void onNewFrame(const QVideoFrame &frame);
+};
+
+
+class VideoPlayerThread : public QThread
+{
+ Q_OBJECT
+public:
+ VideoPlayerThread(TextureWidget *textureWidget);
+ ~VideoPlayerThread();
+
+private:
+ TextureWidget *m_textureWidget;
+ std::unique_ptr<QMediaPlayer> m_player;
+ std::unique_ptr<GLVideoSurface> m_surface;
+};
diff --git a/tests/manual/sharedtextureqml/main.cpp b/tests/manual/sharedtextureqml/main.cpp
new file mode 100644
index 000000000..5c7ae9cff
--- /dev/null
+++ b/tests/manual/sharedtextureqml/main.cpp
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Klaralvdalens 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 <QApplication>
+#include <QtQml/QQmlContext>
+#include <QtQuick/QQuickView>
+#include <Qt3DRender/QAbstractTexture>
+#include <QWindow>
+#include <QTimer>
+
+#include <QQuickView>
+#include "videoplayer.h"
+
+
+template<typename Obj>
+QHash<int, QString> enumToNameMap(const char *enumName)
+{
+ const QMetaObject metaObj = Obj::staticMetaObject;
+ const int indexOfEnum = metaObj.indexOfEnumerator(enumName);
+ const QMetaEnum metaEnum = metaObj.enumerator(indexOfEnum);
+ const int keysCount = metaEnum.keyCount();
+
+ QHash<int, QString> v;
+ v.reserve(keysCount);
+ for (int i = 0; i < keysCount; ++i)
+ v[metaEnum.value(i)] = metaEnum.key(i);
+ return v;
+}
+
+
+class EnumNameMapper : public QObject
+{
+ Q_OBJECT
+
+public:
+ Q_INVOKABLE QString statusName(int v) const { return m_statusMap.value(v); }
+ Q_INVOKABLE QString formatName(int v) const { return m_formatMap.value(v); }
+ Q_INVOKABLE QString targetName(int v) const { return m_targetMap.value(v); }
+
+private:
+ const QHash<int, QString> m_statusMap = enumToNameMap<Qt3DRender::QAbstractTexture>("Status");
+ const QHash<int, QString> m_formatMap = enumToNameMap<Qt3DRender::QAbstractTexture>("TextureFormat");
+ const QHash<int, QString> m_targetMap = enumToNameMap<Qt3DRender::QAbstractTexture>("Target");
+};
+
+int main(int argc, char* argv[])
+{
+ QSurfaceFormat format = QSurfaceFormat::defaultFormat();
+ format.setMajorVersion(4);
+ format.setMinorVersion(5);
+ format.setDepthBufferSize(16);
+ format.setStencilBufferSize(8);
+ format.setProfile(QSurfaceFormat::CoreProfile);
+ format.setRenderableType(QSurfaceFormat::OpenGL);
+ QSurfaceFormat::setDefaultFormat(format);
+
+
+ // Make the OpenGLWidget's shared context be qt_gl_global_share_context
+ QApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
+ QApplication app(argc, argv);
+
+ // Multimedia player
+ TextureWidget textureWidget;
+ VideoPlayerThread *videoPlayer = new VideoPlayerThread(&textureWidget);
+ videoPlayer->start();
+
+ textureWidget.resize(800, 600);
+ textureWidget.show();
+
+ // Qt3D QtQuick Scene (uses qt_global_share_context by default)
+ QQuickView view;
+ QQmlContext *ctx = view.rootContext();
+ EnumNameMapper mapper;
+ ctx->setContextProperty(QStringLiteral("_nameMapper"), &mapper);
+ ctx->setContextProperty(QStringLiteral("_textureWidget"), &textureWidget);
+
+ view.resize(800, 600);
+ view.setSource(QUrl("qrc:/main.qml"));
+ view.show();
+
+ return app.exec();
+}
+
+#include "main.moc"
diff --git a/tests/manual/sharedtextureqml/main.qml b/tests/manual/sharedtextureqml/main.qml
new file mode 100644
index 000000000..fd529e51c
--- /dev/null
+++ b/tests/manual/sharedtextureqml/main.qml
@@ -0,0 +1,144 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Klaralvdalens 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.10
+import QtQuick.Scene3D 2.0
+import Qt3D.Core 2.10
+import Qt3D.Render 2.13
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
+
+Item {
+ width: 800
+ height: 600
+
+ Scene3D {
+ anchors.fill: parent
+
+ 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, -4.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 { },
+ DirectionalLight {
+ intensity: 0.8
+ worldDirection: camera.viewVector
+ }
+ ]
+
+
+ NumberAnimation {
+ target: cubeTransform
+ property: "rotationY"
+ duration: 10000
+ from: 0
+ to: 360
+
+ loops: Animation.Infinite
+ running: true
+ }
+
+ SharedGLTexture {
+ id: shaderGLTexture
+ textureId: _textureWidget.textureId
+ }
+
+ Entity {
+ id: cubeEntity
+ readonly property CuboidMesh cuboid: CuboidMesh {}
+ readonly property DiffuseMapMaterial material: DiffuseMapMaterial {
+ diffuse: shaderGLTexture
+ }
+ Transform {
+ id: cubeTransform
+ rotationX: 180
+ }
+
+ components: [ cuboid, material, cubeTransform ]
+ }
+ }
+ }
+
+ Grid {
+ spacing: 10
+ columns: 2
+ Text { text: "Target: " + _nameMapper.targetName(shaderGLTexture.target) }
+ Text { text: "Format: " + _nameMapper.formatName(shaderGLTexture.format) }
+ Text { text: "Width: " + shaderGLTexture.width }
+ Text { text: "Height: " + shaderGLTexture.height }
+ Text { text: "Depth: " + shaderGLTexture.depth }
+ Text { text: "Layers: " + shaderGLTexture.layers }
+ Text { text: "GL Texture Id: " + shaderGLTexture.textureId }
+ }
+
+}
diff --git a/tests/manual/sharedtextureqml/qml.qrc b/tests/manual/sharedtextureqml/qml.qrc
new file mode 100644
index 000000000..5f6483ac3
--- /dev/null
+++ b/tests/manual/sharedtextureqml/qml.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ </qresource>
+</RCC>
diff --git a/tests/manual/sharedtextureqml/sharedtextureqml.pro b/tests/manual/sharedtextureqml/sharedtextureqml.pro
new file mode 100644
index 000000000..066bb8446
--- /dev/null
+++ b/tests/manual/sharedtextureqml/sharedtextureqml.pro
@@ -0,0 +1,17 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += widgets gui-private 3dcore 3drender 3dinput 3dextras multimedia quick 3dquickextras
+
+SOURCES += \
+ main.cpp \
+ ../sharedtexture/videoplayer.cpp
+
+HEADERS += \
+ ../sharedtexture/videoplayer.h
+
+INCLUDEPATH += ../sharedtexture
+
+RESOURCES += \
+ qml.qrc
diff --git a/tests/manual/texture_property_updates/main.cpp b/tests/manual/texture_property_updates/main.cpp
index e145b0a26..725c6ccc1 100644
--- a/tests/manual/texture_property_updates/main.cpp
+++ b/tests/manual/texture_property_updates/main.cpp
@@ -77,11 +77,13 @@ public:
Q_INVOKABLE QString statusName(int v) const { return m_statusMap.value(v); }
Q_INVOKABLE QString formatName(int v) const { return m_formatMap.value(v); }
Q_INVOKABLE QString targetName(int v) const { return m_targetMap.value(v); }
+ Q_INVOKABLE QString handleTypeName(int v) const { return m_handleTypeMap.value(v); }
private:
const QHash<int, QString> m_statusMap = enumToNameMap<Qt3DRender::QAbstractTexture>("Status");
const QHash<int, QString> m_formatMap = enumToNameMap<Qt3DRender::QAbstractTexture>("TextureFormat");
const QHash<int, QString> m_targetMap = enumToNameMap<Qt3DRender::QAbstractTexture>("Target");
+ const QHash<int, QString> m_handleTypeMap = enumToNameMap<Qt3DRender::QAbstractTexture>("HandleType");
};
int main(int argc, char* argv[])
diff --git a/tests/manual/texture_property_updates/main.qml b/tests/manual/texture_property_updates/main.qml
index f1256c75b..7794dab55 100644
--- a/tests/manual/texture_property_updates/main.qml
+++ b/tests/manual/texture_property_updates/main.qml
@@ -51,7 +51,7 @@
import QtQuick 2.2 as QQ2
import QtQuick.Scene3D 2.0
import Qt3D.Core 2.0
-import Qt3D.Render 2.0
+import Qt3D.Render 2.12
import Qt3D.Input 2.0
import Qt3D.Extras 2.0
@@ -184,6 +184,8 @@ QQ2.Item {
QQ2.Text { text: "Depth: " + model.modelData.depth}
QQ2.Text { text: "Layers: " + model.modelData.layers}
QQ2.Text { text: "Status: " + nameMapper.statusName(model.modelData.status.toString()) }
+ QQ2.Text { text: "HandleType: " + nameMapper.handleTypeName(model.modelData.handleType) }
+ QQ2.Text { text: "Handle: " + model.modelData.handle }
}
}
}