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

chore: Upgrade v9.0 to math.gl@4.0.0. Remove gl-matrix #8204

Merged
merged 9 commits into from
Oct 23, 2023
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
2 changes: 1 addition & 1 deletion examples/website/mesh/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"dependencies": {
"@loaders.gl/obj": "4.0.0-beta.5",
"@math.gl/core": "4.0.0-alpha.4",
"@math.gl/core": "^4.0.0",
"deck.gl": "^8.8.0",
"react": "^18.0.0",
"react-dom": "^18.0.0"
Expand Down
2 changes: 1 addition & 1 deletion modules/aggregation-layers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@luma.gl/constants": "9.0.0-alpha.37",
"@luma.gl/core": "9.0.0-alpha.37",
"@luma.gl/shadertools": "9.0.0-alpha.37",
"@math.gl/web-mercator": "4.0.0-alpha.4",
"@math.gl/web-mercator": "^4.0.0",
"d3-hexbin": "^0.2.1"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion modules/carto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@loaders.gl/tiles": "4.0.0-beta.5",
"@luma.gl/core": "9.0.0-alpha.37",
"@luma.gl/constants": "^8.5.20",
"@math.gl/web-mercator": "4.0.0-alpha.4",
"@math.gl/web-mercator": "^4.0.0",
"cartocolor": "^4.0.2",
"d3-array": "^3.2.0",
"d3-color": "^3.1.0",
Expand Down
6 changes: 3 additions & 3 deletions modules/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
"@luma.gl/engine": "9.0.0-alpha.37",
"@luma.gl/shadertools": "9.0.0-alpha.37",
"@luma.gl/webgl": "9.0.0-alpha.37",
"@math.gl/core": "4.0.0-alpha.4",
"@math.gl/sun": "4.0.0-alpha.4",
"@math.gl/web-mercator": "4.0.0-alpha.4",
"@math.gl/core": "^4.0.0",
"@math.gl/sun": "^4.0.0",
"@math.gl/web-mercator": "^4.0.0",
"@probe.gl/env": "^4.0.4",
"@probe.gl/log": "^4.0.4",
"@probe.gl/stats": "^4.0.4",
Expand Down
3 changes: 1 addition & 2 deletions modules/core/src/shaderlib/project/project-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import {COORDINATE_SYSTEM} from '../../lib/constants';
import {getOffsetOrigin} from './viewport-uniforms';
import WebMercatorViewport from '../../viewports/web-mercator-viewport';

import * as vec4 from 'gl-matrix/vec4';
import * as vec3 from 'gl-matrix/vec3';
import {vec3, vec4} from '@math.gl/core';
import {addMetersToLngLat} from '@math.gl/web-mercator';

import type {CoordinateSystem} from '../../lib/constants';
Expand Down
3 changes: 1 addition & 2 deletions modules/core/src/shaderlib/project/viewport-uniforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
// THE SOFTWARE.
/* eslint-disable complexity, camelcase */

import * as mat4 from 'gl-matrix/mat4';
import * as vec4 from 'gl-matrix/vec4';
import {mat4, vec4} from '@math.gl/core';

import {COORDINATE_SYSTEM, PROJECTION_MODE} from '../../lib/constants';

Expand Down
3 changes: 1 addition & 2 deletions modules/core/src/viewports/globe-viewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import {Matrix4} from '@math.gl/core';
import Viewport from './viewport';
import {PROJECTION_MODE} from '../lib/constants';

import * as vec3 from 'gl-matrix/vec3';
import * as vec4 from 'gl-matrix/vec4';
import {vec3, vec4} from '@math.gl/core';

const DEGREES_TO_RADIANS = Math.PI / 180;
const RADIANS_TO_DEGREES = 180 / Math.PI;
Expand Down
3 changes: 1 addition & 2 deletions modules/core/src/viewports/orthographic-viewport.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import Viewport from '../viewports/viewport';

import {Matrix4, clamp} from '@math.gl/core';
import {Matrix4, clamp, vec2} from '@math.gl/core';
import {pixelsToWorld} from '@math.gl/web-mercator';
import * as vec2 from 'gl-matrix/vec2';

import type {Padding} from './viewport';

Expand Down
3 changes: 1 addition & 2 deletions modules/core/src/viewports/viewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
import log from '../utils/log';
import {createMat4, getCameraPosition, getFrustumPlanes, FrustumPlane} from '../utils/math-utils';

import {Matrix4, Vector3, equals, clamp} from '@math.gl/core';
import * as mat4 from 'gl-matrix/mat4';
import {Matrix4, Vector3, equals, clamp, mat4} from '@math.gl/core';

import {
getDistanceScales,
Expand Down
4 changes: 1 addition & 3 deletions modules/core/src/viewports/web-mercator-viewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ import {
} from '@math.gl/web-mercator';
import {Padding} from './viewport';

// TODO - import from math.gl
import * as vec2 from 'gl-matrix/vec2';
import {Matrix4, clamp} from '@math.gl/core';
import {Matrix4, clamp, vec2} from '@math.gl/core';

export type WebMercatorViewportOptions = {
/** Name of the viewport */
Expand Down
6 changes: 2 additions & 4 deletions modules/extensions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@
"@luma.gl/engine": "9.0.0-alpha.37",
"@luma.gl/shadertools": "9.0.0-alpha.37",
"@luma.gl/webgl": "9.0.0-alpha.37",
"@math.gl/core": "4.0.0-alpha.4",
"@math.gl/constants": "4.0.0-alpha.4",
"@math.gl/web-mercator": "4.0.0-alpha.4",
"gl-matrix": "^3.0.0"
"@math.gl/core": "^4.0.0",
"@math.gl/web-mercator": "^4.0.0"
},
"gitHead": "13ace64fc2cee08c133afc882fc307253489a4e4"
}
4 changes: 2 additions & 2 deletions modules/extensions/src/path-style/path-style-extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
// THE SOFTWARE.

import {LayerExtension, _mergeShaders as mergeShaders} from '@deck.gl/core';
import {vec3} from '@math.gl/core';
import {dashShaders, offsetShaders} from './shaders.glsl';
import {dist} from 'gl-matrix/vec3';

import type {Layer, LayerContext, Accessor, UpdateParameters} from '@deck.gl/core';
import type {Model} from '@luma.gl/engine';
Expand Down Expand Up @@ -172,7 +172,7 @@ export default class PathStyleExtension extends LayerExtension<PathStyleExtensio
p = this.projectPosition(p);

if (i > 0) {
result[i] = result[i - 1] + dist(prevP, p);
result[i] = result[i - 1] + vec3.dist(prevP, p);
}

prevP = p;
Expand Down
6 changes: 3 additions & 3 deletions modules/geo-layers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
"@loaders.gl/tiles": "4.0.0-beta.5",
"@loaders.gl/wms": "4.0.0-beta.5",
"@luma.gl/core": "9.0.0-alpha.37",
"@math.gl/core": "4.0.0-alpha.4",
"@math.gl/culling": "4.0.0-alpha.4",
"@math.gl/web-mercator": "4.0.0-alpha.4",
"@math.gl/core": "^4.0.0",
"@math.gl/culling": "^4.0.0",
"@math.gl/web-mercator": "^4.0.0",
"@types/geojson": "^7946.0.8",
"h3-js": "^4.1.0",
"long": "^3.2.0"
Expand Down
2 changes: 1 addition & 1 deletion modules/google-maps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@luma.gl/engine": "9.0.0-alpha.37",
"@luma.gl/webgl": "9.0.0-alpha.37",
"@luma.gl/constants": "9.0.0-alpha.37",
"@math.gl/core": "4.0.0-alpha.4"
"@math.gl/core": "^4.0.0"
},
"gitHead": "13ace64fc2cee08c133afc882fc307253489a4e4"
}
6 changes: 3 additions & 3 deletions modules/layers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
"@luma.gl/shadertools": "9.0.0-alpha.37",
"@luma.gl/constants": "9.0.0-alpha.37",
"@mapbox/tiny-sdf": "^2.0.5",
"@math.gl/core": "4.0.0-alpha.4",
"@math.gl/polygon": "4.0.0-alpha.4",
"@math.gl/web-mercator": "4.0.0-alpha.4",
"@math.gl/core": "^4.0.0",
"@math.gl/polygon": "^4.0.0",
"@math.gl/web-mercator": "^4.0.0",
"earcut": "^2.2.4"
},
"peerDependencies": {
Expand Down
3 changes: 1 addition & 2 deletions modules/mapbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
},
"dependencies": {
"@luma.gl/core": "9.0.0-alpha.37",
"@math.gl/web-mercator": "4.0.0-alpha.4",
"@types/mapbox-gl": "^2.6.3"
"@math.gl/web-mercator": "^4.0.0"
},
"peerDependencies": {
"@deck.gl/core": "^8.0.0"
Expand Down
2 changes: 0 additions & 2 deletions modules/mapbox/src/deck-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,7 @@ function getViewport(deck: Deck, map: Map, useMapboxProjection = true): WebMerca
0.02
: // use deck.gl's own default
0.1,
// @ts-expect-error Mapbox specific - extract near plane position
nearZ: map.transform._nearZ / map.transform.height,
// @ts-expect-error Mapbox specific - extract far plane position
farZ: map.transform._farZ / map.transform.height
});
}
Expand Down
2 changes: 1 addition & 1 deletion modules/mapbox/src/mapbox-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ export default class MapboxLayer<LayerT extends Layer> implements CustomLayerInt
}

