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

TILES-6869 fix depth msaa #38

Merged
merged 2 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
18 changes: 18 additions & 0 deletions demo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,23 @@ map.once('idle', () => {
initDeckGL();
});

const buildingLayer = {
id: 'house private',
name: 'Частные дома',
type: 'polygonExtrusion',
style: {
topColor: '#00ff00',
sideColor: 'rgba(255,62,54,0.82)',
},
filter: ['match', ['get', 'sublayer'], ['Technical_house'], true, false],
minzoom: 16,
metadata: {
group: {
id: '746776',
},
},
};

function initDeckGL() {
const deckLayer1 = createHeatmapLayer(data);
map.addLayer(deckLayer1);
Expand All @@ -32,6 +49,7 @@ function initDeckGL() {
map.addLayer(deckLayer4);
map.removeLayer('deckgl-HexagonLayer');
map.addLayer(deckLayer2);
map.addLayer(buildingLayer);
}

const COLOR_RANGE: Color[] = [
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@2gis/deck2gis-layer",
"version": "2.0.8",
"version": "2.0.9",
"description": "",
"main": "dist/deck2gislayer.js",
"typings": "dist/types/index.d.ts",
Expand Down
4 changes: 4 additions & 0 deletions src/deckgl2gisLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,11 @@ export class Deck2gisLayer<LayerT extends Layer> implements DeckCustomLayer {

this.programmBinder();

const prevDepthMask = gl.getParameter(gl.DEPTH_WRITEMASK);
gl.depthMask(false);
gl.drawArrays(gl.TRIANGLES, 0, 6);
gl.depthMask(prevDepthMask);

(this.props.deck as any).glStateStore.useMapglWebglState();
};

Expand Down
11 changes: 0 additions & 11 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ export function drawLayer(deck: Deck, map: Map, layer: Deck2gisLayer<any>): bool
if (!isIncludeLayer(deck, layer)) {
return false;
}
stateBinder(map.getWebGLContext());

deck._drawLayers('2gis-repaint', {
viewports: [currentViewport],
Expand Down Expand Up @@ -486,16 +485,6 @@ function initDeck2gisProps(map: Map, deckProps?: CustomRenderProps): DeckProps {
return deck2gisProps;
}

// Fix heatmap layer render: need reset gl state after each draw layers
/**
* @hidden
* @internal
*/
function stateBinder(gl: WebGLRenderingContext | WebGL2RenderingContext) {
gl.clearDepth(1);
gl.clear(gl.DEPTH_BUFFER_BIT);
}

/**
* @hidden
* @internal
Expand Down
Loading