diff options
Diffstat (limited to 'src/mbgl/layout/symbol_layout.cpp')
-rw-r--r-- | src/mbgl/layout/symbol_layout.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/mbgl/layout/symbol_layout.cpp b/src/mbgl/layout/symbol_layout.cpp index 07ba2bf4a3..0bf152e973 100644 --- a/src/mbgl/layout/symbol_layout.cpp +++ b/src/mbgl/layout/symbol_layout.cpp @@ -451,15 +451,14 @@ void SymbolLayout::addSymbols(Buffer &buffer, const SymbolQuads &symbols, float const int glyph_vertex_length = 4; - if (buffer.groups.empty() || buffer.groups.back().vertexLength + glyph_vertex_length > 65535) { - // Move to a new group because the old one can't hold the geometry. - buffer.groups.emplace_back(); + if (buffer.segments.empty() || buffer.segments.back().vertexLength + glyph_vertex_length > 65535) { + buffer.segments.emplace_back(buffer.vertices.size(), buffer.triangles.size()); } // We're generating triangle fans, so we always start with the first // coordinate in this polygon. - auto& group = buffer.groups.back(); - size_t index = group.vertexLength; + auto& segment = buffer.segments.back(); + size_t index = segment.vertexLength; // Encode angle of glyph uint8_t glyphAngle = std::round((symbol.glyphAngle / (M_PI * 2)) * 256); @@ -482,8 +481,8 @@ void SymbolLayout::addSymbols(Buffer &buffer, const SymbolQuads &symbols, float static_cast<uint16_t>(index + 2), static_cast<uint16_t>(index + 3)); - group.vertexLength += glyph_vertex_length; - group.indexLength += 2; + segment.vertexLength += glyph_vertex_length; + segment.primitiveLength += 2; } } @@ -496,10 +495,6 @@ void SymbolLayout::addToDebugBuffers(CollisionTile& collisionTile, SymbolBucket& const float yStretch = collisionTile.yStretch; auto& collisionBox = bucket.collisionBox; - if (collisionBox.groups.empty()) { - // Move to a new group because the old one can't hold the geometry. - collisionBox.groups.emplace_back(); - } for (const SymbolInstance &symbolInstance : symbolInstances) { auto populateCollisionBox = [&](const auto& feature) { @@ -526,9 +521,6 @@ void SymbolLayout::addToDebugBuffers(CollisionTile& collisionTile, SymbolBucket& collisionBox.vertices.emplace_back(anchor.x, anchor.y, bl.x, bl.y, maxZoom, placementZoom); collisionBox.vertices.emplace_back(anchor.x, anchor.y, bl.x, bl.y, maxZoom, placementZoom); collisionBox.vertices.emplace_back(anchor.x, anchor.y, tl.x, tl.y, maxZoom, placementZoom); - - auto& group = collisionBox.groups.back(); - group.vertexLength += 8; } }; populateCollisionBox(symbolInstance.textCollisionFeature); |