render() {
drawLayer(this.deck!, this.map!, this);
drawLayer(this.deck!, this.map, this);
}
}
2 changes: 1 addition & 1 deletion modules/test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@deck.gl/core": "^8.0.0",
"@luma.gl/test-utils": "9.0.0-alpha.37",
"@luma.gl/webgl": "9.0.0-alpha.37",
"@probe.gl/test-utils": "^4.0.4"
"@probe.gl/test-utils": "^4.0.0"
},
"scripts": {},
"gitHead": "13ace64fc2cee08c133afc882fc307253489a4e4"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"@loaders.gl/polyfills": "4.0.0-beta.5",
"@luma.gl/test-utils": "9.0.0-alpha.37",
"@luma.gl/webgpu": "9.0.0-alpha.37",
"@math.gl/proj4": "4.0.0-alpha.4",
"@math.gl/proj4": "^4.0.0",
"@probe.gl/bench": "^4.0.4",
"@probe.gl/test-utils": "^4.0.4",
"@types/react": "^18.0.0",
Expand Down
3 changes: 1 addition & 2 deletions test/apps/frustum-cull/frustum-utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {Vector3} from '@math.gl/core';
import * as mat3 from 'gl-matrix/mat3';
import {Vector3, mat3} from '@math.gl/core';

