summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake/core-files.cmake1
-rw-r--r--src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp85
-rw-r--r--src/mbgl/renderer/painter.hpp3
-rw-r--r--src/mbgl/renderer/painters/painter_fill_extrusion.cpp88
4 files changed, 77 insertions, 100 deletions
diff --git a/cmake/core-files.cmake b/cmake/core-files.cmake
index 0394663d51..b2e615e17a 100644
--- a/cmake/core-files.cmake
+++ b/cmake/core-files.cmake
@@ -247,7 +247,6 @@ set(MBGL_CORE_FILES
# renderer/painters
src/mbgl/renderer/painters/painter_clipping.cpp
src/mbgl/renderer/painters/painter_debug.cpp
- src/mbgl/renderer/painters/painter_fill_extrusion.cpp
src/mbgl/renderer/painters/painter_line.cpp
src/mbgl/renderer/painters/painter_raster.cpp
src/mbgl/renderer/painters/painter_symbol.cpp
diff --git a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp
index 4a28b3b752..f33a039981 100644
--- a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp
+++ b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp
@@ -2,6 +2,10 @@
#include <mbgl/renderer/buckets/fill_extrusion_bucket.hpp>
#include <mbgl/renderer/painter.hpp>
#include <mbgl/renderer/render_tile.hpp>
+#include <mbgl/renderer/paint_parameters.hpp>
+#include <mbgl/renderer/image_manager.hpp>
+#include <mbgl/programs/programs.hpp>
+#include <mbgl/programs/fill_extrusion_program.hpp>
#include <mbgl/tile/tile.hpp>
#include <mbgl/style/layers/fill_extrusion_layer_impl.hpp>
#include <mbgl/geometry/feature_index.hpp>
@@ -10,6 +14,8 @@
namespace mbgl {
+using namespace style;
+
RenderFillExtrusionLayer::RenderFillExtrusionLayer(Immutable<style::FillExtrusionLayer::Impl> _impl)
: RenderLayer(style::LayerType::FillExtrusion, _impl),
unevaluated(impl().paint.untransitioned()) {
@@ -39,14 +45,77 @@ bool RenderFillExtrusionLayer::hasTransition() const {
}
void RenderFillExtrusionLayer::render(Painter& painter, PaintParameters& parameters, RenderSource*) {
- for (const RenderTile& tile : renderTiles) {
- Bucket* bucket = tile.tile.getBucket(*baseImpl);
- assert(dynamic_cast<FillExtrusionBucket*>(bucket));
- painter.renderFillExtrusion(
- parameters,
- *reinterpret_cast<FillExtrusionBucket*>(bucket),
- *this,
- tile);
+ if (painter.pass == RenderPass::Opaque) {
+ return;
+ }
+
+ if (evaluated.get<FillExtrusionPattern>().from.empty()) {
+ for (const RenderTile& tile : renderTiles) {
+ assert(dynamic_cast<FillExtrusionBucket*>(tile.tile.getBucket(*baseImpl)));
+ FillExtrusionBucket& bucket = *reinterpret_cast<FillExtrusionBucket*>(tile.tile.getBucket(*baseImpl));
+
+ parameters.programs.fillExtrusion.get(evaluated).draw(
+ painter.context,
+ gl::Triangles(),
+ painter.depthModeForSublayer(0, gl::DepthMode::ReadWrite),
+ gl::StencilMode::disabled(),
+ painter.colorModeForRenderPass(),
+ FillExtrusionUniforms::values(
+ tile.translatedClipMatrix(evaluated.get<FillExtrusionTranslate>(),
+ evaluated.get<FillExtrusionTranslateAnchor>(),
+ painter.state),
+ painter.state,
+ painter.evaluatedLight
+ ),
+ *bucket.vertexBuffer,
+ *bucket.indexBuffer,
+ bucket.triangleSegments,
+ bucket.paintPropertyBinders.at(getID()),
+ evaluated,
+ painter.state.getZoom(),
+ getID());
+ }
+ } else {
+ optional<ImagePosition> imagePosA = painter.imageManager->getPattern(evaluated.get<FillExtrusionPattern>().from);
+ optional<ImagePosition> imagePosB = painter.imageManager->getPattern(evaluated.get<FillExtrusionPattern>().to);
+
+ if (!imagePosA || !imagePosB) {
+ return;
+ }
+
+ painter.imageManager->bind(painter.context, 0);
+
+ for (const RenderTile& tile : renderTiles) {
+ assert(dynamic_cast<FillExtrusionBucket*>(tile.tile.getBucket(*baseImpl)));
+ FillExtrusionBucket& bucket = *reinterpret_cast<FillExtrusionBucket*>(tile.tile.getBucket(*baseImpl));
+
+ parameters.programs.fillExtrusionPattern.get(evaluated).draw(
+ painter.context,
+ gl::Triangles(),
+ painter.depthModeForSublayer(0, gl::DepthMode::ReadWrite),
+ gl::StencilMode::disabled(),
+ painter.colorModeForRenderPass(),
+ FillExtrusionPatternUniforms::values(
+ tile.translatedClipMatrix(evaluated.get<FillExtrusionTranslate>(),
+ evaluated.get<FillExtrusionTranslateAnchor>(),
+ painter.state),
+ painter.imageManager->getPixelSize(),
+ *imagePosA,
+ *imagePosB,
+ evaluated.get<FillExtrusionPattern>(),
+ tile.id,
+ painter.state,
+ -std::pow(2, tile.id.canonical.z) / util::tileSize / 8.0f,
+ painter.evaluatedLight
+ ),
+ *bucket.vertexBuffer,
+ *bucket.indexBuffer,
+ bucket.triangleSegments,
+ bucket.paintPropertyBinders.at(getID()),
+ evaluated,
+ painter.state.getZoom(),
+ getID());
+ }
}
}
diff --git a/src/mbgl/renderer/painter.hpp b/src/mbgl/renderer/painter.hpp
index aef315ba22..9b90b37fa3 100644
--- a/src/mbgl/renderer/painter.hpp
+++ b/src/mbgl/renderer/painter.hpp
@@ -39,12 +39,10 @@ struct FrameData;
class Tile;
class DebugBucket;
-class FillExtrusionBucket;
class LineBucket;
class SymbolBucket;
class RasterBucket;
-class RenderFillExtrusionLayer;
class RenderLineLayer;
class RenderSymbolLayer;
class RenderRasterLayer;
@@ -77,7 +75,6 @@ public:
void renderClippingMask(const UnwrappedTileID&, const ClipID&);
void renderTileDebug(const RenderTile&);
void renderTileDebug(const mat4& matrix);
- void renderFillExtrusion(PaintParameters&, FillExtrusionBucket&, const RenderFillExtrusionLayer&, const RenderTile&);
void renderLine(PaintParameters&, LineBucket&, const RenderLineLayer&, const RenderTile&);
void renderSymbol(PaintParameters&, SymbolBucket&, const RenderSymbolLayer&, const RenderTile&);
void renderRaster(PaintParameters&, RasterBucket&, const RenderRasterLayer&, const mat4&, bool useBucketBuffers /* = false */);
diff --git a/src/mbgl/renderer/painters/painter_fill_extrusion.cpp b/src/mbgl/renderer/painters/painter_fill_extrusion.cpp
deleted file mode 100644
index d7310dc208..0000000000
--- a/src/mbgl/renderer/painters/painter_fill_extrusion.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-#include <mbgl/renderer/painter.hpp>
-#include <mbgl/renderer/paint_parameters.hpp>
-#include <mbgl/renderer/buckets/fill_extrusion_bucket.hpp>
-#include <mbgl/renderer/render_tile.hpp>
-#include <mbgl/renderer/layers/render_fill_extrusion_layer.hpp>
-#include <mbgl/renderer/image_manager.hpp>
-#include <mbgl/style/layers/fill_extrusion_layer_impl.hpp>
-#include <mbgl/programs/programs.hpp>
-#include <mbgl/programs/fill_extrusion_program.hpp>
-#include <mbgl/util/constants.hpp>
-#include <mbgl/util/convert.hpp>
-
-namespace mbgl {
-
-using namespace style;
-
-void Painter::renderFillExtrusion(PaintParameters& parameters,
- FillExtrusionBucket& bucket,
- const RenderFillExtrusionLayer& layer,
- const RenderTile& tile) {
- const FillExtrusionPaintProperties::PossiblyEvaluated& properties = layer.evaluated;
-
- if (pass == RenderPass::Opaque) {
- return;
- }
-
- if (!properties.get<FillExtrusionPattern>().from.empty()) {
- optional<ImagePosition> imagePosA = imageManager->getPattern(properties.get<FillExtrusionPattern>().from);
- optional<ImagePosition> imagePosB = imageManager->getPattern(properties.get<FillExtrusionPattern>().to);
-
- if (!imagePosA || !imagePosB) {
- return;
- }
-
- imageManager->bind(context, 0);
-
- parameters.programs.fillExtrusionPattern.get(properties).draw(
- context,
- gl::Triangles(),
- depthModeForSublayer(0, gl::DepthMode::ReadWrite),
- gl::StencilMode::disabled(),
- colorModeForRenderPass(),
- FillExtrusionPatternUniforms::values(
- tile.translatedClipMatrix(properties.get<FillExtrusionTranslate>(),
- properties.get<FillExtrusionTranslateAnchor>(),
- state),
- imageManager->getPixelSize(),
- *imagePosA,
- *imagePosB,
- properties.get<FillExtrusionPattern>(),
- tile.id,
- state,
- -std::pow(2, tile.id.canonical.z) / util::tileSize / 8.0f,
- evaluatedLight
- ),
- *bucket.vertexBuffer,
- *bucket.indexBuffer,
- bucket.triangleSegments,
- bucket.paintPropertyBinders.at(layer.getID()),
- properties,
- state.getZoom(),
- layer.getID());
-
- } else {
- parameters.programs.fillExtrusion.get(properties).draw(
- context,
- gl::Triangles(),
- depthModeForSublayer(0, gl::DepthMode::ReadWrite),
- gl::StencilMode::disabled(),
- colorModeForRenderPass(),
- FillExtrusionUniforms::values(
- tile.translatedClipMatrix(properties.get<FillExtrusionTranslate>(),
- properties.get<FillExtrusionTranslateAnchor>(),
- state),
- state,
- evaluatedLight
- ),
- *bucket.vertexBuffer,
- *bucket.indexBuffer,
- bucket.triangleSegments,
- bucket.paintPropertyBinders.at(layer.getID()),
- properties,
- state.getZoom(),
- layer.getID());
- };
-}
-
-} // namespace mbgl