summaryrefslogtreecommitdiff
path: root/src/mbgl/renderer/fill_bucket.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/renderer/fill_bucket.cpp')
-rw-r--r--src/mbgl/renderer/fill_bucket.cpp30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/mbgl/renderer/fill_bucket.cpp b/src/mbgl/renderer/fill_bucket.cpp
index b89e982057..64efafb108 100644
--- a/src/mbgl/renderer/fill_bucket.cpp
+++ b/src/mbgl/renderer/fill_bucket.cpp
@@ -1,8 +1,9 @@
#include <mbgl/renderer/fill_bucket.hpp>
-#include <mbgl/style/layers/fill_layer.hpp>
#include <mbgl/renderer/painter.hpp>
#include <mbgl/programs/fill_program.hpp>
-#include <mbgl/util/logging.hpp>
+#include <mbgl/style/bucket_parameters.hpp>
+#include <mbgl/style/layers/fill_layer.hpp>
+#include <mbgl/style/layers/fill_layer_impl.hpp>
#include <mapbox/earcut.hpp>
@@ -26,7 +27,17 @@ using namespace style;
struct GeometryTooLongException : std::exception {};
-void FillBucket::addGeometry(const GeometryCollection& geometry) {
+FillBucket::FillBucket(const BucketParameters& parameters, const std::vector<const Layer*>& layers) {
+ for (const auto& layer : layers) {
+ paintPropertyBinders.emplace(layer->getID(),
+ FillProgram::PaintPropertyBinders(
+ layer->as<FillLayer>()->impl->paint.evaluated,
+ parameters.tileID.overscaledZ));
+ }
+}
+
+void FillBucket::addFeature(const GeometryTileFeature& feature,
+ const GeometryCollection& geometry) {
for (auto& polygon : classifyRings(geometry)) {
// Optimize polygons with many interior rings for earcut tesselation.
limitHoles(polygon, 500);
@@ -55,11 +66,11 @@ void FillBucket::addGeometry(const GeometryCollection& geometry) {
assert(lineSegment.vertexLength <= std::numeric_limits<uint16_t>::max());
uint16_t lineIndex = lineSegment.vertexLength;
- vertices.emplace_back(FillAttributes::vertex(ring[0]));
+ vertices.emplace_back(FillProgram::layoutVertex(ring[0]));
lines.emplace_back(lineIndex + nVertices - 1, lineIndex);
for (uint32_t i = 1; i < nVertices; i++) {
- vertices.emplace_back(FillAttributes::vertex(ring[i]));
+ vertices.emplace_back(FillProgram::layoutVertex(ring[i]));
lines.emplace_back(lineIndex + i - 1, lineIndex + i);
}
@@ -89,6 +100,10 @@ void FillBucket::addGeometry(const GeometryCollection& geometry) {
triangleSegment.vertexLength += totalVertices;
triangleSegment.indexLength += nIndicies;
}
+
+ for (auto& pair : paintPropertyBinders) {
+ pair.second.populateVertexVectors(feature, vertices.vertexSize());
+ }
}
void FillBucket::upload(gl::Context& context) {
@@ -96,7 +111,10 @@ void FillBucket::upload(gl::Context& context) {
lineIndexBuffer = context.createIndexBuffer(std::move(lines));
triangleIndexBuffer = context.createIndexBuffer(std::move(triangles));
- // From now on, we're going to render during the opaque and translucent pass.
+ for (auto& pair : paintPropertyBinders) {
+ pair.second.upload(context);
+ }
+
uploaded = true;
}