Skip to content

Commit

Permalink
Merge pull request #38 from 2gis/fix_depth_msaa
Browse files Browse the repository at this point in the history
TILES-6869 fix depth msaa
  • Loading branch information
Kuznecoff authored Oct 11, 2024
2 parents 70ffb67 + 2c3c0b8 commit 36e5142
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 14 deletions.
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

0 comments on commit 36e5142

Please sign in to comment.