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 7 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": "^3.4.13",
"@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": "^3.4.13",
"@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": "^3.4.13",
"@loaders.gl/wms": "^3.4.13",
"@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
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,21 @@
],
"resolution_comments": {
"escaper": "v2 has an invalid main field in package.json, breaks esbuild during browser test",
"vite": "process polyfill missing"
"vite": "process polyfill missing",
"math.gl": "loaders.gl pulls in v3 packages"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loaders.gl should be upgraded first.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

},
"resolutions": {
"@probe.gl/log": "4.0.4",
"@probe.gl/stats": "4.0.4",
"@probe.gl/env": "4.0.4",
"escaper": "3.0.6",
"vite": "^4.3.9",
"math.gl": "^4.0.0",
"@math.gl/core": "^4.0.0",
"@math.gl/web-mercator": "^4.0.0",
"@math.gl/culling": "^4.0.0",
"@math.gl/geospatial": "^4.0.0",
"@math.gl/proj4": "^4.0.0",
"puppeteer": "^21.3.8"
},
"scripts": {
Expand Down Expand Up @@ -63,7 +70,7 @@
"@loaders.gl/polyfills": "^3.4.13",
"@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
Loading
Loading