[core] Switch from background to foreground placement
- Background placement code now just generates static symbol buffers - Don't render GeometryTiles until their symbols are loaded. This is necessary for the CrossTileSymbolIndex to successfully prevent flicker. - SymbolInstances are transferred to SymbolBucket for use on foreground during collision detection - Symbols are sorted on foreground by sorting their index buffer but leaving vertex buffers intact (only works within one segment) - Vertical glyphs are generated at same time as horizontal glyphs. `reprojectLineLabels` chooses which one to use at render time and hides the other. - Icons are now always represented with a single collision box, even if they're placed along a line (this means their rotation alignment may be wrong, but the approach of representing them with multiple collision boxes wasn't very accurate either). - Generate vertices for new debug collision boxes and collision circles - Only add symbols within tile boundaries (reduces work, avoids double-draw) - Update symbol_projection.cpp to support line label projection calls from CollisionIndex.
This commit is contained in:
@@ -11,7 +11,6 @@ SymbolInstance::SymbolInstance(Anchor& anchor_,
|
||||
optional<PositionedIcon> shapedIcon,
|
||||
const SymbolLayoutProperties::Evaluated& layout,
|
||||
const float layoutTextSize,
|
||||
const bool addToBuffers,
|
||||
const uint32_t index_,
|
||||
const float textBoxScale,
|
||||
const float textPadding,
|
||||
@@ -19,11 +18,12 @@ SymbolInstance::SymbolInstance(Anchor& anchor_,
|
||||
const std::array<float, 2> textOffset_,
|
||||
const float iconBoxScale,
|
||||
const float iconPadding,
|
||||
const SymbolPlacementType iconPlacement,
|
||||
const std::array<float, 2> iconOffset_,
|
||||
const GlyphPositionMap& positions,
|
||||
const IndexedSubfeature& indexedFeature,
|
||||
const std::size_t featureIndex_) :
|
||||
const std::size_t featureIndex_,
|
||||
const std::u16string& key_,
|
||||
const float overscaling) :
|
||||
anchor(anchor_),
|
||||
line(line_),
|
||||
index(index_),
|
||||
@@ -31,25 +31,22 @@ SymbolInstance::SymbolInstance(Anchor& anchor_,
|
||||
hasIcon(shapedIcon),
|
||||
|
||||
// Create the collision features that will be used to check whether this symbol instance can be placed
|
||||
textCollisionFeature(line_, anchor, shapedTextOrientations.second ?: shapedTextOrientations.first, textBoxScale, textPadding, textPlacement, indexedFeature),
|
||||
iconCollisionFeature(line_, anchor, shapedIcon, iconBoxScale, iconPadding, iconPlacement, indexedFeature),
|
||||
textCollisionFeature(line_, anchor, shapedTextOrientations.first, textBoxScale, textPadding, textPlacement, indexedFeature, overscaling),
|
||||
iconCollisionFeature(line_, anchor, shapedIcon, iconBoxScale, iconPadding, SymbolPlacementType::Point, indexedFeature),
|
||||
featureIndex(featureIndex_),
|
||||
textOffset(textOffset_),
|
||||
iconOffset(iconOffset_) {
|
||||
iconOffset(iconOffset_),
|
||||
key(key_) {
|
||||
|
||||
// Create the quads used for rendering the icon and glyphs.
|
||||
if (addToBuffers) {
|
||||
if (shapedIcon) {
|
||||
iconQuad = getIconQuad(*shapedIcon, layout, layoutTextSize, shapedTextOrientations.first);
|
||||
}
|
||||
if (shapedTextOrientations.first) {
|
||||
auto quads = getGlyphQuads(shapedTextOrientations.first, layout, textPlacement, positions);
|
||||
glyphQuads.insert(glyphQuads.end(), quads.begin(), quads.end());
|
||||
}
|
||||
if (shapedTextOrientations.second) {
|
||||
auto quads = getGlyphQuads(shapedTextOrientations.second, layout, textPlacement, positions);
|
||||
glyphQuads.insert(glyphQuads.end(), quads.begin(), quads.end());
|
||||
}
|
||||
if (shapedIcon) {
|
||||
iconQuad = getIconQuad(*shapedIcon, layout, layoutTextSize, shapedTextOrientations.first);
|
||||
}
|
||||
if (shapedTextOrientations.first) {
|
||||
horizontalGlyphQuads = getGlyphQuads(shapedTextOrientations.first, layout, textPlacement, positions);
|
||||
}
|
||||
if (shapedTextOrientations.second) {
|
||||
verticalGlyphQuads = getGlyphQuads(shapedTextOrientations.second, layout, textPlacement, positions);
|
||||
}
|
||||
|
||||
if (shapedTextOrientations.first && shapedTextOrientations.second) {
|
||||
|
||||
Reference in New Issue
Block a user