clip fill antialiasing with depth buffer to avoid overlapping
https://github.com/mapbox/mapbox-gl-native/pull/381
This commit is contained in:
committed by
John Firebaugh
parent
96f6b79251
commit
31a3d3603c
@@ -87,6 +87,9 @@ void Painter::setup() {
|
||||
// Stencil test
|
||||
MBGL_CHECK_ERROR(glEnable(GL_STENCIL_TEST));
|
||||
MBGL_CHECK_ERROR(glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE));
|
||||
|
||||
// Depth test
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
}
|
||||
|
||||
void Painter::setupShaders() {
|
||||
@@ -193,7 +196,6 @@ void Painter::setOpaque() {
|
||||
if (pass != RenderPass::Opaque) {
|
||||
pass = RenderPass::Opaque;
|
||||
MBGL_CHECK_ERROR(glDisable(GL_BLEND));
|
||||
depthMask(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,7 +203,6 @@ void Painter::setTranslucent() {
|
||||
if (pass != RenderPass::Translucent) {
|
||||
pass = RenderPass::Translucent;
|
||||
MBGL_CHECK_ERROR(glEnable(GL_BLEND));
|
||||
depthMask(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ void Painter::renderFill(FillBucket& bucket, const StyleLayer &layer_desc, const
|
||||
if (pattern) {
|
||||
// Image fill.
|
||||
if (pass == RenderPass::Translucent) {
|
||||
|
||||
const SpriteAtlasPosition posA = spriteAtlas.getPosition(properties.image.from, true);
|
||||
const SpriteAtlasPosition posB = spriteAtlas.getPosition(properties.image.to, true);
|
||||
float factor = 8.0 / std::pow(2, state.getIntegerZoom() - id.z);
|
||||
@@ -91,6 +92,7 @@ void Painter::renderFill(FillBucket& bucket, const StyleLayer &layer_desc, const
|
||||
spriteAtlas.bind(true);
|
||||
|
||||
// Draw the actual triangles into the color & stencil buffer.
|
||||
depthMask(true);
|
||||
depthRange(strata, 1.0f);
|
||||
bucket.drawElements(*patternShader);
|
||||
}
|
||||
@@ -107,6 +109,7 @@ void Painter::renderFill(FillBucket& bucket, const StyleLayer &layer_desc, const
|
||||
plainShader->u_color = fill_color;
|
||||
|
||||
// Draw the actual triangles into the color & stencil buffer.
|
||||
depthMask(true);
|
||||
depthRange(strata + strata_epsilon, 1.0f);
|
||||
bucket.drawElements(*plainShader);
|
||||
}
|
||||
@@ -127,7 +130,7 @@ void Painter::renderFill(FillBucket& bucket, const StyleLayer &layer_desc, const
|
||||
static_cast<float>(state.getFramebufferHeight())
|
||||
}};
|
||||
|
||||
depthRange(strata + strata_epsilon, 1.0f);
|
||||
depthRange(strata + strata_epsilon + strata_epsilon, 1.0f);
|
||||
bucket.drawVertices(*outlineShader);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@ void Painter::renderLine(LineBucket& bucket, const StyleLayer &layer_desc, const
|
||||
if (pass == RenderPass::Opaque) return;
|
||||
if (!bucket.hasData()) return;
|
||||
|
||||
depthMask(false);
|
||||
|
||||
const auto &properties = layer_desc.getProperties<LineProperties>();
|
||||
const auto &layout = *bucket.styleLayout;
|
||||
|
||||
|
||||
@@ -122,6 +122,7 @@ void Painter::renderSymbol(SymbolBucket &bucket, const StyleLayer &layer_desc, c
|
||||
const auto &layout = *bucket.styleLayout;
|
||||
|
||||
MBGL_CHECK_ERROR(glDisable(GL_STENCIL_TEST));
|
||||
depthMask(false);
|
||||
|
||||
if (bucket.hasIconData()) {
|
||||
bool sdf = bucket.sdfIcons;
|
||||
|
||||
Reference in New Issue
Block a user