diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-07-18 15:50:37 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-07-19 09:31:07 -0700 |
commit | 8c908b33d7ccb34401854d4370cb61f522ad7866 (patch) | |
tree | bb4f51a75e1f88461b27bc7187a522d0e56ce2cc /src/mbgl/renderer/layers | |
parent | ac58130d3626efec8021c7408f5bc69a9e36d133 (diff) | |
download | qtlocation-mapboxgl-8c908b33d7ccb34401854d4370cb61f522ad7866.tar.gz |
[core] Move extrusion rendering to RenderFillExtrusionLayer
Diffstat (limited to 'src/mbgl/renderer/layers')
-rw-r--r-- | src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp index f33a039981..e06c43c112 100644 --- a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp +++ b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp @@ -49,6 +49,18 @@ void RenderFillExtrusionLayer::render(Painter& painter, PaintParameters& paramet return; } + const auto size = painter.context.viewport.getCurrentValue().size; + + if (!painter.extrusionTexture || painter.extrusionTexture->getSize() != size) { + painter.extrusionTexture = OffscreenTexture(painter.context, size, OffscreenTextureAttachment::Depth); + } + + painter.extrusionTexture->bind(); + + painter.context.setStencilMode(gl::StencilMode::disabled()); + painter.context.setDepthMode(painter.depthModeForSublayer(0, gl::DepthMode::ReadWrite)); + painter.context.clear(Color{ 0.0f, 0.0f, 0.0f, 0.0f }, 1.0f, {}); + if (evaluated.get<FillExtrusionPattern>().from.empty()) { for (const RenderTile& tile : renderTiles) { assert(dynamic_cast<FillExtrusionBucket*>(tile.tile.getBucket(*baseImpl))); @@ -117,6 +129,33 @@ void RenderFillExtrusionLayer::render(Painter& painter, PaintParameters& paramet getID()); } } + + parameters.view.bind(); + painter.context.bindTexture(painter.extrusionTexture->getTexture()); + + mat4 viewportMat; + matrix::ortho(viewportMat, 0, size.width, size.height, 0, 0, 1); + + const Properties<>::PossiblyEvaluated properties; + + parameters.programs.extrusionTexture.draw( + painter.context, + gl::Triangles(), + gl::DepthMode::disabled(), + gl::StencilMode::disabled(), + painter.colorModeForRenderPass(), + ExtrusionTextureProgram::UniformValues{ + uniforms::u_matrix::Value{ viewportMat }, uniforms::u_world::Value{ size }, + uniforms::u_image::Value{ 0 }, + uniforms::u_opacity::Value{ evaluated.get<FillExtrusionOpacity>() } + }, + painter.extrusionTextureVertexBuffer, + painter.quadTriangleIndexBuffer, + painter.extrusionTextureSegments, + ExtrusionTextureProgram::PaintPropertyBinders{ properties, 0 }, + properties, + painter.state.getZoom(), + getID()); } bool RenderFillExtrusionLayer::queryIntersectsFeature( |