pass StyleLayer objects as const ref instead of a shared pointer
This commit is contained in:
@@ -25,7 +25,7 @@ void RasterTileData::parse() {
|
||||
}
|
||||
}
|
||||
|
||||
void RasterTileData::render(Painter &painter, util::ptr<StyleLayer> layer_desc, const mat4 &matrix) {
|
||||
void RasterTileData::render(Painter &painter, const StyleLayer &layer_desc, const mat4 &matrix) {
|
||||
bucket.render(painter, layer_desc, id, matrix);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,9 +20,9 @@ public:
|
||||
RasterTileData(Tile::ID const& id, TexturePool&, const SourceInfo&, FileSource &);
|
||||
~RasterTileData();
|
||||
|
||||
virtual void parse();
|
||||
virtual void render(Painter &painter, util::ptr<StyleLayer> layer_desc, const mat4 &matrix);
|
||||
virtual bool hasData(StyleLayer const& layer_desc) const;
|
||||
void parse() override;
|
||||
void render(Painter &painter, const StyleLayer &layer_desc, const mat4 &matrix) override;
|
||||
bool hasData(StyleLayer const &layer_desc) const override;
|
||||
|
||||
protected:
|
||||
StyleLayoutRaster layout;
|
||||
|
||||
@@ -95,8 +95,8 @@ void Source::drawClippingMasks(Painter &painter) {
|
||||
}
|
||||
}
|
||||
|
||||
void Source::render(Painter &painter, util::ptr<StyleLayer> layer_desc) {
|
||||
gl::group group(std::string { "layer: " } + layer_desc->id);
|
||||
void Source::render(Painter &painter, const StyleLayer &layer_desc) {
|
||||
gl::group group(std::string { "layer: " } + layer_desc.id);
|
||||
for (const std::pair<const Tile::ID, std::unique_ptr<Tile>> &pair : tiles) {
|
||||
Tile &tile = *pair.second;
|
||||
if (tile.data && tile.data->state == TileData::State::parsed) {
|
||||
@@ -105,7 +105,7 @@ void Source::render(Painter &painter, util::ptr<StyleLayer> layer_desc) {
|
||||
}
|
||||
}
|
||||
|
||||
void Source::render(Painter &painter, util::ptr<StyleLayer> layer_desc, const Tile::ID &id, const mat4 &matrix) {
|
||||
void Source::render(Painter &painter, const StyleLayer &layer_desc, const Tile::ID &id, const mat4 &matrix) {
|
||||
auto it = tiles.find(id);
|
||||
if (it != tiles.end() && it->second->data && it->second->data->state == TileData::State::parsed) {
|
||||
painter.renderTileLayer(*it->second, layer_desc, matrix);
|
||||
|
||||
@@ -45,8 +45,8 @@ public:
|
||||
void updateMatrices(const mat4 &projMatrix, const TransformState &transform);
|
||||
void drawClippingMasks(Painter &painter);
|
||||
size_t getTileCount() const;
|
||||
void render(Painter &painter, util::ptr<StyleLayer> layer_desc);
|
||||
void render(Painter &painter, util::ptr<StyleLayer> layer_desc, const Tile::ID &id, const mat4 &matrix);
|
||||
void render(Painter &painter, const StyleLayer &layer_desc);
|
||||
void render(Painter &painter, const StyleLayer &layer_desc, const Tile::ID &id, const mat4 &matrix);
|
||||
void finishRender(Painter &painter);
|
||||
|
||||
std::forward_list<Tile::ID> getIDs() const;
|
||||
|
||||
@@ -62,9 +62,8 @@ public:
|
||||
|
||||
// Override this in the child class.
|
||||
virtual void parse() = 0;
|
||||
virtual void render(Painter &painter, util::ptr<StyleLayer> layer_desc, const mat4 &matrix) = 0;
|
||||
virtual bool hasData(StyleLayer const& layer_desc) const = 0;
|
||||
|
||||
virtual void render(Painter &painter, const StyleLayer &layer_desc, const mat4 &matrix) = 0;
|
||||
virtual bool hasData(StyleLayer const &layer_desc) const = 0;
|
||||
|
||||
public:
|
||||
const Tile::ID id;
|
||||
|
||||
@@ -59,9 +59,9 @@ void VectorTileData::parse() {
|
||||
}
|
||||
}
|
||||
|
||||
void VectorTileData::render(Painter &painter, util::ptr<StyleLayer> layer_desc, const mat4 &matrix) {
|
||||
if (state == State::parsed && layer_desc->bucket) {
|
||||
auto databucket_it = buckets.find(layer_desc->bucket->name);
|
||||
void VectorTileData::render(Painter &painter, const StyleLayer &layer_desc, const mat4 &matrix) {
|
||||
if (state == State::parsed && layer_desc.bucket) {
|
||||
auto databucket_it = buckets.find(layer_desc.bucket->name);
|
||||
if (databucket_it != buckets.end()) {
|
||||
assert(databucket_it->second);
|
||||
databucket_it->second->render(painter, layer_desc, id, matrix);
|
||||
@@ -69,7 +69,7 @@ void VectorTileData::render(Painter &painter, util::ptr<StyleLayer> layer_desc,
|
||||
}
|
||||
}
|
||||
|
||||
bool VectorTileData::hasData(StyleLayer const& layer_desc) const {
|
||||
bool VectorTileData::hasData(const StyleLayer &layer_desc) const {
|
||||
if (state == State::parsed && layer_desc.bucket) {
|
||||
auto databucket_it = buckets.find(layer_desc.bucket->name);
|
||||
if (databucket_it != buckets.end()) {
|
||||
|
||||
@@ -37,9 +37,9 @@ public:
|
||||
const SourceInfo&, FileSource &);
|
||||
~VectorTileData();
|
||||
|
||||
virtual void parse();
|
||||
virtual void render(Painter &painter, util::ptr<StyleLayer> layer_desc, const mat4 &matrix);
|
||||
virtual bool hasData(StyleLayer const& layer_desc) const;
|
||||
void parse() override;
|
||||
void render(Painter &painter, const StyleLayer &layer_desc, const mat4 &matrix) override;
|
||||
bool hasData(StyleLayer const& layer_desc) const override;
|
||||
|
||||
protected:
|
||||
// Holds the actual geometries in this tile.
|
||||
|
||||
@@ -13,7 +13,8 @@ class StyleLayer;
|
||||
|
||||
class Bucket : private util::noncopyable {
|
||||
public:
|
||||
virtual void render(Painter& painter, util::ptr<StyleLayer> layer_desc, const Tile::ID& id, const mat4 &matrix) = 0;
|
||||
virtual void render(Painter &painter, const StyleLayer &layer_desc, const Tile::ID &id,
|
||||
const mat4 &matrix) = 0;
|
||||
virtual bool hasData() const = 0;
|
||||
virtual ~Bucket() {}
|
||||
|
||||
|
||||
@@ -13,7 +13,8 @@ DebugBucket::DebugBucket(DebugFontBuffer& fontBuffer_)
|
||||
: fontBuffer(fontBuffer_) {
|
||||
}
|
||||
|
||||
void DebugBucket::render(Painter& painter, util::ptr<StyleLayer> /*layer_desc*/, const Tile::ID& /*id*/, const mat4 &matrix) {
|
||||
void DebugBucket::render(Painter &painter, const StyleLayer & /*layer_desc*/,
|
||||
const Tile::ID & /*id*/, const mat4 &matrix) {
|
||||
painter.renderDebugText(*this, matrix);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,9 @@ class DebugBucket : public Bucket {
|
||||
public:
|
||||
DebugBucket(DebugFontBuffer& fontBuffer);
|
||||
|
||||
virtual void render(Painter& painter, util::ptr<StyleLayer> layer_desc, const Tile::ID& id, const mat4 &matrix);
|
||||
virtual bool hasData() const;
|
||||
void render(Painter &painter, const StyleLayer &layer_desc, const Tile::ID &id,
|
||||
const mat4 &matrix) override;
|
||||
bool hasData() const override;
|
||||
|
||||
void drawLines(PlainShader& shader);
|
||||
void drawPoints(PlainShader& shader);
|
||||
|
||||
@@ -213,7 +213,8 @@ void FillBucket::tessellate() {
|
||||
lineGroup.vertex_length += total_vertex_count;
|
||||
}
|
||||
|
||||
void FillBucket::render(Painter& painter, util::ptr<StyleLayer> layer_desc, const Tile::ID& id, const mat4 &matrix) {
|
||||
void FillBucket::render(Painter &painter, const StyleLayer &layer_desc, const Tile::ID &id,
|
||||
const mat4 &matrix) {
|
||||
painter.renderFill(*this, layer_desc, id, matrix);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,10 +43,11 @@ public:
|
||||
FillVertexBuffer &vertexBuffer,
|
||||
TriangleElementsBuffer &triangleElementsBuffer,
|
||||
LineElementsBuffer &lineElementsBuffer);
|
||||
~FillBucket();
|
||||
~FillBucket() override;
|
||||
|
||||
virtual void render(Painter& painter, util::ptr<StyleLayer> layer_desc, const Tile::ID& id, const mat4 &matrix);
|
||||
virtual bool hasData() const;
|
||||
void render(Painter &painter, const StyleLayer &layer_desc, const Tile::ID &id,
|
||||
const mat4 &matrix) override;
|
||||
bool hasData() const override;
|
||||
|
||||
void addGeometry(pbf& data);
|
||||
void tessellate();
|
||||
|
||||
@@ -351,7 +351,8 @@ void LineBucket::addGeometry(const std::vector<Coordinate>& vertices) {
|
||||
}
|
||||
}
|
||||
|
||||
void LineBucket::render(Painter& painter, util::ptr<StyleLayer> layer_desc, const Tile::ID& id, const mat4 &matrix) {
|
||||
void LineBucket::render(Painter &painter, const StyleLayer &layer_desc, const Tile::ID &id,
|
||||
const mat4 &matrix) {
|
||||
painter.renderLine(*this, layer_desc, id, matrix);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,10 +31,11 @@ public:
|
||||
LineVertexBuffer &vertexBuffer,
|
||||
TriangleElementsBuffer &triangleElementsBuffer,
|
||||
PointElementsBuffer &pointElementsBuffer);
|
||||
~LineBucket();
|
||||
~LineBucket() override;
|
||||
|
||||
virtual void render(Painter& painter, util::ptr<StyleLayer> layer_desc, const Tile::ID& id, const mat4 &matrix);
|
||||
virtual bool hasData() const;
|
||||
void render(Painter &painter, const StyleLayer &layer_desc, const Tile::ID &id,
|
||||
const mat4 &matrix) override;
|
||||
bool hasData() const override;
|
||||
|
||||
void addGeometry(pbf& data);
|
||||
void addGeometry(const std::vector<Coordinate>& line);
|
||||
|
||||
@@ -235,7 +235,9 @@ void Painter::render(const Style& style, const std::set<util::ptr<StyleSource>>&
|
||||
|
||||
// Actually render the layers
|
||||
if (debug::renderTree) { std::cout << "{" << std::endl; indent++; }
|
||||
renderLayers(style.layers);
|
||||
if (style.layers) {
|
||||
renderLayers(*style.layers);
|
||||
}
|
||||
if (debug::renderTree) { std::cout << "}" << std::endl; indent--; }
|
||||
|
||||
// Finalize the rendering, e.g. by calling debug render calls per tile.
|
||||
@@ -247,14 +249,9 @@ void Painter::render(const Style& style, const std::set<util::ptr<StyleSource>>&
|
||||
}
|
||||
}
|
||||
|
||||
void Painter::renderLayers(util::ptr<StyleLayerGroup> group) {
|
||||
if (!group) {
|
||||
// Make sure that we actually do have a layer group.
|
||||
return;
|
||||
}
|
||||
|
||||
void Painter::renderLayers(const StyleLayerGroup &group) {
|
||||
// TODO: Correctly compute the number of layers recursively beforehand.
|
||||
float strata_thickness = 1.0f / (group->layers.size() + 1);
|
||||
float strata_thickness = 1.0f / (group.layers.size() + 1);
|
||||
|
||||
// - FIRST PASS ------------------------------------------------------------
|
||||
// Render everything top-to-bottom by using reverse iterators. Render opaque
|
||||
@@ -264,10 +261,10 @@ void Painter::renderLayers(util::ptr<StyleLayerGroup> group) {
|
||||
std::cout << std::string(indent++ * 4, ' ') << "OPAQUE {" << std::endl;
|
||||
}
|
||||
int i = 0;
|
||||
for (auto it = group->layers.rbegin(), end = group->layers.rend(); it != end; ++it, ++i) {
|
||||
for (auto it = group.layers.rbegin(), end = group.layers.rend(); it != end; ++it, ++i) {
|
||||
setOpaque();
|
||||
setStrata(i * strata_thickness);
|
||||
renderLayer(*it);
|
||||
renderLayer(**it);
|
||||
}
|
||||
if (debug::renderTree) {
|
||||
std::cout << std::string(--indent * 4, ' ') << "}" << std::endl;
|
||||
@@ -280,40 +277,40 @@ void Painter::renderLayers(util::ptr<StyleLayerGroup> group) {
|
||||
std::cout << std::string(indent++ * 4, ' ') << "TRANSLUCENT {" << std::endl;
|
||||
}
|
||||
--i;
|
||||
for (auto it = group->layers.begin(), end = group->layers.end(); it != end; ++it, --i) {
|
||||
for (auto it = group.layers.begin(), end = group.layers.end(); it != end; ++it, --i) {
|
||||
setTranslucent();
|
||||
setStrata(i * strata_thickness);
|
||||
renderLayer(*it);
|
||||
renderLayer(**it);
|
||||
}
|
||||
if (debug::renderTree) {
|
||||
std::cout << std::string(--indent * 4, ' ') << "}" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void Painter::renderLayer(util::ptr<StyleLayer> layer_desc, const Tile::ID* id, const mat4* matrix) {
|
||||
if (layer_desc->bucket->visibility == VisibilityType::None) return;
|
||||
if (layer_desc->type == StyleLayerType::Background) {
|
||||
void Painter::renderLayer(const StyleLayer &layer_desc, const Tile::ID* id, const mat4* matrix) {
|
||||
if (layer_desc.bucket->visibility == VisibilityType::None) return;
|
||||
if (layer_desc.type == StyleLayerType::Background) {
|
||||
// This layer defines a background color/image.
|
||||
|
||||
if (debug::renderTree) {
|
||||
std::cout << std::string(indent * 4, ' ') << "- " << layer_desc->id << " ("
|
||||
<< layer_desc->type << ")" << std::endl;
|
||||
std::cout << std::string(indent * 4, ' ') << "- " << layer_desc.id << " ("
|
||||
<< layer_desc.type << ")" << std::endl;
|
||||
}
|
||||
|
||||
renderBackground(layer_desc);
|
||||
} else {
|
||||
// This is a singular layer.
|
||||
if (!layer_desc->bucket) {
|
||||
fprintf(stderr, "[WARNING] layer '%s' is missing bucket\n", layer_desc->id.c_str());
|
||||
if (!layer_desc.bucket) {
|
||||
fprintf(stderr, "[WARNING] layer '%s' is missing bucket\n", layer_desc.id.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!layer_desc->bucket->style_source) {
|
||||
fprintf(stderr, "[WARNING] can't find source for layer '%s'\n", layer_desc->id.c_str());
|
||||
if (!layer_desc.bucket->style_source) {
|
||||
fprintf(stderr, "[WARNING] can't find source for layer '%s'\n", layer_desc.id.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
StyleSource const& style_source = *layer_desc->bucket->style_source;
|
||||
StyleSource const& style_source = *layer_desc.bucket->style_source;
|
||||
|
||||
// Skip this layer if there is no data.
|
||||
if (!style_source.source) {
|
||||
@@ -324,36 +321,36 @@ void Painter::renderLayer(util::ptr<StyleLayer> layer_desc, const Tile::ID* id,
|
||||
// This may occur when there /is/ a bucket created for this layer, but the min/max-zoom
|
||||
// is set to a fractional value, or value that is larger than the source maxzoom.
|
||||
const double zoom = state.getZoom();
|
||||
if (layer_desc->bucket->min_zoom > zoom ||
|
||||
layer_desc->bucket->max_zoom <= zoom) {
|
||||
if (layer_desc.bucket->min_zoom > zoom ||
|
||||
layer_desc.bucket->max_zoom <= zoom) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Abort early if we can already deduce from the bucket type that
|
||||
// we're not going to render anything anyway during this pass.
|
||||
switch (layer_desc->type) {
|
||||
switch (layer_desc.type) {
|
||||
case StyleLayerType::Fill:
|
||||
if (!layer_desc->getProperties<FillProperties>().isVisible()) return;
|
||||
if (!layer_desc.getProperties<FillProperties>().isVisible()) return;
|
||||
break;
|
||||
case StyleLayerType::Line:
|
||||
if (pass == RenderPass::Opaque) return;
|
||||
if (!layer_desc->getProperties<LineProperties>().isVisible()) return;
|
||||
if (!layer_desc.getProperties<LineProperties>().isVisible()) return;
|
||||
break;
|
||||
case StyleLayerType::Symbol:
|
||||
if (pass == RenderPass::Opaque) return;
|
||||
if (!layer_desc->getProperties<SymbolProperties>().isVisible()) return;
|
||||
if (!layer_desc.getProperties<SymbolProperties>().isVisible()) return;
|
||||
break;
|
||||
case StyleLayerType::Raster:
|
||||
if (pass == RenderPass::Opaque) return;
|
||||
if (!layer_desc->getProperties<RasterProperties>().isVisible()) return;
|
||||
if (!layer_desc.getProperties<RasterProperties>().isVisible()) return;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (debug::renderTree) {
|
||||
std::cout << std::string(indent * 4, ' ') << "- " << layer_desc->id << " ("
|
||||
<< layer_desc->type << ")" << std::endl;
|
||||
std::cout << std::string(indent * 4, ' ') << "- " << layer_desc.id << " ("
|
||||
<< layer_desc.type << ")" << std::endl;
|
||||
}
|
||||
if (!id) {
|
||||
style_source.source->render(*this, layer_desc);
|
||||
@@ -363,17 +360,17 @@ void Painter::renderLayer(util::ptr<StyleLayer> layer_desc, const Tile::ID* id,
|
||||
}
|
||||
}
|
||||
|
||||
void Painter::renderTileLayer(const Tile& tile, util::ptr<StyleLayer> layer_desc, const mat4 &matrix) {
|
||||
void Painter::renderTileLayer(const Tile& tile, const StyleLayer &layer_desc, const mat4 &matrix) {
|
||||
assert(tile.data);
|
||||
if (tile.data->hasData(*layer_desc) || layer_desc->type == StyleLayerType::Raster) {
|
||||
if (tile.data->hasData(layer_desc) || layer_desc.type == StyleLayerType::Raster) {
|
||||
gl::group group(std::string { "render " } + tile.data->name);
|
||||
prepareTile(tile);
|
||||
tile.data->render(*this, layer_desc, matrix);
|
||||
}
|
||||
}
|
||||
|
||||
void Painter::renderBackground(util::ptr<StyleLayer> layer_desc) {
|
||||
const BackgroundProperties& properties = layer_desc->getProperties<BackgroundProperties>();
|
||||
void Painter::renderBackground(const StyleLayer &layer_desc) {
|
||||
const BackgroundProperties& properties = layer_desc.getProperties<BackgroundProperties>();
|
||||
|
||||
if (properties.image.to.size()) {
|
||||
if ((properties.opacity >= 1.0f) != (pass == RenderPass::Opaque))
|
||||
|
||||
@@ -81,11 +81,11 @@ public:
|
||||
TransformState state,
|
||||
std::chrono::steady_clock::time_point time);
|
||||
|
||||
void renderLayers(util::ptr<StyleLayerGroup> group);
|
||||
void renderLayer(util::ptr<StyleLayer> layer_desc, const Tile::ID* id = nullptr, const mat4* matrix = nullptr);
|
||||
void renderLayers(const StyleLayerGroup &group);
|
||||
void renderLayer(const StyleLayer &layer_desc, const Tile::ID* id = nullptr, const mat4* matrix = nullptr);
|
||||
|
||||
// Renders a particular layer from a tile.
|
||||
void renderTileLayer(const Tile& tile, util::ptr<StyleLayer> layer_desc, const mat4 &matrix);
|
||||
void renderTileLayer(const Tile& tile, const StyleLayer &layer_desc, const mat4 &matrix);
|
||||
|
||||
// Renders debug information for a tile.
|
||||
void renderTileDebug(const Tile& tile);
|
||||
@@ -95,11 +95,11 @@ public:
|
||||
|
||||
void renderDebugText(DebugBucket& bucket, const mat4 &matrix);
|
||||
void renderDebugText(const std::vector<std::string> &strings);
|
||||
void renderFill(FillBucket& bucket, util::ptr<StyleLayer> layer_desc, const Tile::ID& id, const mat4 &matrix);
|
||||
void renderLine(LineBucket& bucket, util::ptr<StyleLayer> layer_desc, const Tile::ID& id, const mat4 &matrix);
|
||||
void renderSymbol(SymbolBucket& bucket, util::ptr<StyleLayer> layer_desc, const Tile::ID& id, const mat4 &matrix);
|
||||
void renderRaster(RasterBucket& bucket, util::ptr<StyleLayer> layer_desc, const Tile::ID& id, const mat4 &matrix);
|
||||
void renderBackground(util::ptr<StyleLayer> layer_desc);
|
||||
void renderFill(FillBucket& bucket, const StyleLayer &layer_desc, const Tile::ID& id, const mat4 &matrix);
|
||||
void renderLine(LineBucket& bucket, const StyleLayer &layer_desc, const Tile::ID& id, const mat4 &matrix);
|
||||
void renderSymbol(SymbolBucket& bucket, const StyleLayer &layer_desc, const Tile::ID& id, const mat4 &matrix);
|
||||
void renderRaster(RasterBucket& bucket, const StyleLayer &layer_desc, const Tile::ID& id, const mat4 &matrix);
|
||||
void renderBackground(const StyleLayer &layer_desc);
|
||||
|
||||
float saturationFactor(float saturation);
|
||||
float contrastFactor(float contrast);
|
||||
@@ -109,7 +109,7 @@ public:
|
||||
|
||||
void renderPrerenderedTexture(RasterBucket &bucket, const mat4 &matrix, const RasterProperties& properties);
|
||||
|
||||
void createPrerendered(RasterBucket& bucket, util::ptr<StyleLayer> layer_desc, const Tile::ID& id);
|
||||
void createPrerendered(RasterBucket& bucket, const StyleLayer &layer_desc, const Tile::ID& id);
|
||||
|
||||
void resize();
|
||||
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
|
||||
using namespace mbgl;
|
||||
|
||||
void Painter::renderFill(FillBucket& bucket, util::ptr<StyleLayer> layer_desc, const Tile::ID& id, const mat4 &matrix) {
|
||||
void Painter::renderFill(FillBucket& bucket, const StyleLayer &layer_desc, const Tile::ID& id, const mat4 &matrix) {
|
||||
// Abort early.
|
||||
if (!bucket.hasData()) return;
|
||||
|
||||
const FillProperties &properties = layer_desc->getProperties<FillProperties>();
|
||||
const FillProperties &properties = layer_desc.getProperties<FillProperties>();
|
||||
mat4 vtxMatrix = translatedMatrix(matrix, properties.translate, id, properties.translateAnchor);
|
||||
|
||||
Color fill_color = properties.fill_color;
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
|
||||
using namespace mbgl;
|
||||
|
||||
void Painter::renderLine(LineBucket& bucket, util::ptr<StyleLayer> layer_desc, const Tile::ID& id, const mat4 &matrix) {
|
||||
void Painter::renderLine(LineBucket& bucket, const StyleLayer &layer_desc, const Tile::ID& id, const mat4 &matrix) {
|
||||
// Abort early.
|
||||
if (pass == RenderPass::Opaque) return;
|
||||
if (!bucket.hasData()) return;
|
||||
|
||||
const auto &properties = layer_desc->getProperties<LineProperties>();
|
||||
const auto &properties = layer_desc.getProperties<LineProperties>();
|
||||
const auto &layout = *bucket.styleLayout;
|
||||
|
||||
// the distance over which the line edge fades out.
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
|
||||
using namespace mbgl;
|
||||
|
||||
void Painter::renderRaster(RasterBucket& bucket, util::ptr<StyleLayer> layer_desc, const Tile::ID&, const mat4 &matrix) {
|
||||
void Painter::renderRaster(RasterBucket& bucket, const StyleLayer &layer_desc, const Tile::ID&, const mat4 &matrix) {
|
||||
if (pass != RenderPass::Translucent) return;
|
||||
|
||||
const RasterProperties &properties = layer_desc->getProperties<RasterProperties>();
|
||||
const RasterProperties &properties = layer_desc.getProperties<RasterProperties>();
|
||||
|
||||
if (bucket.hasData()) {
|
||||
depthMask(false);
|
||||
|
||||
@@ -112,13 +112,13 @@ void Painter::renderSDF(SymbolBucket &bucket,
|
||||
}
|
||||
}
|
||||
|
||||
void Painter::renderSymbol(SymbolBucket &bucket, util::ptr<StyleLayer> layer_desc, const Tile::ID &id, const mat4 &matrix) {
|
||||
void Painter::renderSymbol(SymbolBucket &bucket, const StyleLayer &layer_desc, const Tile::ID &id, const mat4 &matrix) {
|
||||
// Abort early.
|
||||
if (pass == RenderPass::Opaque) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto &properties = layer_desc->getProperties<SymbolProperties>();
|
||||
const auto &properties = layer_desc.getProperties<SymbolProperties>();
|
||||
const auto &layout = *bucket.styleLayout;
|
||||
|
||||
MBGL_CHECK_ERROR(glDisable(GL_STENCIL_TEST));
|
||||
|
||||
@@ -8,7 +8,8 @@ RasterBucket::RasterBucket(TexturePool& texturePool, const StyleLayoutRaster& la
|
||||
raster(texturePool) {
|
||||
}
|
||||
|
||||
void RasterBucket::render(Painter &painter, util::ptr<StyleLayer> layer_desc, const Tile::ID &id, const mat4 &matrix) {
|
||||
void RasterBucket::render(Painter &painter, const StyleLayer &layer_desc, const Tile::ID &id,
|
||||
const mat4 &matrix) {
|
||||
painter.renderRaster(*this, layer_desc, id, matrix);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,9 @@ class RasterBucket : public Bucket {
|
||||
public:
|
||||
RasterBucket(TexturePool&, const StyleLayoutRaster&);
|
||||
|
||||
virtual void render(Painter& painter, util::ptr<StyleLayer> layer_desc, const Tile::ID& id, const mat4 &matrix);
|
||||
virtual bool hasData() const;
|
||||
void render(Painter &painter, const StyleLayer &layer_desc, const Tile::ID &id,
|
||||
const mat4 &matrix) override;
|
||||
bool hasData() const override;
|
||||
|
||||
bool setImage(const std::string &data);
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@ SymbolBucket::~SymbolBucket() {
|
||||
// Do not remove. header file only contains forward definitions to unique pointers.
|
||||
}
|
||||
|
||||
void SymbolBucket::render(Painter &painter, util::ptr<StyleLayer> layer_desc,
|
||||
const Tile::ID &id, const mat4 &matrix) {
|
||||
void SymbolBucket::render(Painter &painter, const StyleLayer &layer_desc, const Tile::ID &id,
|
||||
const mat4 &matrix) {
|
||||
painter.renderSymbol(*this, layer_desc, id, matrix);
|
||||
}
|
||||
|
||||
|
||||
@@ -56,12 +56,13 @@ class SymbolBucket : public Bucket {
|
||||
|
||||
public:
|
||||
SymbolBucket(std::unique_ptr<const StyleLayoutSymbol> styleLayout, Collision &collision);
|
||||
~SymbolBucket();
|
||||
~SymbolBucket() override;
|
||||
|
||||
virtual void render(Painter &painter, util::ptr<StyleLayer> layer_desc, const Tile::ID &id, const mat4 &matrix);
|
||||
virtual bool hasData() const;
|
||||
virtual bool hasTextData() const;
|
||||
virtual bool hasIconData() const;
|
||||
void render(Painter &painter, const StyleLayer &layer_desc, const Tile::ID &id,
|
||||
const mat4 &matrix) override;
|
||||
bool hasData() const override;
|
||||
bool hasTextData() const;
|
||||
bool hasIconData() const;
|
||||
|
||||
void addFeatures(const VectorTileLayer &layer, const FilterExpression &filter,
|
||||
const Tile::ID &id, SpriteAtlas &spriteAtlas, Sprite &sprite,
|
||||
|
||||
@@ -24,7 +24,7 @@ class StyleLayer {
|
||||
public:
|
||||
StyleLayer(const std::string &id, std::map<ClassID, ClassProperties> &&styles);
|
||||
|
||||
template <typename T> const T &getProperties() {
|
||||
template <typename T> const T &getProperties() const {
|
||||
if (properties.is<T>()) {
|
||||
return properties.get<T>();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user