Change naming in some platform files (#2452)

This commit is contained in:
Tim Sylvester
2024-05-30 13:55:38 -07:00
committed by GitHub
parent 10364ec7d3
commit 7f366a7583
12 changed files with 114 additions and 97 deletions

View File

@@ -65,6 +65,8 @@ void TileSourceRenderItem::updateDebugDrawables(DebugLayerGroupMap& debugLayerGr
if (!debugShader) {
return;
}
const auto drawableName = "debug-" + name;
std::unique_ptr<gfx::DrawableBuilder> debugBuilder = [&]() -> std::unique_ptr<gfx::DrawableBuilder> {
auto builder = context.createDrawableBuilder("debug-builder");
builder->setShader(debugShader);
@@ -73,6 +75,7 @@ void TileSourceRenderItem::updateDebugDrawables(DebugLayerGroupMap& debugLayerGr
builder->setColorMode(gfx::ColorMode::unblended());
builder->setCullFaceMode(gfx::CullFaceMode::disabled());
builder->setVertexAttrId(idDebugPosVertexAttribute);
builder->setDrawableName(drawableName);
return builder;
}();
@@ -102,19 +105,21 @@ void TileSourceRenderItem::updateDebugDrawables(DebugLayerGroupMap& debugLayerGr
builder->setColorMode(gfx::ColorMode::alphaBlended());
builder->setCullFaceMode(gfx::CullFaceMode::disabled());
builder->setVertexAttrId(idLinePosNormalVertexAttribute);
builder->setDrawableName(drawableName);
return builder;
};
#endif
// add or get the layer group for a debug type
const auto addOrGetLayerGroupForType = [&debugLayerGroups, &context](
DebugType type,
const std::string&& layerName) -> DebugLayerGroupMap::const_iterator {
const auto addOrGetLayerGroupForType =
[&debugLayerGroups, &context](DebugType type, std::string&& layerName) -> DebugLayerGroupMap::const_iterator {
auto it = debugLayerGroups.find(type);
if (it == debugLayerGroups.end()) {
auto inserted = debugLayerGroups.insert(std::make_pair(
type, context.createTileLayerGroup(static_cast<int32_t>(type), /*initialCapacity=*/64, layerName)));
auto inserted = debugLayerGroups.insert(
std::make_pair(type,
context.createTileLayerGroup(
static_cast<int32_t>(type), /*initialCapacity=*/64, std::move(layerName))));
assert(inserted.second);
it = inserted.first;
}
@@ -223,6 +228,17 @@ void TileSourceRenderItem::updateDebugDrawables(DebugLayerGroupMap& debugLayerGr
// We would need to set up `idLineExpressionUBO` if the expression mask isn't empty
assert(linePropertiesUBO.expressionMask == LineExpressionMask::None);
const LineExpressionUBO exprUBO = {
/* color = */ nullptr,
/* blur = */ nullptr,
/* opacity = */ nullptr,
/* gapwidth = */ nullptr,
/* offset = */ nullptr,
/* width = */ nullptr,
/* floorWidth = */ nullptr,
};
drawableUniforms.createOrUpdate(idLineExpressionUBO, &exprUBO, parameters.context);
};
private:
@@ -271,7 +287,8 @@ void TileSourceRenderItem::updateDebugDrawables(DebugLayerGroupMap& debugLayerGr
// erase drawables that are not in the current tile set
for (auto& lg : {outlineLayerGroup, textLayerGroup}) {
lg->removeDrawablesIf([&](gfx::Drawable& drawable) {
return !(drawable.getTileID().has_value() && newTiles.count(*drawable.getTileID()) > 0);
return drawable.getName() == drawableName &&
!(drawable.getTileID().has_value() && newTiles.count(*drawable.getTileID()) > 0);
});
}
@@ -326,7 +343,8 @@ void TileSourceRenderItem::updateDebugDrawables(DebugLayerGroupMap& debugLayerGr
// erase drawables that are not in the current tile set
tileLayerGroup->removeDrawablesIf([&](gfx::Drawable& drawable) {
return !(drawable.getTileID().has_value() && newTiles.count(*drawable.getTileID()) > 0);
return drawable.getName() == drawableName &&
!(drawable.getTileID().has_value() && newTiles.count(*drawable.getTileID()) > 0);
});
// add new drawables and update existing ones