From d055098540df99a5d426360e9322c659e678e5ee Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Wed, 27 Nov 2019 15:37:07 +0100 Subject: Enable mercator-to-screen projection in GLSL With this change, all the geo-to-screen conversion, and the triangulation operations for geo polylines and geo polygon are performed either at set time or in the shader. A separate bounding box geometry is processed in the old way to provide a correct QtQuick Item geometry, that can be used for nesting mouse areas, performing translations, input event delivery, etc. With this approach, performance are improved by more than one order of magnitude in average, but complex geometries will of course benefit more. It also adds correct rendering support for polygons with holes, previously only rendered correctly by the MapboxGL plugin. The polyline shader has basic miter joins. The miter is skipped if the angle is too sharp to avoid complicating the implementation. This shader introduces some glitches when the polyline is minified, for which the real fix is to have LOD for the geometry, and render simplified geometries at low zoom levels (added in a subsequent patch). Note: this approach, at least in its current implementation, does not support enabling layers on individual items, only on the Map element. Task-number: QTBUG-49303 Task-number: QTBUG-38459 Change-Id: I0c2dc0bf364d32f74ca7c4014f6d66e6219c8ae4 Reviewed-by: Alexandru Croitor --- src/location/labs/qsg/qmappolygonobjectqsg_p_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/location/labs/qsg/qmappolygonobjectqsg_p_p.h') diff --git a/src/location/labs/qsg/qmappolygonobjectqsg_p_p.h b/src/location/labs/qsg/qmappolygonobjectqsg_p_p.h index 0f42a92e..8e6ae8a8 100644 --- a/src/location/labs/qsg/qmappolygonobjectqsg_p_p.h +++ b/src/location/labs/qsg/qmappolygonobjectqsg_p_p.h @@ -52,7 +52,7 @@ #include #include #include -#include +#include #include QT_BEGIN_NAMESPACE -- cgit v1.2.1 From a4469cad4041f21e640efa9ca5d0b192dd702955 Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Fri, 27 Dec 2019 22:39:47 +0100 Subject: Port Map*ObjectPrivateQSG to the shader-based projection geometries This patch changes the implementation of the scenegraph-based mapobjects (those created by QGeoTiledMap) to be the recently introduced one sporting shader-based map projection. This is much faster than the previous, but may introduce small glitches at this time (mostly on minified polylines). Adding polyline LOD simplification will solve this problem. Compared to equivalent Map Items (that is, Map Items backed by the same underlying implementation), map objects now are approximately 1.5x faster. This measure has been gathered using medium-size polygons (contained in the file 10_countries.json from the geojson_viewer example). The difference is caused by the additional QtQuick geometry related operations (essentially projecting the bounding box for each item) present in MapItems. Smaller polygons may therefore yield larger improvements, larger polygons the opposite. Change-Id: I3fc92b02b74a3a4d001e69755949a98f80d8a3d3 Reviewed-by: Alex Blasche --- src/location/labs/qsg/qmappolygonobjectqsg_p_p.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/location/labs/qsg/qmappolygonobjectqsg_p_p.h') diff --git a/src/location/labs/qsg/qmappolygonobjectqsg_p_p.h b/src/location/labs/qsg/qmappolygonobjectqsg_p_p.h index 8e6ae8a8..9dcece74 100644 --- a/src/location/labs/qsg/qmappolygonobjectqsg_p_p.h +++ b/src/location/labs/qsg/qmappolygonobjectqsg_p_p.h @@ -67,6 +67,7 @@ public: QList projectPath(); // QQSGMapObject + void markSourceDirty(); void updateGeometry() override; QSGNode *updateMapObjectNode(QSGNode *oldNode, VisibleNode **visibleNode, @@ -84,10 +85,12 @@ public: virtual void setGeoShape(const QGeoShape &shape) override; // Data Members - QGeoMapPolygonGeometry m_geometry; - QGeoMapPolylineGeometry m_borderGeometry; - - bool m_updatingGeometry = false; + QDoubleVector2D m_leftBoundMercator; + QGeoMapPolygonGeometryOpenGL m_geometry; + QGeoMapPolylineGeometryOpenGL m_borderGeometry; + QDeclarativePolygonMapItemPrivateOpenGL::RootNode *m_rootNode = nullptr; + MapPolygonNodeGL *m_node = nullptr; + MapPolylineNodeOpenGLExtruded *m_polylinenode = nullptr; }; QT_END_NAMESPACE -- cgit v1.2.1