const NEAR = [255, 0, 128];
const FAR = [128, 0, 255];
Expand Down
2 changes: 1 addition & 1 deletion test/apps/mask-first-person/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"dependencies": {
"deck.gl": "^8.4.0",
"@math.gl/core": "4.0.0-alpha.4",
"@math.gl/core": "^4.0.0",
"@turf/circle": "6.5.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion test/apps/multi-viewport/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"dependencies": {
"deck.gl": "^8.4.0",
"@math.gl/core": "4.0.0-alpha.4",
"@math.gl/core": "^4.0.0",
"maplibre-gl": "^2.4.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
Expand Down
5 changes: 2 additions & 3 deletions test/modules/core/effects/lighting/sunlight.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
import test from 'tape-promise/tape';
import {WebMercatorViewport, _GlobeViewport as GlobeViewport, PolygonLayer} from 'deck.gl';
import {_SunLight as SunLight} from '@deck.gl/core';

import {angle} from 'gl-matrix/vec3';
import {vec3} from '@math.gl/core';

test('Sunlight#Constructor', t => {
const sunLight = new SunLight({
Expand Down Expand Up @@ -110,7 +109,7 @@ test('Sunlight#getProjectedLight', t => {
layer.context.viewport = testCase.viewport;
const projectedLight = sunLight.getProjectedLight({layer});
t.comment(projectedLight.direction.join(','));
t.ok(angle(projectedLight.direction, testCase.expected) < 0.05, testCase.title);
t.ok(vec3.angle(projectedLight.direction, testCase.expected) < 0.05, testCase.title);
}

t.end();
Expand Down
53 changes: 11 additions & 42 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3126,15 +3126,6 @@
"@babel/runtime" "^7.12.0"
"@math.gl/types" "4.0.0-alpha.4"

"@math.gl/culling@4.0.0-alpha.4":
version "4.0.0-alpha.4"
resolved "https://registry.yarnpkg.com/@math.gl/culling/-/culling-4.0.0-alpha.4.tgz#3ec98adffd3bfcd63f7f10e6941e529bca24749c"
integrity sha512-BzQnG9SDQy84safvKNBg942ocfUwrEXPDJPkCOAf1EAdDAE8f3PdVx3QCymilxBj7c2d+NylAL2hGrMzIGhZ1w==
dependencies:
"@babel/runtime" "^7.12.0"
"@math.gl/core" "4.0.0-alpha.4"
gl-matrix "^3.4.3"

"@math.gl/culling@^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/@math.gl/culling/-/culling-4.0.0.tgz#5bb96ec38645944088176911a6f4aab43b265cb9"
Expand All @@ -3151,34 +3142,27 @@
"@babel/runtime" "^7.12.0"
"@math.gl/core" "4.0.0"

"@math.gl/polygon@4.0.0-alpha.4":
version "4.0.0-alpha.4"
resolved "https://registry.yarnpkg.com/@math.gl/polygon/-/polygon-4.0.0-alpha.4.tgz#f12b227df950858caa5eab746f75d2cde59375da"
integrity sha512-fDQMPGp+bVcJGMRBy+zd8kQQBnaVwjDv25UgXKDXsFvPPNRC7uyr6xXcoGsujPXAdnU5sfpG66VATfOzHYkd1A==
dependencies:
"@math.gl/core" "4.0.0-alpha.4"

"@math.gl/polygon@^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/@math.gl/polygon/-/polygon-4.0.0.tgz#17d2b1c7569d5a7fd1cde67e885d77e5742c23ec"
integrity sha512-BsseetloYtSZkphH5Fqn02uCL9UWsD26DNLfGhvd2farhU9BaJnn0JGuZnRWT/rf+glZZcDJkyqHq5pDnSX/BQ==
dependencies:
"@math.gl/core" "4.0.0"

"@math.gl/proj4@4.0.0-alpha.4":
version "4.0.0-alpha.4"
resolved "https://registry.yarnpkg.com/@math.gl/proj4/-/proj4-4.0.0-alpha.4.tgz#3d37fd575bc90571974b8221da9bd59805884bfd"
integrity sha512-H41jm9/V2j73aQ3RZqHJuFO0FW/Jmkny+dtCh0gfhAIrrEitzva70hkx8u7/1xTqjYpj6uA9Z86W/BTGOvH1nw==
"@math.gl/proj4@^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/@math.gl/proj4/-/proj4-4.0.0.tgz#5073be8eedfb61decca9cb20d07116bee37748f4"
integrity sha512-gMVTlhzb1Mbq1F32jDph2nJivkipcGNU+Nx+jovFT9shplXwXeEdZxObjngYCtQiZEM3HqFFTbTnA1YhhZsG7A==
dependencies:
"@babel/runtime" "^7.12.0"
"@math.gl/core" "4.0.0-alpha.4"
"@math.gl/core" "4.0.0"
"@types/proj4" "^2.5.0"
proj4 "2.6.2"

"@math.gl/sun@4.0.0-alpha.4":
version "4.0.0-alpha.4"
resolved "https://registry.yarnpkg.com/@math.gl/sun/-/sun-4.0.0-alpha.4.tgz#a33680040cdffa621debf01d0e0f6a1fdae8ea5b"
integrity sha512-uBS2u+cBCYS9uTYuZsthui1AppzzUZepAJhMm71f1yeFYdv37I2HARou2/e65JoLKMRNOpA6bNyN79WzYZwW+w==
"@math.gl/sun@^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/@math.gl/sun/-/sun-4.0.0.tgz#20cf7960093e26d29685d76ee8b7364e38f9460e"
integrity sha512-CEjq/IC/RWjrqgmG/496yJDmwgiASKBnFPjEsGcbVpwFh0kM8wLUGykf9z3nHQ0nY54RwgbrR1nyzQuAqDLShw==
dependencies:
"@babel/runtime" "^7.12.0"

Expand All @@ -3192,14 +3176,6 @@
resolved "https://registry.yarnpkg.com/@math.gl/types/-/types-4.0.0-alpha.4.tgz#eb2875f2e20dd03ddcd3033153bec413dc430935"
integrity sha512-+sA2EJKFbB57xDgkiTSTelnnrvmTG0ZxoYZOEEgwr6y4AKfzzBsuESTVjUfv0o5LnuDv8ctJ1vHXm4Khg9bjsg==

"@math.gl/web-mercator@4.0.0-alpha.4":
version "4.0.0-alpha.4"
resolved "https://registry.yarnpkg.com/@math.gl/web-mercator/-/web-mercator-4.0.0-alpha.4.tgz#58de9b7eba014e292ecde96b5f3ba8e6ab883a0c"
integrity sha512-vl3ybYsZCFzWsNGlc+bxJKrwymP/kOyesCWSpGZ4P/9vUJ7cXPB8nlScolBK4G3ecXeNBdw43EiA9b8jEqmXZg==
dependencies:
"@babel/runtime" "^7.12.0"
gl-matrix "^3.4.3"

"@math.gl/web-mercator@^3.1.3":
version "3.6.2"
resolved "https://registry.yarnpkg.com/@math.gl/web-mercator/-/web-mercator-3.6.2.tgz#1fd8fc2f1dfa794e5fe03eed328d53f69e7bf932"
Expand Down Expand Up @@ -3557,7 +3533,7 @@
resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7"
integrity sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==

"@types/geojson@*", "@types/geojson@^7946.0.7", "@types/geojson@^7946.0.8":
"@types/geojson@^7946.0.7", "@types/geojson@^7946.0.8":
version "7946.0.8"
resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.8.tgz#30744afdb385e2945e22f3b033f897f76b1f12ca"
integrity sha512-1rkryxURpr6aWP7R786/UQOkJ3PcpQiWkAXBmdWc7ryFWqN6a4xfK7BtjXvFBKO9LjQ+MWQSWxYeZX1OApnArA==
Expand Down Expand Up @@ -3613,13 +3589,6 @@
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.155.tgz#e2b4514f46a261fd11542e47519c20ebce7bc23a"
integrity sha512-vEcX7S7aPhsBCivxMwAANQburHBtfN9RdyXFk84IJmu2Z4Hkg1tOFgaslRiEqqvoLtbCBi6ika1EMspE+NZ9Lg==

"@types/mapbox-gl@^2.6.3":
version "2.6.3"
resolved "https://registry.yarnpkg.com/@types/mapbox-gl/-/mapbox-gl-2.6.3.tgz#09e4992bb540fe5e024eebc5fbc315317cb13ffe"
integrity sha512-oF5eQmczkoPQfxfRSwpF9GcrWi3YleptJ67uiCQKps+7aKxwIbww0EHHqIrxvOg49l07+AZBtJU2FPKZm1jKAg==
dependencies:
"@types/geojson" "*"

"@types/mdast@^3.0.0":
version "3.0.10"
resolved "https://registry.yarnpkg.com/@types/mdast/-/mdast-3.0.10.tgz#4724244a82a4598884cbbe9bcfd73dff927ee8af"
Expand Down Expand Up @@ -7309,7 +7278,7 @@ gl-matrix@^3.0.0:
resolved "https://registry.yarnpkg.com/gl-matrix/-/gl-matrix-3.3.0.tgz#232eef60b1c8b30a28cbbe75b2caf6c48fd6358b"
integrity sha512-COb7LDz+SXaHtl/h4LeaFcNdJdAQSDeVqjiIihSXNrkWObZLhDI4hIkZC11Aeqp7bcE72clzB0BnDXr2SmslRA==

gl-matrix@^3.2.1, gl-matrix@^3.4.0, gl-matrix@^3.4.3:
gl-matrix@^3.2.1, gl-matrix@^3.4.0:
version "3.4.3"
resolved "https://registry.yarnpkg.com/gl-matrix/-/gl-matrix-3.4.3.tgz#fc1191e8320009fd4d20e9339595c6041ddc22c9"
integrity sha512-wcCp8vu8FT22BnvKVPjXa/ICBWRq/zjFfdofZy1WSpQZpphblv12/bOQLBC1rMM7SGOFS9ltVmKOHil5+Ml7gA==
Expand Down
Loading