[core] Split MapMode::Still into Static and Tile
`Tile` makes sure the symbols in the resulting tile are tileable while symbols in `Still` match rendering in `Continuous` mode.
This commit is contained in:
committed by
Chris Loer
parent
5bdee52e5c
commit
22c07596a0
@@ -314,9 +314,7 @@ void SymbolLayout::addFeature(const std::size_t index,
|
||||
|
||||
if (avoidEdges && !inside) return;
|
||||
|
||||
// TODO set this to make api-gl work
|
||||
const bool singleTileMode = false && mode == MapMode::Still;
|
||||
if (singleTileMode || withinPlus0) {
|
||||
if (mode == MapMode::Tile || withinPlus0) {
|
||||
symbolInstances.emplace_back(anchor, line, shapedTextOrientations, shapedIcon,
|
||||
layout.evaluate(zoom, feature), layoutTextSize,
|
||||
symbolInstances.size(),
|
||||
|
||||
@@ -149,8 +149,8 @@ void Map::renderStill(StillImageCallback callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (impl->mode != MapMode::Still) {
|
||||
callback(std::make_exception_ptr(util::MisuseException("Map is not in still image render mode")));
|
||||
if (impl->mode != MapMode::Static && impl->mode != MapMode::Tile) {
|
||||
callback(std::make_exception_ptr(util::MisuseException("Map is not in static or tile image render modes")));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -794,7 +794,7 @@ void Map::Impl::onStyleError(std::exception_ptr error) {
|
||||
}
|
||||
|
||||
void Map::Impl::onResourceError(std::exception_ptr error) {
|
||||
if (mode == MapMode::Still && stillImageRequest) {
|
||||
if (mode != MapMode::Continuous && stillImageRequest) {
|
||||
auto request = std::move(stillImageRequest);
|
||||
request->callback(error);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ void CircleBucket::addFeature(const GeometryTileFeature& feature,
|
||||
// Do not include points that are outside the tile boundaries.
|
||||
// Include all points in Still mode. You need to include points from
|
||||
// neighbouring tiles so that they are not clipped at tile boundaries.
|
||||
if ((mode != MapMode::Still) &&
|
||||
if ((mode == MapMode::Continuous) &&
|
||||
(x < 0 || x >= util::EXTENT || y < 0 || y >= util::EXTENT)) continue;
|
||||
|
||||
if (segments.empty() || segments.back().vertexLength + vertexLength > std::numeric_limits<uint16_t>::max()) {
|
||||
|
||||
@@ -63,7 +63,7 @@ void RenderCircleLayer::render(PaintParameters& parameters, RenderSource*) {
|
||||
parameters.context,
|
||||
gl::Triangles(),
|
||||
parameters.depthModeForSublayer(0, gl::DepthMode::ReadOnly),
|
||||
parameters.mapMode == MapMode::Still
|
||||
parameters.mapMode != MapMode::Continuous
|
||||
? parameters.stencilModeForClipping(tile.clip)
|
||||
: gl::StencilMode::disabled(),
|
||||
parameters.colorModeForRenderPass(),
|
||||
|
||||
@@ -88,18 +88,13 @@ void RenderSymbolLayer::render(PaintParameters& parameters, RenderSource*) {
|
||||
const auto& binders,
|
||||
const auto& paintProperties)
|
||||
{
|
||||
// We clip symbols to their tile extent in still mode.
|
||||
const bool needsClipping = false; // TODO parameters.mapMode == MapMode::Still;
|
||||
|
||||
program.get(paintProperties).draw(
|
||||
parameters.context,
|
||||
gl::Triangles(),
|
||||
values_.pitchAlignment == AlignmentType::Map
|
||||
? parameters.depthModeForSublayer(0, gl::DepthMode::ReadOnly)
|
||||
: gl::DepthMode::disabled(),
|
||||
needsClipping
|
||||
? parameters.stencilModeForClipping(tile.clip)
|
||||
: gl::StencilMode::disabled(),
|
||||
gl::StencilMode::disabled(),
|
||||
parameters.colorModeForRenderPass(),
|
||||
std::move(uniformValues),
|
||||
*buffers.vertexBuffer,
|
||||
|
||||
@@ -59,7 +59,7 @@ Renderer::Impl::Impl(RendererBackend& backend_,
|
||||
, layerImpls(makeMutable<std::vector<Immutable<style::Layer::Impl>>>())
|
||||
, renderLight(makeMutable<Light::Impl>())
|
||||
, crossTileSymbolIndex(std::make_unique<CrossTileSymbolIndex>())
|
||||
, placement(std::make_unique<Placement>(TransformState{}, MapMode::Still)) {
|
||||
, placement(std::make_unique<Placement>(TransformState{}, MapMode::Static)) {
|
||||
glyphManager->setObserver(this);
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ void Renderer::Impl::setObserver(RendererObserver* observer_) {
|
||||
}
|
||||
|
||||
void Renderer::Impl::render(const UpdateParameters& updateParameters) {
|
||||
if (updateParameters.mode == MapMode::Still) {
|
||||
if (updateParameters.mode != MapMode::Continuous) {
|
||||
// Don't load/render anyting in still mode until explicitly requested.
|
||||
if (!updateParameters.stillImageRequest) {
|
||||
return;
|
||||
@@ -260,7 +260,7 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
|
||||
};
|
||||
|
||||
bool loaded = updateParameters.styleLoaded && isLoaded();
|
||||
if (updateParameters.mode == MapMode::Still && !loaded) {
|
||||
if (updateParameters.mode != MapMode::Continuous && !loaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -355,10 +355,8 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
|
||||
sortedTilesForInsertion.emplace_back(tile);
|
||||
tile.used = true;
|
||||
|
||||
// We only need clipping when we're _not_ drawing a symbol layer. The only exception
|
||||
// for symbol layers is when we're rendering still images. See render_symbol_layer.cpp
|
||||
// for the exception we make there.
|
||||
if (!symbolLayer || parameters.mapMode == MapMode::Still) {
|
||||
// We only need clipping when we're _not_ drawing a symbol layer.
|
||||
if (!symbolLayer) {
|
||||
tile.needsClipping = true;
|
||||
}
|
||||
}
|
||||
@@ -368,7 +366,7 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
|
||||
}
|
||||
|
||||
bool symbolBucketsChanged = false;
|
||||
if (parameters.mapMode == MapMode::Still) {
|
||||
if (parameters.mapMode != MapMode::Continuous) {
|
||||
// TODO: Think about right way for symbol index to handle still rendering
|
||||
crossTileSymbolIndex->reset();
|
||||
}
|
||||
|
||||
@@ -154,7 +154,9 @@ bool Placement::commit(const Placement& prevPlacement, TimePoint now) {
|
||||
|
||||
bool placementChanged = false;
|
||||
|
||||
float increment = mapMode == MapMode::Still ? 1.0 : std::chrono::duration<float>(commitTime - prevPlacement.commitTime) / Duration(std::chrono::milliseconds(300));
|
||||
float increment = mapMode == MapMode::Continuous ?
|
||||
std::chrono::duration<float>(commitTime - prevPlacement.commitTime) / Duration(std::chrono::milliseconds(300)) :
|
||||
1.0;
|
||||
|
||||
// add the opacities from the current placement, and copy their current values from the previous placement
|
||||
for (auto& placementPair : placements) {
|
||||
@@ -275,10 +277,11 @@ JointOpacityState Placement::getOpacity(uint32_t crossTileSymbolID) const {
|
||||
}
|
||||
|
||||
float Placement::symbolFadeChange(TimePoint now) const {
|
||||
if (mapMode == MapMode::Still) {
|
||||
if (mapMode == MapMode::Continuous) {
|
||||
return std::chrono::duration<float>(now - commitTime) / Duration(std::chrono::milliseconds(300));
|
||||
} else {
|
||||
return 1.0;
|
||||
}
|
||||
return std::chrono::duration<float>(now - commitTime) / Duration(std::chrono::milliseconds(300));
|
||||
}
|
||||
|
||||
bool Placement::hasTransitions(TimePoint now) const {
|
||||
|
||||
Reference in New Issue
Block a user