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

[v9] MapboxLayer #8442

Merged
merged 5 commits into from Jan 23, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/website/safegraph/app.js
Expand Up @@ -23,6 +23,7 @@ const colorScale = scaleLog()
export function renderToDOM(container, data) {
const map = new mapboxgl.Map({
container,
useWebGL2: true,
felixpalmer marked this conversation as resolved.
Show resolved Hide resolved
style: 'mapbox://styles/mapbox/light-v9',
antialias: true,
center: [-122.4034, 37.7845],
Expand Down Expand Up @@ -130,5 +131,5 @@ export async function loadAndRender(container) {
'https://raw.githubusercontent.com/visgl/deck.gl-data/master/examples/safegraph/sf-pois.csv',
CSVLoader
);
renderToDOM(container, data);
renderToDOM(container, data.data);
}
4 changes: 2 additions & 2 deletions examples/website/safegraph/index.html
Expand Up @@ -23,7 +23,7 @@
<div id="app"></div>
</body>
<script type="module">
import {renderToDOM} from './app.js';
renderToDOM(document.getElementById('app'));
import {loadAndRender} from './app.js';
loadAndRender(document.getElementById('app'));
</script>
</html>
4 changes: 2 additions & 2 deletions examples/website/safegraph/package.json
Expand Up @@ -11,8 +11,8 @@
"dependencies": {
"@loaders.gl/csv": "4.1.0-alpha.9",
"d3-scale": "^2.0.0",
"deck.gl": "^8.8.0",
"mapbox-gl": "^1.13.0"
"deck.gl": "^9.0.0-alpha",
felixpalmer marked this conversation as resolved.
Show resolved Hide resolved
"mapbox-gl": "^2.0.0"
},
"devDependencies": {
"typescript": "^4.6.0",
Expand Down
10 changes: 5 additions & 5 deletions modules/aggregation-layers/package.json
Expand Up @@ -32,17 +32,17 @@
},
"dependencies": {
"@babel/runtime": "^7.0.0",
"@luma.gl/constants": "9.0.0-alpha.54",
"@luma.gl/core": "9.0.0-alpha.54",
"@luma.gl/shadertools": "9.0.0-alpha.54",
"@luma.gl/constants": "9.0.0-beta.1",
"@luma.gl/core": "9.0.0-beta.1",
"@luma.gl/shadertools": "9.0.0-beta.1",
"@math.gl/web-mercator": "^4.0.0",
"d3-hexbin": "^0.2.1"
},
"peerDependencies": {
"@deck.gl/core": "^9.0.0-alpha",
"@deck.gl/layers": "^9.0.0-alpha",
"@luma.gl/core": "9.0.0-alpha.54",
"@luma.gl/engine": "9.0.0-alpha.54"
"@luma.gl/core": "9.0.0-beta.1",
"@luma.gl/engine": "9.0.0-beta.1"
},
"gitHead": "13ace64fc2cee08c133afc882fc307253489a4e4"
}
4 changes: 2 additions & 2 deletions modules/arcgis/package.json
Expand Up @@ -32,8 +32,8 @@
"peerDependencies": {
"@arcgis/core": "^4.0.0",
"@deck.gl/core": "^9.0.0-alpha",
"@luma.gl/core": "9.0.0-alpha.54",
"@luma.gl/engine": "9.0.0-alpha.54"
"@luma.gl/core": "9.0.0-beta.1",
"@luma.gl/engine": "9.0.0-beta.1"
},
"dependencies": {
"@babel/runtime": "^7.0.0",
Expand Down
4 changes: 2 additions & 2 deletions modules/carto/package.json
Expand Up @@ -40,8 +40,8 @@
"@loaders.gl/loader-utils": "4.1.0-alpha.9",
"@loaders.gl/mvt": "4.1.0-alpha.9",
"@loaders.gl/tiles": "4.1.0-alpha.9",
"@luma.gl/constants": "9.0.0-alpha.54",
"@luma.gl/core": "9.0.0-alpha.54",
"@luma.gl/constants": "9.0.0-beta.1",
"@luma.gl/core": "9.0.0-beta.1",
"@math.gl/web-mercator": "^4.0.0",
"cartocolor": "^4.0.2",
"d3-array": "^3.2.0",
Expand Down
10 changes: 5 additions & 5 deletions modules/core/package.json
Expand Up @@ -36,11 +36,11 @@
"@babel/runtime": "^7.0.0",
"@loaders.gl/core": "4.1.0-alpha.9",
"@loaders.gl/images": "4.1.0-alpha.9",
"@luma.gl/constants": "9.0.0-alpha.54",
"@luma.gl/core": "9.0.0-alpha.54",
"@luma.gl/engine": "9.0.0-alpha.54",
"@luma.gl/shadertools": "9.0.0-alpha.54",
"@luma.gl/webgl": "9.0.0-alpha.54",
"@luma.gl/constants": "9.0.0-beta.1",
"@luma.gl/core": "9.0.0-beta.1",
"@luma.gl/engine": "9.0.0-beta.1",
"@luma.gl/shadertools": "9.0.0-beta.1",
"@luma.gl/webgl": "9.0.0-beta.1",
"@math.gl/core": "^4.0.0",
"@math.gl/sun": "^4.0.0",
"@math.gl/web-mercator": "^4.0.0",
Expand Down
1 change: 0 additions & 1 deletion modules/core/src/passes/screen-pass.ts
Expand Up @@ -60,7 +60,6 @@ export default class ScreenPass extends Pass {
protected _renderPass(device: Device, options: ScreenPassRenderOptions) {
const {inputBuffer} = options;
clear(this.device, {color: true});
// @ts-expect-error TODO(v9): Resolve errors.
this.model.setShaderModuleProps(options.moduleSettings);
this.model.setBindings({
texture: inputBuffer.colorAttachments[0]
Expand Down
12 changes: 6 additions & 6 deletions modules/extensions/package.json
Expand Up @@ -32,15 +32,15 @@
},
"dependencies": {
"@babel/runtime": "^7.0.0",
"@luma.gl/shadertools": "9.0.0-alpha.54"
"@luma.gl/shadertools": "9.0.0-beta.1"
},
"peerDependencies": {
"@deck.gl/core": "^9.0.0-alpha",
"@luma.gl/constants": "9.0.0-alpha.54",
"@luma.gl/core": "9.0.0-alpha.54",
"@luma.gl/engine": "9.0.0-alpha.54",
"@luma.gl/shadertools": "9.0.0-alpha.54",
"@luma.gl/webgl": "9.0.0-alpha.54",
"@luma.gl/constants": "9.0.0-beta.1",
"@luma.gl/core": "9.0.0-beta.1",
"@luma.gl/engine": "9.0.0-beta.1",
"@luma.gl/shadertools": "9.0.0-beta.1",
"@luma.gl/webgl": "9.0.0-beta.1",
"@math.gl/core": "^4.0.0",
"@math.gl/web-mercator": "^4.0.0"
},
Expand Down
6 changes: 3 additions & 3 deletions modules/geo-layers/package.json
Expand Up @@ -40,7 +40,7 @@
"@loaders.gl/terrain": "4.1.0-alpha.9",
"@loaders.gl/tiles": "4.1.0-alpha.9",
"@loaders.gl/wms": "4.1.0-alpha.9",
"@luma.gl/core": "9.0.0-alpha.54",
"@luma.gl/core": "9.0.0-beta.1",
"@math.gl/core": "^4.0.0",
"@math.gl/culling": "^4.0.0",
"@math.gl/web-mercator": "^4.0.0",
Expand All @@ -54,8 +54,8 @@
"@deck.gl/layers": "^9.0.0-alpha",
"@deck.gl/mesh-layers": "^9.0.0-alpha",
"@loaders.gl/core": "4.1.0-alpha.9",
"@luma.gl/core": "9.0.0-alpha.54",
"@luma.gl/shadertools": "9.0.0-alpha.54"
"@luma.gl/core": "9.0.0-beta.1",
"@luma.gl/shadertools": "9.0.0-beta.1"
},
"gitHead": "13ace64fc2cee08c133afc882fc307253489a4e4"
}
8 changes: 4 additions & 4 deletions modules/google-maps/package.json
Expand Up @@ -38,10 +38,10 @@
},
"peerDependencies": {
"@deck.gl/core": "^9.0.0-alpha",
"@luma.gl/constants": "9.0.0-alpha.54",
"@luma.gl/core": "9.0.0-alpha.54",
"@luma.gl/engine": "9.0.0-alpha.54",
"@luma.gl/webgl": "9.0.0-alpha.54",
"@luma.gl/constants": "9.0.0-beta.1",
"@luma.gl/core": "9.0.0-beta.1",
"@luma.gl/engine": "9.0.0-beta.1",
"@luma.gl/webgl": "9.0.0-beta.1",
"@math.gl/core": "^4.0.0"
},
"gitHead": "13ace64fc2cee08c133afc882fc307253489a4e4"
Expand Down
2 changes: 1 addition & 1 deletion modules/jupyter-widget/package.json
Expand Up @@ -39,7 +39,7 @@
"@loaders.gl/3d-tiles": "4.1.0-alpha.9",
"@loaders.gl/core": "4.1.0-alpha.9",
"@loaders.gl/csv": "4.1.0-alpha.9",
"@luma.gl/core": "9.0.0-alpha.54",
"@luma.gl/core": "9.0.0-beta.1",
"mapbox-gl": "^1.13.2"
},
"jupyterlab": {
Expand Down
14 changes: 7 additions & 7 deletions modules/layers/package.json
Expand Up @@ -33,10 +33,10 @@
"@babel/runtime": "^7.0.0",
"@loaders.gl/images": "4.1.0-alpha.9",
"@loaders.gl/schema": "4.1.0-alpha.9",
"@luma.gl/constants": "9.0.0-alpha.54",
"@luma.gl/core": "9.0.0-alpha.54",
"@luma.gl/engine": "9.0.0-alpha.54",
"@luma.gl/shadertools": "9.0.0-alpha.54",
"@luma.gl/constants": "9.0.0-beta.1",
"@luma.gl/core": "9.0.0-beta.1",
"@luma.gl/engine": "9.0.0-beta.1",
"@luma.gl/shadertools": "9.0.0-beta.1",
"@mapbox/tiny-sdf": "^2.0.5",
"@math.gl/core": "^4.0.0",
"@math.gl/polygon": "^4.0.0",
Expand All @@ -46,9 +46,9 @@
"peerDependencies": {
"@deck.gl/core": "^9.0.0-alpha",
"@loaders.gl/core": "4.1.0-alpha.9",
"@luma.gl/core": "9.0.0-alpha.54",
"@luma.gl/engine": "9.0.0-alpha.54",
"@luma.gl/shadertools": "9.0.0-alpha.54"
"@luma.gl/core": "9.0.0-beta.1",
"@luma.gl/engine": "9.0.0-beta.1",
"@luma.gl/shadertools": "9.0.0-beta.1"
},
"gitHead": "13ace64fc2cee08c133afc882fc307253489a4e4"
}
2 changes: 1 addition & 1 deletion modules/mapbox/package.json
Expand Up @@ -31,7 +31,7 @@
"prepublishOnly": "npm run build-bundle && npm run build-bundle -- --env=dev"
},
"dependencies": {
"@luma.gl/core": "9.0.0-alpha.54",
"@luma.gl/core": "9.0.0-beta.1",
"@math.gl/web-mercator": "^4.0.0"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion modules/mapbox/src/deck-utils.ts
Expand Up @@ -24,7 +24,7 @@ export function getDeckInstance({
deck
}: {
map: Map & {__deck?: Deck | null};
gl: WebGLRenderingContext;
gl: WebGL2RenderingContext;
deck?: Deck;
}): Deck {
// Only create one deck instance per context
Expand Down
7 changes: 6 additions & 1 deletion modules/mapbox/src/mapbox-layer.ts
@@ -1,5 +1,6 @@
import {getDeckInstance, addLayer, removeLayer, updateLayer, drawLayer} from './deck-utils';
import type {Map, CustomLayerInterface} from 'mapbox-gl';
import {log} from '@deck.gl/core';
import type {Deck, Layer} from '@deck.gl/core';

export type MapboxLayerProps<LayerT extends Layer> = Partial<LayerT['props']> & {
Expand Down Expand Up @@ -32,7 +33,11 @@ export default class MapboxLayer<LayerT extends Layer> implements CustomLayerInt

/* Mapbox custom layer methods */

onAdd(map: Map, gl: WebGLRenderingContext): void {
onAdd(map: Map, gl: WebGLRenderingContext | WebGL2RenderingContext): void {
if (gl instanceof WebGLRenderingContext) {
log.warn('Use useWebGL2:true in mapboxgl.Map()')();
return;
}
this.map = map;
this.deck = getDeckInstance({map, gl, deck: this.props.deck});
addLayer(this.deck, this);
Expand Down
6 changes: 3 additions & 3 deletions modules/mesh-layers/package.json
Expand Up @@ -36,9 +36,9 @@
"dependencies": {
"@babel/runtime": "^7.0.0",
"@loaders.gl/gltf": "4.1.0-alpha.9",
"@luma.gl/core": "9.0.0-alpha.54",
"@luma.gl/gltf": "9.0.0-alpha.54",
"@luma.gl/shadertools": "9.0.0-alpha.54"
"@luma.gl/core": "9.0.0-beta.1",
"@luma.gl/gltf": "9.0.0-beta.1",
"@luma.gl/shadertools": "9.0.0-beta.1"
},
"gitHead": "13ace64fc2cee08c133afc882fc307253489a4e4"
}
4 changes: 2 additions & 2 deletions modules/test-utils/package.json
Expand Up @@ -28,8 +28,8 @@
},
"peerDependencies": {
"@deck.gl/core": "^9.0.0-alpha",
"@luma.gl/test-utils": "9.0.0-alpha.54",
"@luma.gl/webgl": "9.0.0-alpha.54",
"@luma.gl/test-utils": "9.0.0-beta.1",
"@luma.gl/webgl": "9.0.0-beta.1",
"@probe.gl/test-utils": "^4.0.0"
},
"scripts": {},
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -61,8 +61,8 @@
"@babel/register": "^7.13.0",
"@loaders.gl/csv": "4.1.0-alpha.9",
"@loaders.gl/polyfills": "4.1.0-alpha.9",
"@luma.gl/test-utils": "9.0.0-alpha.54",
"@luma.gl/webgpu": "9.0.0-alpha.54",
"@luma.gl/test-utils": "9.0.0-beta.1",
"@luma.gl/webgpu": "9.0.0-beta.1",
"@math.gl/proj4": "^4.0.0",
"@probe.gl/bench": "^4.0.4",
"@probe.gl/test-utils": "^4.0.4",
Expand Down