From 76d775dce392ff6059c32999549dbe381d79b99e Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 14 Nov 2022 13:34:12 +0100 Subject: Simplify by removing the LineStrip mode for MapPolyline Have two modes (Software, OpenGL) for polyline, as it is the case for all other items (rectangle, circle, polygon). OpenGLLineStrip is removed completely, whereas the enum value OpenGL is added with the same value as OpenGLExtruded for symmetry with other items. Drawing lines and expecting wide line (width > 1) support to be avilable is highly non-portable: Direct 3D, Metal, and core profile OpenGL contexts will not support widths other than 1, whereas with Vulkan wide lines are an optional feature so it may or may not work. As the 'backend' property is already marked as internal, it won't present any consequences when it comes to the public API. Internally this requires some untangling of the somewhat intertwined node and material implementations. Change-Id: I175ddb5f84128ed4d0fcf2939272e631566ff327 Reviewed-by: Qt CI Bot Reviewed-by: Volker Hilsheimer --- src/location/CMakeLists.txt | 6 +- .../quickmapitems/qdeclarativepolylinemapitem.cpp | 13 +- .../quickmapitems/qdeclarativepolylinemapitem_p.h | 8 +- .../rhi/qdeclarativecirclemapitem_rhi.cpp | 2 +- .../rhi/qdeclarativecirclemapitem_rhi_p.h | 2 +- .../rhi/qdeclarativepolygonmapitem_rhi.cpp | 2 +- .../rhi/qdeclarativepolygonmapitem_rhi_p.h | 2 +- .../rhi/qdeclarativepolylinemapitem_rhi.cpp | 238 +++------------------ .../rhi/qdeclarativepolylinemapitem_rhi_p.h | 93 ++------ .../rhi/qdeclarativerectanglemapitem_rhi.cpp | 2 +- .../rhi/qdeclarativerectanglemapitem_rhi_p.h | 2 +- .../quickmapitems/rhi/qgeomapitemgeometry_rhi_p.h | 2 - .../quickmapitems/rhi/shaders/polyline.frag | 20 ++ .../quickmapitems/rhi/shaders/polyline.vert | 104 +++++++++ .../rhi/shaders/polyline_extruded.frag | 20 -- .../rhi/shaders/polyline_extruded.vert | 104 --------- .../rhi/shaders/polyline_linestrip.frag | 17 -- .../rhi/shaders/polyline_linestrip.vert | 21 -- tests/manual/mappolyline_tester/main.qml | 10 +- 19 files changed, 197 insertions(+), 471 deletions(-) create mode 100644 src/location/quickmapitems/rhi/shaders/polyline.frag create mode 100644 src/location/quickmapitems/rhi/shaders/polyline.vert delete mode 100644 src/location/quickmapitems/rhi/shaders/polyline_extruded.frag delete mode 100644 src/location/quickmapitems/rhi/shaders/polyline_extruded.vert delete mode 100644 src/location/quickmapitems/rhi/shaders/polyline_linestrip.frag delete mode 100644 src/location/quickmapitems/rhi/shaders/polyline_linestrip.vert diff --git a/src/location/CMakeLists.txt b/src/location/CMakeLists.txt index a05a17ec..9e3aad36 100644 --- a/src/location/CMakeLists.txt +++ b/src/location/CMakeLists.txt @@ -188,10 +188,8 @@ qt_internal_add_shaders(Location "declarative_location_shaders" PREFIX "/location" FILES - "quickmapitems/rhi/shaders/polyline_linestrip.vert" - "quickmapitems/rhi/shaders/polyline_linestrip.frag" - "quickmapitems/rhi/shaders/polyline_extruded.vert" - "quickmapitems/rhi/shaders/polyline_extruded.frag" + "quickmapitems/rhi/shaders/polyline.vert" + "quickmapitems/rhi/shaders/polyline.frag" "quickmapitems/rhi/shaders/polygon.vert" "quickmapitems/rhi/shaders/polygon.frag" ) diff --git a/src/location/quickmapitems/qdeclarativepolylinemapitem.cpp b/src/location/quickmapitems/qdeclarativepolylinemapitem.cpp index fb0e7d79..6c1f3c20 100644 --- a/src/location/quickmapitems/qdeclarativepolylinemapitem.cpp +++ b/src/location/quickmapitems/qdeclarativepolylinemapitem.cpp @@ -803,7 +803,7 @@ struct PolylineBackendSelector { PolylineBackendSelector() { - backend = (qgetenv("QTLOCATION_OPENGL_ITEMS").toInt()) ? QDeclarativePolylineMapItem::OpenGLExtruded : QDeclarativePolylineMapItem::Software; + backend = (qgetenv("QTLOCATION_OPENGL_ITEMS").toInt()) ? QDeclarativePolylineMapItem::OpenGL : QDeclarativePolylineMapItem::Software; } QDeclarativePolylineMapItem::Backend backend = QDeclarativePolylineMapItem::Software; }; @@ -1065,8 +1065,7 @@ QDeclarativeMapLineProperties *QDeclarativePolylineMapItem::line() \qmlproperty MapPolyline.Backend QtLocation::MapPolyline::backend This property holds which backend is in use to render the map item. - Valid values are \b MapPolyline.Software and \b{MapPolyline.OpenGLLineStrip} - and \b{MapPolyline.OpenGLExtruded}. + Valid values are \b MapPolyline.Software and \b{MapPolyline.OpenGL}. The default value is \b{MapPolyline.Software}. \note \b{The release of this API with Qt 5.15 is a Technology Preview}. @@ -1095,12 +1094,8 @@ void QDeclarativePolylineMapItem::setBackend(QDeclarativePolylineMapItem::Backen (m_backend == Software) ? static_cast( new QDeclarativePolylineMapItemPrivateCPU(*this)) - : ((m_backend == OpenGLExtruded) - ? static_cast( - new QDeclarativePolylineMapItemPrivateOpenGLExtruded(*this)) - : static_cast( - new QDeclarativePolylineMapItemPrivateOpenGLLineStrip( - *this)))); + : static_cast( + new QDeclarativePolylineMapItemPrivateOpenGL(*this))); m_d.swap(d); m_d->onGeoGeometryChanged(); emit backendChanged(); diff --git a/src/location/quickmapitems/qdeclarativepolylinemapitem_p.h b/src/location/quickmapitems/qdeclarativepolylinemapitem_p.h index e5446d7b..b4218557 100644 --- a/src/location/quickmapitems/qdeclarativepolylinemapitem_p.h +++ b/src/location/quickmapitems/qdeclarativepolylinemapitem_p.h @@ -105,8 +105,9 @@ class Q_LOCATION_PRIVATE_EXPORT QDeclarativePolylineMapItem : public QDeclarativ public: enum Backend { Software = 0, - OpenGLLineStrip = 1, - OpenGLExtruded = 2, + OpenGLLineStrip = 1, // unused + OpenGLExtruded = 2, // legacy name, use OpenGL instead + OpenGL = OpenGLExtruded }; explicit QDeclarativePolylineMapItem(QQuickItem *parent = nullptr); @@ -165,8 +166,7 @@ public: friend class QDeclarativePolylineMapItemPrivate; friend class QDeclarativePolylineMapItemPrivateCPU; - friend class QDeclarativePolylineMapItemPrivateOpenGLLineStrip; - friend class QDeclarativePolylineMapItemPrivateOpenGLExtruded; + friend class QDeclarativePolylineMapItemPrivateOpenGL; }; QT_END_NAMESPACE diff --git a/src/location/quickmapitems/rhi/qdeclarativecirclemapitem_rhi.cpp b/src/location/quickmapitems/rhi/qdeclarativecirclemapitem_rhi.cpp index 0a09aa4e..f2a7f0e2 100644 --- a/src/location/quickmapitems/rhi/qdeclarativecirclemapitem_rhi.cpp +++ b/src/location/quickmapitems/rhi/qdeclarativecirclemapitem_rhi.cpp @@ -88,7 +88,7 @@ QSGNode *QDeclarativeCircleMapItemPrivateOpenGL::updateMapItemPaintNode(QSGNode m_rootNode = new QDeclarativePolygonMapItemPrivateOpenGL::RootNode(); m_node = new MapPolygonNodeGL(); m_rootNode->appendChildNode(m_node); - m_polylinenode = new MapPolylineNodeOpenGLExtruded(); + m_polylinenode = new MapPolylineNodeOpenGL(); m_rootNode->appendChildNode(m_polylinenode); m_rootNode->markDirty(QSGNode::DirtyNodeAdded); if (oldNode) diff --git a/src/location/quickmapitems/rhi/qdeclarativecirclemapitem_rhi_p.h b/src/location/quickmapitems/rhi/qdeclarativecirclemapitem_rhi_p.h index ba59232d..4e8ec442 100644 --- a/src/location/quickmapitems/rhi/qdeclarativecirclemapitem_rhi_p.h +++ b/src/location/quickmapitems/rhi/qdeclarativecirclemapitem_rhi_p.h @@ -121,7 +121,7 @@ public: QGeoMapPolylineGeometryOpenGL m_borderGeometry; QDeclarativePolygonMapItemPrivateOpenGL::RootNode *m_rootNode = nullptr; MapPolygonNodeGL *m_node = nullptr; - MapPolylineNodeOpenGLExtruded *m_polylinenode = nullptr; + MapPolylineNodeOpenGL *m_polylinenode = nullptr; }; QT_END_NAMESPACE diff --git a/src/location/quickmapitems/rhi/qdeclarativepolygonmapitem_rhi.cpp b/src/location/quickmapitems/rhi/qdeclarativepolygonmapitem_rhi.cpp index 1dd5efea..d09ce710 100644 --- a/src/location/quickmapitems/rhi/qdeclarativepolygonmapitem_rhi.cpp +++ b/src/location/quickmapitems/rhi/qdeclarativepolygonmapitem_rhi.cpp @@ -233,7 +233,7 @@ QSGNode *QDeclarativePolygonMapItemPrivateOpenGL::updateMapItemPaintNode(QSGNode m_rootNode = new RootNode(); m_node = new MapPolygonNodeGL(); m_rootNode->appendChildNode(m_node); - m_polylinenode = new MapPolylineNodeOpenGLExtruded(); + m_polylinenode = new MapPolylineNodeOpenGL(); m_rootNode->appendChildNode(m_polylinenode); m_rootNode->markDirty(QSGNode::DirtyNodeAdded); if (oldNode) diff --git a/src/location/quickmapitems/rhi/qdeclarativepolygonmapitem_rhi_p.h b/src/location/quickmapitems/rhi/qdeclarativepolygonmapitem_rhi_p.h index 1ef1dce2..5aeb625a 100644 --- a/src/location/quickmapitems/rhi/qdeclarativepolygonmapitem_rhi_p.h +++ b/src/location/quickmapitems/rhi/qdeclarativepolygonmapitem_rhi_p.h @@ -230,7 +230,7 @@ public: QGeoMapPolylineGeometryOpenGL m_borderGeometry; RootNode *m_rootNode = nullptr; MapPolygonNodeGL *m_node = nullptr; - MapPolylineNodeOpenGLExtruded *m_polylinenode = nullptr; + MapPolylineNodeOpenGL *m_polylinenode = nullptr; }; diff --git a/src/location/quickmapitems/rhi/qdeclarativepolylinemapitem_rhi.cpp b/src/location/quickmapitems/rhi/qdeclarativepolylinemapitem_rhi.cpp index b7ddf22a..edcd4cfe 100644 --- a/src/location/quickmapitems/rhi/qdeclarativepolylinemapitem_rhi.cpp +++ b/src/location/quickmapitems/rhi/qdeclarativepolylinemapitem_rhi.cpp @@ -44,142 +44,13 @@ QT_BEGIN_NAMESPACE -MapPolylineNodeOpenGLLineStrip::MapPolylineNodeOpenGLLineStrip() -: geometry_(QSGGeometry::defaultAttributes_Point2D(), 0) -{ - geometry_.setDrawingMode(QSGGeometry::DrawLineStrip); - QSGGeometryNode::setMaterial(&fill_material_); - QSGGeometryNode::setGeometry(&geometry_); -} - -MapPolylineNodeOpenGLLineStrip::~MapPolylineNodeOpenGLLineStrip() -{ - -} - -void MapPolylineNodeOpenGLLineStrip::update(const QColor &fillColor, - const qreal lineWidth, - const QGeoMapPolylineGeometryOpenGL *shape, - const QMatrix4x4 &geoProjection, - const QDoubleVector3D ¢er, - const Qt::PenCapStyle /*capStyle*/) -{ - if (shape->m_screenVertices->size() < 2) { - setSubtreeBlocked(true); - return; - } else { - setSubtreeBlocked(false); - } - - QSGGeometry *fill = QSGGeometryNode::geometry(); - if (shape->m_dataChanged) { - shape->allocateAndFillLineStrip(fill); - markDirty(DirtyGeometry); - shape->m_dataChanged = false; - } - fill->setLineWidth(lineWidth); - fill_material_.setLineWidth(lineWidth); // to make the material not compare equal if linewidth changes - -// if (fillColor != fill_material_.color()) - { - fill_material_.setWrapOffset(shape->m_wrapOffset - 1); - fill_material_.setColor(fillColor); - fill_material_.setGeoProjection(geoProjection); - fill_material_.setCenter(center); - setMaterial(&fill_material_); - markDirty(DirtyMaterial); - } -} - -MapPolylineShaderLineStrip::MapPolylineShaderLineStrip() : QSGMaterialShader(*new QSGMaterialShaderPrivate(this)) -{ - setShaderFileName(VertexStage, QLatin1String(":/location/quickmapitems/rhi/shaders/polyline_linestrip.vert.qsb")); - setShaderFileName(FragmentStage, QLatin1String(":/location/quickmapitems/rhi/shaders/polyline_linestrip.frag.qsb")); -} - -bool MapPolylineShaderLineStrip::updateUniformData(QSGMaterialShader::RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) -{ - Q_ASSERT(oldEffect == nullptr || newEffect->type() == oldEffect->type()); - MapPolylineMaterial *oldMaterial = static_cast(oldEffect); - MapPolylineMaterial *newMaterial = static_cast(newEffect); - - const QColor &c = newMaterial->color(); - const QMatrix4x4 &geoProjection = newMaterial->geoProjection(); - const QDoubleVector3D ¢er = newMaterial->center(); - - QVector4D vecCenter, vecCenter_lowpart; - for (int i = 0; i < 3; i++) - QLocationUtils::split_double(center.get(i), &vecCenter[i], &vecCenter_lowpart[i]); - vecCenter[3] = 0; - vecCenter_lowpart[3] = 0; - - int offset = 0; - char *buf_p = state.uniformData()->data(); - - if (state.isMatrixDirty()) { - const QMatrix4x4 m = state.projectionMatrix(); - memcpy(buf_p + offset, m.constData(), 4*4*4); - } - offset += 4*4*4; - - memcpy(buf_p + offset, geoProjection.constData(), 4*4*4); offset+=4*4*4; - - memcpy(buf_p + offset, &vecCenter, 4*4); offset += 4*4; - - memcpy(buf_p + offset, &vecCenter_lowpart, 4*4); offset+=4*4; - - if (state.isOpacityDirty()) { - const float opacity = state.opacity(); - memcpy(buf_p + offset, &opacity, 4); - } - offset += 4; - - float wrapOffset = newMaterial->wrapOffset(); - memcpy(buf_p + offset, &wrapOffset, 4); offset+=4; - - offset+=8; // float padding - - if (oldMaterial == nullptr || c != oldMaterial->color() || state.isOpacityDirty()) { - float opacity = state.opacity() * c.alphaF(); - QVector4D v(c.redF() * opacity, - c.greenF() * opacity, - c.blueF() * opacity, - opacity); - memcpy(buf_p + offset, &v, 4*4); - } - offset+=4*4; - - return true; -} - -QSGMaterialShader *MapPolylineMaterial::createShader(QSGRendererInterface::RenderMode renderMode) const -{ - Q_UNUSED(renderMode); - return new MapPolylineShaderLineStrip(); -} - -QSGMaterialType *MapPolylineMaterial::type() const -{ - static QSGMaterialType type; - return &type; -} - -int MapPolylineMaterial::compare(const QSGMaterial *other) const -{ - const MapPolylineMaterial &o = *static_cast(other); - if (o.m_center == m_center && o.m_geoProjection == m_geoProjection && o.m_wrapOffset == m_wrapOffset && o.m_lineWidth == m_lineWidth) - return QSGFlatColorMaterial::compare(other); - return -1; -} - - -const QSGGeometry::AttributeSet &MapPolylineNodeOpenGLExtruded::attributesMapPolylineTriangulated() +const QSGGeometry::AttributeSet &MapPolylineNodeOpenGL::attributesMapPolylineTriangulated() { return MapPolylineEntry::attributes(); } -MapPolylineNodeOpenGLExtruded::MapPolylineNodeOpenGLExtruded() -: m_geometryTriangulating(MapPolylineNodeOpenGLExtruded::attributesMapPolylineTriangulated(), +MapPolylineNodeOpenGL::MapPolylineNodeOpenGL() +: m_geometryTriangulating(MapPolylineNodeOpenGL::attributesMapPolylineTriangulated(), 0 /* vtx cnt */, 0 /* index cnt */, QSGGeometry::UnsignedIntType /* index type */) { m_geometryTriangulating.setDrawingMode(QSGGeometry::DrawTriangles); @@ -187,7 +58,7 @@ MapPolylineNodeOpenGLExtruded::MapPolylineNodeOpenGLExtruded() QSGGeometryNode::setGeometry(&m_geometryTriangulating); } -MapPolylineNodeOpenGLExtruded::~MapPolylineNodeOpenGLExtruded() +MapPolylineNodeOpenGL::~MapPolylineNodeOpenGL() { } @@ -218,11 +89,11 @@ bool QGeoMapPolylineGeometryOpenGL::allocateAndFillEntries(QSGGeometry *geom, const int numIndices = numSegments * 6; // six vertices per line segment geom->allocate(numIndices); - MapPolylineNodeOpenGLExtruded::MapPolylineEntry *vertices = - static_cast(geom->vertexData()); + MapPolylineNodeOpenGL::MapPolylineEntry *vertices = + static_cast(geom->vertexData()); for (int i = 0; i < numSegments; ++i) { - MapPolylineNodeOpenGLExtruded::MapPolylineEntry e; + MapPolylineNodeOpenGL::MapPolylineEntry e; const QDeclarativeGeoMapItemUtils::vec2 &cur = v[i]; const QDeclarativeGeoMapItemUtils::vec2 &next = v[i+1]; e.triangletype = 1.0; @@ -270,21 +141,7 @@ bool QGeoMapPolylineGeometryOpenGL::allocateAndFillEntries(QSGGeometry *geom, return true; } -void QGeoMapPolylineGeometryOpenGL::allocateAndFillLineStrip(QSGGeometry *geom, - int lod) const -{ - // Select LOD. Generate if not present. Assign it to m_screenVertices; - Q_UNUSED(lod); - - const QList &vx = *m_screenVertices; - geom->allocate(vx.size()); - - QSGGeometry::Point2D *pts = geom->vertexDataAsPoint2D(); - for (qsizetype i = 0; i < vx.size(); ++i) - pts[i].set(vx[i].x, vx[i].y); -} - -void MapPolylineNodeOpenGLExtruded::update(const QColor &fillColor, +void MapPolylineNodeOpenGL::update(const QColor &fillColor, float lineWidth, const QGeoMapPolylineGeometryOpenGL *shape, const QMatrix4x4 &geoProjection, @@ -324,19 +181,19 @@ void MapPolylineNodeOpenGLExtruded::update(const QColor &fillColor, } } -MapPolylineShaderExtruded::MapPolylineShaderExtruded() : QSGMaterialShader(*new QSGMaterialShaderPrivate(this)) +MapPolylineShader::MapPolylineShader() : QSGMaterialShader(*new QSGMaterialShaderPrivate(this)) { // Heavily adapted from https://github.com/mattdesl/webgl-lines/blob/master/projected/vert.glsl, // that is (c) Matt DesLauriers, and released under the MIT license. - setShaderFileName(VertexStage, QLatin1String(":/location/quickmapitems/rhi/shaders/polyline_extruded.vert.qsb")); - setShaderFileName(FragmentStage, QLatin1String(":/location/quickmapitems/rhi/shaders/polyline_extruded.frag.qsb")); + setShaderFileName(VertexStage, QLatin1String(":/location/quickmapitems/rhi/shaders/polyline.vert.qsb")); + setShaderFileName(FragmentStage, QLatin1String(":/location/quickmapitems/rhi/shaders/polyline.frag.qsb")); } -bool MapPolylineShaderExtruded::updateUniformData(QSGMaterialShader::RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) +bool MapPolylineShader::updateUniformData(QSGMaterialShader::RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) { Q_ASSERT(oldEffect == nullptr || newEffect->type() == oldEffect->type()); - MapPolylineMaterialExtruded *oldMaterial = static_cast(oldEffect); - MapPolylineMaterialExtruded *newMaterial = static_cast(newEffect); + MapPolylineMaterial *oldMaterial = static_cast(oldEffect); + MapPolylineMaterial *newMaterial = static_cast(newEffect); const QColor &c = newMaterial->color(); const QMatrix4x4 &geoProjection = newMaterial->geoProjection(); @@ -393,36 +250,40 @@ bool MapPolylineShaderExtruded::updateUniformData(QSGMaterialShader::RenderState return true; } -QSGMaterialShader *MapPolylineMaterialExtruded::createShader(QSGRendererInterface::RenderMode renderMode) const +QSGMaterialShader *MapPolylineMaterial::createShader(QSGRendererInterface::RenderMode renderMode) const { Q_UNUSED(renderMode); - return new MapPolylineShaderExtruded(); + return new MapPolylineShader(); } -QSGMaterialType *MapPolylineMaterialExtruded::type() const +QSGMaterialType *MapPolylineMaterial::type() const { static QSGMaterialType type; return &type; } -int MapPolylineMaterialExtruded::compare(const QSGMaterial *other) const +int MapPolylineMaterial::compare(const QSGMaterial *other) const { - const MapPolylineMaterialExtruded &o = *static_cast(other); - if (o.m_miter == m_miter) - return MapPolylineMaterial::compare(other); + const MapPolylineMaterial &o = *static_cast(other); + if (o.m_center == m_center + && o.m_geoProjection == m_geoProjection + && o.m_wrapOffset == m_wrapOffset + && o.m_lineWidth == m_lineWidth + && o.m_miter == m_miter) + { + return QSGFlatColorMaterial::compare(other); + } return -1; } -QDeclarativePolylineMapItemPrivateOpenGLLineStrip::~QDeclarativePolylineMapItemPrivateOpenGLLineStrip() {} - -bool QDeclarativePolylineMapItemPrivateOpenGLLineStrip::contains(const QPointF &point) const +bool QDeclarativePolylineMapItemPrivateOpenGL::contains(const QPointF &point) const { return m_geometry.contains(m_poly.mapToItem(m_poly.quickMap(), point), m_poly.line()->width(), static_cast(m_poly.map()->geoProjection())); } -void QDeclarativePolylineMapItemPrivateOpenGLLineStrip::updatePolish() +void QDeclarativePolylineMapItemPrivateOpenGL::updatePolish() { if (m_poly.m_geopath.path().length() == 0) { // Possibly cleared m_geometry.clear(); @@ -444,39 +305,10 @@ void QDeclarativePolylineMapItemPrivateOpenGLLineStrip::updatePolish() m_poly.setPosition(1.0 * m_geometry.firstPointOffset() - QPointF(lineWidth * 0.5,lineWidth * 0.5)); } -QSGNode *QDeclarativePolylineMapItemPrivateOpenGLLineStrip::updateMapItemPaintNode(QSGNode *oldNode, - QQuickItem::UpdatePaintNodeData *data) -{ - Q_UNUSED(data); - - if (!m_node || !oldNode) { - m_node = new MapPolylineNodeOpenGLLineStrip(); - if (oldNode) - delete oldNode; - } else { - m_node = static_cast(oldNode); - } - - if (m_geometry.isScreenDirty() || m_poly.m_dirtyMaterial) { - const QGeoMap *map = m_poly.map(); - const QMatrix4x4 &combinedMatrix = map->geoProjection().qsgTransform(); - const QDoubleVector3D &cameraCenter = map->geoProjection().centerMercator(); - m_node->update(m_poly.m_line.color(), // This updates only the material if the geometry is unchanged - m_poly.m_line.width(), - &m_geometry, - combinedMatrix, - cameraCenter); - m_geometry.setPreserveGeometry(false); - m_geometry.markClean(); - m_poly.m_dirtyMaterial = false; - } - return m_node; -} - -QDeclarativePolylineMapItemPrivateOpenGLExtruded::~QDeclarativePolylineMapItemPrivateOpenGLExtruded() {} +QDeclarativePolylineMapItemPrivateOpenGL::~QDeclarativePolylineMapItemPrivateOpenGL() {} -QSGNode *QDeclarativePolylineMapItemPrivateOpenGLExtruded::updateMapItemPaintNode(QSGNode *oldNode, - QQuickItem::UpdatePaintNodeData *data) +QSGNode *QDeclarativePolylineMapItemPrivateOpenGL::updateMapItemPaintNode(QSGNode *oldNode, + QQuickItem::UpdatePaintNodeData *data) { Q_UNUSED(data); const QGeoMap *map = m_poly.map(); @@ -486,13 +318,13 @@ QSGNode *QDeclarativePolylineMapItemPrivateOpenGLExtruded::updateMapItemPaintNod const QColor &color = m_poly.m_line.color(); const float lineWidth = m_poly.m_line.width(); - MapPolylineNodeOpenGLExtruded *nodeTri = nullptr; + MapPolylineNodeOpenGL *nodeTri = nullptr; if (!m_nodeTri || !oldNode) { if (oldNode) delete oldNode; - nodeTri = new MapPolylineNodeOpenGLExtruded(); + nodeTri = new MapPolylineNodeOpenGL(); } else { - nodeTri = static_cast(oldNode); + nodeTri = static_cast(oldNode); } //TODO: update only material diff --git a/src/location/quickmapitems/rhi/qdeclarativepolylinemapitem_rhi_p.h b/src/location/quickmapitems/rhi/qdeclarativepolylinemapitem_rhi_p.h index 1fd07574..88e0692f 100644 --- a/src/location/quickmapitems/rhi/qdeclarativepolylinemapitem_rhi_p.h +++ b/src/location/quickmapitems/rhi/qdeclarativepolylinemapitem_rhi_p.h @@ -67,10 +67,10 @@ QT_BEGIN_NAMESPACE -class Q_LOCATION_PRIVATE_EXPORT MapPolylineShaderLineStrip : public QSGMaterialShader +class Q_LOCATION_PRIVATE_EXPORT MapPolylineShader : public QSGMaterialShader { public: - MapPolylineShaderLineStrip(); + MapPolylineShader(); bool updateUniformData(RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) override; }; @@ -78,8 +78,7 @@ public: class Q_LOCATION_PRIVATE_EXPORT MapPolylineMaterial : public QSGFlatColorMaterial { public: - MapPolylineMaterial() - : QSGFlatColorMaterial() + MapPolylineMaterial() : QSGFlatColorMaterial() { // Passing RequiresFullMatrix is essential in order to prevent the // batch renderer from baking in simple, translate-only transforms into @@ -131,52 +130,6 @@ public: return m_lineWidth; } - QSGMaterialType *type() const override; - int compare(const QSGMaterial *other) const override; - -protected: - QMatrix4x4 m_geoProjection; - QDoubleVector3D m_center; - int m_wrapOffset = 0; - float m_lineWidth = 1.0; -}; - - -class Q_LOCATION_PRIVATE_EXPORT MapPolylineShaderExtruded : public QSGMaterialShader -{ -public: - MapPolylineShaderExtruded(); - - bool updateUniformData(RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) override; -}; - -class Q_LOCATION_PRIVATE_EXPORT MapPolylineNodeOpenGLLineStrip : public MapItemGeometryNode -{ -public: - MapPolylineNodeOpenGLLineStrip(); - ~MapPolylineNodeOpenGLLineStrip() override; - - void update(const QColor &fillColor, - const qreal lineWidth, - const QGeoMapPolylineGeometryOpenGL *shape, - const QMatrix4x4 &geoProjection, - const QDoubleVector3D ¢er, - const Qt::PenCapStyle capStyle = Qt::SquareCap); - -protected: - MapPolylineMaterial fill_material_; - QSGGeometry geometry_; -}; - -class Q_LOCATION_PRIVATE_EXPORT MapPolylineMaterialExtruded : public MapPolylineMaterial -{ -public: - MapPolylineMaterialExtruded() : MapPolylineMaterial() - { - - } - QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const override; - void setMiter(int m) { m_miter = m; @@ -190,10 +143,14 @@ public: QSGMaterialType *type() const override; int compare(const QSGMaterial *other) const override; + QMatrix4x4 m_geoProjection; + QDoubleVector3D m_center; + int m_wrapOffset = 0; + float m_lineWidth = 1.0; int m_miter = 0; }; -class Q_LOCATION_PRIVATE_EXPORT MapPolylineNodeOpenGLExtruded : public MapItemGeometryNode +class Q_LOCATION_PRIVATE_EXPORT MapPolylineNodeOpenGL : public MapItemGeometryNode { public: @@ -223,15 +180,15 @@ public: }; static const QSGGeometry::AttributeSet attrsTri = { 6, - sizeof(MapPolylineNodeOpenGLExtruded::MapPolylineEntry), + sizeof(MapPolylineNodeOpenGL::MapPolylineEntry), dataTri }; return attrsTri; } } MapPolylineEntry; - MapPolylineNodeOpenGLExtruded(); - ~MapPolylineNodeOpenGLExtruded() override; + MapPolylineNodeOpenGL(); + ~MapPolylineNodeOpenGL() override; void update(const QColor &fillColor, float lineWidth, @@ -245,20 +202,21 @@ public: static const QSGGeometry::AttributeSet &attributesMapPolylineTriangulated(); protected: - MapPolylineMaterialExtruded fill_material_; + MapPolylineMaterial fill_material_; QSGGeometry m_geometryTriangulating; }; -class Q_LOCATION_PRIVATE_EXPORT QDeclarativePolylineMapItemPrivateOpenGLLineStrip: public QDeclarativePolylineMapItemPrivate +class Q_LOCATION_PRIVATE_EXPORT QDeclarativePolylineMapItemPrivateOpenGL: public QDeclarativePolylineMapItemPrivate { public: - QDeclarativePolylineMapItemPrivateOpenGLLineStrip(QDeclarativePolylineMapItem &poly) + QDeclarativePolylineMapItemPrivateOpenGL(QDeclarativePolylineMapItem &poly) : QDeclarativePolylineMapItemPrivate(poly) { } - ~QDeclarativePolylineMapItemPrivateOpenGLLineStrip() override; + ~QDeclarativePolylineMapItemPrivateOpenGL() override; + void onLinePropertiesChanged() override { afterViewportChanged(); @@ -295,28 +253,13 @@ public: preserveGeometry(); m_poly.polishAndUpdate(); } + bool contains(const QPointF &point) const override; void updatePolish() override; QSGNode * updateMapItemPaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *data) override; QGeoMapPolylineGeometryOpenGL m_geometry; - MapPolylineNodeOpenGLLineStrip *m_node = nullptr; -}; - -class Q_LOCATION_PRIVATE_EXPORT QDeclarativePolylineMapItemPrivateOpenGLExtruded: public QDeclarativePolylineMapItemPrivateOpenGLLineStrip -{ -public: - - QDeclarativePolylineMapItemPrivateOpenGLExtruded(QDeclarativePolylineMapItem &poly) - : QDeclarativePolylineMapItemPrivateOpenGLLineStrip(poly) - { - } - - ~QDeclarativePolylineMapItemPrivateOpenGLExtruded() override; - - QSGNode * updateMapItemPaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *data) override; - - MapPolylineNodeOpenGLExtruded *m_nodeTri = nullptr; + MapPolylineNodeOpenGL *m_nodeTri = nullptr; }; QT_END_NAMESPACE diff --git a/src/location/quickmapitems/rhi/qdeclarativerectanglemapitem_rhi.cpp b/src/location/quickmapitems/rhi/qdeclarativerectanglemapitem_rhi.cpp index 9125aca9..5bf81384 100644 --- a/src/location/quickmapitems/rhi/qdeclarativerectanglemapitem_rhi.cpp +++ b/src/location/quickmapitems/rhi/qdeclarativerectanglemapitem_rhi.cpp @@ -89,7 +89,7 @@ QSGNode *QDeclarativeRectangleMapItemPrivateOpenGL::updateMapItemPaintNode(QSGNo m_rootNode = new QDeclarativePolygonMapItemPrivateOpenGL::RootNode(); m_node = new MapPolygonNodeGL(); m_rootNode->appendChildNode(m_node); - m_polylinenode = new MapPolylineNodeOpenGLExtruded(); + m_polylinenode = new MapPolylineNodeOpenGL(); m_rootNode->appendChildNode(m_polylinenode); m_rootNode->markDirty(QSGNode::DirtyNodeAdded); if (oldNode) diff --git a/src/location/quickmapitems/rhi/qdeclarativerectanglemapitem_rhi_p.h b/src/location/quickmapitems/rhi/qdeclarativerectanglemapitem_rhi_p.h index d8cccaa6..f3554669 100644 --- a/src/location/quickmapitems/rhi/qdeclarativerectanglemapitem_rhi_p.h +++ b/src/location/quickmapitems/rhi/qdeclarativerectanglemapitem_rhi_p.h @@ -119,7 +119,7 @@ public: QGeoMapPolylineGeometryOpenGL m_borderGeometry; QDeclarativePolygonMapItemPrivateOpenGL::RootNode *m_rootNode = nullptr; MapPolygonNodeGL *m_node = nullptr; - MapPolylineNodeOpenGLExtruded *m_polylinenode = nullptr; + MapPolylineNodeOpenGL *m_polylinenode = nullptr; }; QT_END_NAMESPACE diff --git a/src/location/quickmapitems/rhi/qgeomapitemgeometry_rhi_p.h b/src/location/quickmapitems/rhi/qgeomapitemgeometry_rhi_p.h index 27fb8835..a6ae5af4 100644 --- a/src/location/quickmapitems/rhi/qgeomapitemgeometry_rhi_p.h +++ b/src/location/quickmapitems/rhi/qgeomapitemgeometry_rhi_p.h @@ -144,8 +144,6 @@ public: bool allocateAndFillEntries(QSGGeometry *geom, bool closed = false, unsigned int zoom = 0) const; - void allocateAndFillLineStrip(QSGGeometry *geom, - int lod = 0) const; bool contains(const QPointF &point) const override { diff --git a/src/location/quickmapitems/rhi/shaders/polyline.frag b/src/location/quickmapitems/rhi/shaders/polyline.frag new file mode 100644 index 00000000..3530f093 --- /dev/null +++ b/src/location/quickmapitems/rhi/shaders/polyline.frag @@ -0,0 +1,20 @@ +#version 440 + +layout(location = 0) in vec4 primitivecolor; +layout(location = 0) out vec4 fragColor; + +layout(std140, binding = 0) uniform buf { + mat4 qt_Matrix; + mat4 mapProjection; + vec4 center; + vec4 center_lowpart; + float lineWidth; + float aspect; + int miter; // currently unused + vec4 color; + float wrapOffset; +}; + +void main() { + fragColor = primitivecolor; +} diff --git a/src/location/quickmapitems/rhi/shaders/polyline.vert b/src/location/quickmapitems/rhi/shaders/polyline.vert new file mode 100644 index 00000000..27b69b60 --- /dev/null +++ b/src/location/quickmapitems/rhi/shaders/polyline.vert @@ -0,0 +1,104 @@ +#version 440 + +layout(location = 0) in vec4 vertex; +layout(location = 1) in vec4 previous; +layout(location = 2) in vec4 next; +layout(location = 3) in float direction; +layout(location = 4) in float triangletype; +layout(location = 5) in float vertextype; // -1.0 if it is the "left" end of the segment, 1.0 if it is the "right" end. +layout(location = 0) out vec4 primitivecolor; + +layout(std140, binding = 0) uniform buf { + mat4 qt_Matrix; + mat4 mapProjection; + vec4 center; + vec4 center_lowpart; + float lineWidth; + float aspect; + int miter; // currently unused + vec4 color; + float wrapOffset; +}; + + +vec4 wrapped(in vec4 v) { return vec4(v.x + wrapOffset, v.y, 0.0, 1.0); } +void main() { // ln 22 + primitivecolor = color; + vec2 aspectVec = vec2(aspect, 1.0); + mat4 projViewModel = qt_Matrix * mapProjection; + vec4 cur = wrapped(vertex) - center; + cur = cur - center_lowpart; + vec4 prev = wrapped(previous) - center; + prev = prev - center_lowpart; + vec4 nex = wrapped(next) - center; + nex = nex - center_lowpart; + + vec4 centerProjected = projViewModel * (center + vec4(0.0, 0.0, 0.0, 1.0)); + vec4 previousProjected = projViewModel * prev; + vec4 currentProjected = projViewModel * cur; + vec4 nextProjected = projViewModel * nex; + + //get 2D screen space with W divide and aspect correction + vec2 currentScreen = (currentProjected.xy / currentProjected.w) * aspectVec; + vec2 previousScreen = (previousProjected.xy / previousProjected.w) * aspectVec; + vec2 nextScreen = (nextProjected.xy / nextProjected.w) * aspectVec; + float len = (lineWidth); + float orientation = direction; + bool clipped = false; + bool otherEndBelowFrustum = false; + //starting point uses (next - current) + vec2 dir = vec2(0.0); + if (vertextype < 0.0) { + dir = normalize(nextScreen - currentScreen); + if (nextProjected.z < 0.0) dir = -dir; + } else { + dir = normalize(currentScreen - previousScreen); + if (previousProjected.z < 0.0) dir = -dir; + } +// first, clip current, and make sure currentProjected.z is > 0 + if (currentProjected.z < 0.0) { + if ((nextProjected.z > 0.0 && vertextype < 0.0) || (vertextype > 0.0 && previousProjected.z > 0.0)) { + dir = -dir; + clipped = true; + if (vertextype < 0.0 && nextProjected.y / nextProjected.w < -1.0) otherEndBelowFrustum = true; + else if (vertextype > 0.0 && previousProjected.y / previousProjected.w < -1.0) otherEndBelowFrustum = true; + } else { + primitivecolor = vec4(0.0,0.0,0.0,0.0); + gl_Position = vec4(-10000000.0, -1000000000.0, -1000000000.0, 1); // get the vertex out of the way if the segment is fully invisible + return; + } + } else if (triangletype < 2.0) { // vertex in the view, try to miter + //get directions from (C - B) and (B - A) + vec2 dirA = normalize((currentScreen - previousScreen)); + if (previousProjected.z < 0.0) dirA = -dirA; + vec2 dirB = normalize((nextScreen - currentScreen)); + //now compute the miter join normal and length + if (nextProjected.z < 0.0) dirB = -dirB; + vec2 tangent = normalize(dirA + dirB); + vec2 perp = vec2(-dirA.y, dirA.x); + vec2 vmiter = vec2(-tangent.y, tangent.x); + len = lineWidth / dot(vmiter, perp); +// The following is an attempt to have a segment-length based miter threshold. +// A mediocre workaround until better mitering will be added. + float lenTreshold = clamp( min(length((currentProjected.xy - previousProjected.xy) / aspectVec), + length((nextProjected.xy - currentProjected.xy) / aspectVec)), 3.0, 6.0 ) * 0.5; + if (len < lineWidth * lenTreshold && len > -lineWidth * lenTreshold) { + dir = tangent; + } else { + len = lineWidth; + } + } + vec4 offset; + if (!clipped) { + vec2 normal = normalize(vec2(-dir.y, dir.x)); + normal *= len; // fracZL apparently was needed before the (-2.0 / qt_Matrix[1][1]) factor was introduced + normal /= aspectVec; // straighten the normal up again + float scaleFactor = currentProjected.w / centerProjected.w; + offset = vec4(normal * orientation * scaleFactor * (centerProjected.w / (-2.0 / qt_Matrix[1][1])), 0.0, 0.0); // ToDo: figure out why (-2.0 / qt_Matrix[1][1]), that is empirically what works + gl_Position = currentProjected + offset; + } else { + if (otherEndBelowFrustum) offset = vec4((dir * 1.0) / aspectVec, 0.0, 0.0); // the if is necessary otherwise it seems the direction vector still flips in some obscure cases. + else offset = vec4((dir * 500000000000.0) / aspectVec, 0.0, 0.0); // Hack alert: just 1 triangle, long enough to look like a rectangle. + if (vertextype < 0.0) gl_Position = nextProjected - offset; else gl_Position = previousProjected + offset; + } +} diff --git a/src/location/quickmapitems/rhi/shaders/polyline_extruded.frag b/src/location/quickmapitems/rhi/shaders/polyline_extruded.frag deleted file mode 100644 index 3530f093..00000000 --- a/src/location/quickmapitems/rhi/shaders/polyline_extruded.frag +++ /dev/null @@ -1,20 +0,0 @@ -#version 440 - -layout(location = 0) in vec4 primitivecolor; -layout(location = 0) out vec4 fragColor; - -layout(std140, binding = 0) uniform buf { - mat4 qt_Matrix; - mat4 mapProjection; - vec4 center; - vec4 center_lowpart; - float lineWidth; - float aspect; - int miter; // currently unused - vec4 color; - float wrapOffset; -}; - -void main() { - fragColor = primitivecolor; -} diff --git a/src/location/quickmapitems/rhi/shaders/polyline_extruded.vert b/src/location/quickmapitems/rhi/shaders/polyline_extruded.vert deleted file mode 100644 index 27b69b60..00000000 --- a/src/location/quickmapitems/rhi/shaders/polyline_extruded.vert +++ /dev/null @@ -1,104 +0,0 @@ -#version 440 - -layout(location = 0) in vec4 vertex; -layout(location = 1) in vec4 previous; -layout(location = 2) in vec4 next; -layout(location = 3) in float direction; -layout(location = 4) in float triangletype; -layout(location = 5) in float vertextype; // -1.0 if it is the "left" end of the segment, 1.0 if it is the "right" end. -layout(location = 0) out vec4 primitivecolor; - -layout(std140, binding = 0) uniform buf { - mat4 qt_Matrix; - mat4 mapProjection; - vec4 center; - vec4 center_lowpart; - float lineWidth; - float aspect; - int miter; // currently unused - vec4 color; - float wrapOffset; -}; - - -vec4 wrapped(in vec4 v) { return vec4(v.x + wrapOffset, v.y, 0.0, 1.0); } -void main() { // ln 22 - primitivecolor = color; - vec2 aspectVec = vec2(aspect, 1.0); - mat4 projViewModel = qt_Matrix * mapProjection; - vec4 cur = wrapped(vertex) - center; - cur = cur - center_lowpart; - vec4 prev = wrapped(previous) - center; - prev = prev - center_lowpart; - vec4 nex = wrapped(next) - center; - nex = nex - center_lowpart; - - vec4 centerProjected = projViewModel * (center + vec4(0.0, 0.0, 0.0, 1.0)); - vec4 previousProjected = projViewModel * prev; - vec4 currentProjected = projViewModel * cur; - vec4 nextProjected = projViewModel * nex; - - //get 2D screen space with W divide and aspect correction - vec2 currentScreen = (currentProjected.xy / currentProjected.w) * aspectVec; - vec2 previousScreen = (previousProjected.xy / previousProjected.w) * aspectVec; - vec2 nextScreen = (nextProjected.xy / nextProjected.w) * aspectVec; - float len = (lineWidth); - float orientation = direction; - bool clipped = false; - bool otherEndBelowFrustum = false; - //starting point uses (next - current) - vec2 dir = vec2(0.0); - if (vertextype < 0.0) { - dir = normalize(nextScreen - currentScreen); - if (nextProjected.z < 0.0) dir = -dir; - } else { - dir = normalize(currentScreen - previousScreen); - if (previousProjected.z < 0.0) dir = -dir; - } -// first, clip current, and make sure currentProjected.z is > 0 - if (currentProjected.z < 0.0) { - if ((nextProjected.z > 0.0 && vertextype < 0.0) || (vertextype > 0.0 && previousProjected.z > 0.0)) { - dir = -dir; - clipped = true; - if (vertextype < 0.0 && nextProjected.y / nextProjected.w < -1.0) otherEndBelowFrustum = true; - else if (vertextype > 0.0 && previousProjected.y / previousProjected.w < -1.0) otherEndBelowFrustum = true; - } else { - primitivecolor = vec4(0.0,0.0,0.0,0.0); - gl_Position = vec4(-10000000.0, -1000000000.0, -1000000000.0, 1); // get the vertex out of the way if the segment is fully invisible - return; - } - } else if (triangletype < 2.0) { // vertex in the view, try to miter - //get directions from (C - B) and (B - A) - vec2 dirA = normalize((currentScreen - previousScreen)); - if (previousProjected.z < 0.0) dirA = -dirA; - vec2 dirB = normalize((nextScreen - currentScreen)); - //now compute the miter join normal and length - if (nextProjected.z < 0.0) dirB = -dirB; - vec2 tangent = normalize(dirA + dirB); - vec2 perp = vec2(-dirA.y, dirA.x); - vec2 vmiter = vec2(-tangent.y, tangent.x); - len = lineWidth / dot(vmiter, perp); -// The following is an attempt to have a segment-length based miter threshold. -// A mediocre workaround until better mitering will be added. - float lenTreshold = clamp( min(length((currentProjected.xy - previousProjected.xy) / aspectVec), - length((nextProjected.xy - currentProjected.xy) / aspectVec)), 3.0, 6.0 ) * 0.5; - if (len < lineWidth * lenTreshold && len > -lineWidth * lenTreshold) { - dir = tangent; - } else { - len = lineWidth; - } - } - vec4 offset; - if (!clipped) { - vec2 normal = normalize(vec2(-dir.y, dir.x)); - normal *= len; // fracZL apparently was needed before the (-2.0 / qt_Matrix[1][1]) factor was introduced - normal /= aspectVec; // straighten the normal up again - float scaleFactor = currentProjected.w / centerProjected.w; - offset = vec4(normal * orientation * scaleFactor * (centerProjected.w / (-2.0 / qt_Matrix[1][1])), 0.0, 0.0); // ToDo: figure out why (-2.0 / qt_Matrix[1][1]), that is empirically what works - gl_Position = currentProjected + offset; - } else { - if (otherEndBelowFrustum) offset = vec4((dir * 1.0) / aspectVec, 0.0, 0.0); // the if is necessary otherwise it seems the direction vector still flips in some obscure cases. - else offset = vec4((dir * 500000000000.0) / aspectVec, 0.0, 0.0); // Hack alert: just 1 triangle, long enough to look like a rectangle. - if (vertextype < 0.0) gl_Position = nextProjected - offset; else gl_Position = previousProjected + offset; - } -} diff --git a/src/location/quickmapitems/rhi/shaders/polyline_linestrip.frag b/src/location/quickmapitems/rhi/shaders/polyline_linestrip.frag deleted file mode 100644 index e9124d27..00000000 --- a/src/location/quickmapitems/rhi/shaders/polyline_linestrip.frag +++ /dev/null @@ -1,17 +0,0 @@ -#version 440 - -layout(location = 0) out vec4 fragColor; - -layout(std140, binding = 0) uniform buf { - mat4 qt_Matrix; - mat4 mapProjection; - vec4 center; - vec4 center_lowpart; - float opacity; - float wrapOffset; - vec4 color; -}; - -void main() { - fragColor = color; -} diff --git a/src/location/quickmapitems/rhi/shaders/polyline_linestrip.vert b/src/location/quickmapitems/rhi/shaders/polyline_linestrip.vert deleted file mode 100644 index 86b4f3a3..00000000 --- a/src/location/quickmapitems/rhi/shaders/polyline_linestrip.vert +++ /dev/null @@ -1,21 +0,0 @@ -#version 440 - -layout(location = 0) in vec4 qt_Vertex; - -layout(std140, binding = 0) uniform buf { - mat4 qt_Matrix; - mat4 mapProjection; - vec4 center; - vec4 center_lowpart; - float opacity; - float wrapOffset; - vec4 color; -}; - -vec4 wrapped(in vec4 v) { return vec4(v.x + wrapOffset, v.y, 0.0, 1.0); } - -void main() { - vec4 vtx = wrapped(qt_Vertex) - center; - vtx = vtx - center_lowpart; - gl_Position = qt_Matrix * mapProjection * vtx; -} diff --git a/tests/manual/mappolyline_tester/main.qml b/tests/manual/mappolyline_tester/main.qml index 9a657309..c8154916 100644 --- a/tests/manual/mappolyline_tester/main.qml +++ b/tests/manual/mappolyline_tester/main.qml @@ -110,7 +110,7 @@ Window { } C2.ComboBox { - model: ['Software','OpenGL LineStrip','OpenGL Triangles'] + model: ['Software', 'OpenGL'] id: switchPolylines1 anchors { top: parent.top @@ -153,7 +153,7 @@ Window { } C2.ComboBox { - model: ['Software','OpenGL LineStrip','OpenGL Triangles'] + model: ['Software', 'OpenGL'] id: switchPolylines2 anchors { top: parent.top @@ -178,10 +178,8 @@ Window { function polylineBackend() { - return (polyGroup.glPolylines === "OpenGL LineStrip") - ? MapPolyline.OpenGLLineStrip - : ((polyGroup.glPolylines === "Software") - ? MapPolyline.Software : MapPolyline.OpenGLExtruded) + return (polyGroup.glPolylines === "Software") + ? MapPolyline.Software : MapPolyline.OpenGL } function polygonBackend() -- cgit v1.2.1