Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set depthMode for 2d custom layers #7432

Merged
merged 4 commits into from
Oct 17, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/render/draw_custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import type CustomStyleLayer from '../style/style_layer/custom_style_layer';
function drawCustom(painter: Painter, sourceCache: SourceCache, layer: CustomStyleLayer) {

const context = painter.context;
const gl = context.gl;
const implementation = layer.implementation;

if (painter.renderPass === 'offscreen') {
Expand Down Expand Up @@ -46,7 +47,9 @@ function drawCustom(painter: Painter, sourceCache: SourceCache, layer: CustomSty
painter.setCustomLayerDefaults();

context.setStencilMode(StencilMode.disabled);
context.setDepthMode(DepthMode.disabled);

const depthMode = painter.depthModeForSublayer(0, DepthMode.ReadWrite, gl.LESS);
markusjohnsson marked this conversation as resolved.
Show resolved Hide resolved
context.setDepthMode(depthMode);

implementation.render(context.gl, painter.transform.customLayerMatrix());

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
66 changes: 66 additions & 0 deletions test/integration/render-tests/custom-layer-js/depth/style.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"version": 8,
"metadata": {
"test": {
"width": 64,
"height": 64,
"operations": [
[
"addCustomLayer",
"null-island",
"fill"
]
]
}
},
"sources": {
"geojson": {
"type": "geojson",
"data": {
"type": "Polygon",
"coordinates": [
[
[
-20,
-10
],
[
-20,
10
],
[
0,
10
],
[
0,
-10
],
[
-20,
-10
]
]
]
}
}
},
"layers": [
{
"id": "background",
"type": "background",
"paint": {
"background-color": "rgba(0,255,0, 1)"
}
},
{
"id": "fill",
"type": "fill",
"source": "geojson",
"paint": {
"fill-antialias": false,
"fill-color": "rgba(235, 235,235, 1)"
}
}
]
}