From 1520d3e3d53ce5199c59770f5c261be72ebdc422 Mon Sep 17 00:00:00 2001 From: Andrey Kuznecov Date: Sun, 6 Oct 2024 22:11:24 +0700 Subject: [PATCH 1/2] fix depth msaa --- demo/index.ts | 18 ++++++++++++++++++ package-lock.json | 4 ++-- package.json | 2 +- src/deckgl2gisLayer.ts | 3 +++ src/utils.ts | 11 ----------- 5 files changed, 24 insertions(+), 14 deletions(-) diff --git a/demo/index.ts b/demo/index.ts index 71af703..dc5bebd 100644 --- a/demo/index.ts +++ b/demo/index.ts @@ -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); @@ -32,6 +49,7 @@ function initDeckGL() { map.addLayer(deckLayer4); map.removeLayer('deckgl-HexagonLayer'); map.addLayer(deckLayer2); + map.addLayer(buildingLayer); } const COLOR_RANGE: Color[] = [ diff --git a/package-lock.json b/package-lock.json index f971575..427fae1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@2gis/deck2gis-layer", - "version": "2.0.8", + "version": "2.0.9", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@2gis/deck2gis-layer", - "version": "2.0.8", + "version": "2.0.9", "license": "BSD-2-Clause", "dependencies": { "@2gis/gl-matrix": "^2.4.6", diff --git a/package.json b/package.json index 3a9c1e1..f8fc036 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/deckgl2gisLayer.ts b/src/deckgl2gisLayer.ts index c8960b5..8b7374c 100644 --- a/src/deckgl2gisLayer.ts +++ b/src/deckgl2gisLayer.ts @@ -218,7 +218,10 @@ export class Deck2gisLayer implements DeckCustomLayer { this.programmBinder(); + gl.depthMask(false); gl.drawArrays(gl.TRIANGLES, 0, 6); + gl.depthMask(true); + (this.props.deck as any).glStateStore.useMapglWebglState(); }; diff --git a/src/utils.ts b/src/utils.ts index cb32c7a..462d213 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -123,7 +123,6 @@ export function drawLayer(deck: Deck, map: Map, layer: Deck2gisLayer): bool if (!isIncludeLayer(deck, layer)) { return false; } - stateBinder(map.getWebGLContext()); deck._drawLayers('2gis-repaint', { viewports: [currentViewport], @@ -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 From 2c3c0b8db86528822caee349ad77c010e0c20df5 Mon Sep 17 00:00:00 2001 From: Andrey Kuznecov Date: Fri, 11 Oct 2024 13:45:08 +0700 Subject: [PATCH 2/2] f --- src/deckgl2gisLayer.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/deckgl2gisLayer.ts b/src/deckgl2gisLayer.ts index 8b7374c..24d488d 100644 --- a/src/deckgl2gisLayer.ts +++ b/src/deckgl2gisLayer.ts @@ -218,9 +218,10 @@ export class Deck2gisLayer implements DeckCustomLayer { this.programmBinder(); + const prevDepthMask = gl.getParameter(gl.DEPTH_WRITEMASK); gl.depthMask(false); gl.drawArrays(gl.TRIANGLES, 0, 6); - gl.depthMask(true); + gl.depthMask(prevDepthMask); (this.props.deck as any).glStateStore.useMapglWebglState(); };