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

v3.5.0 #13213

Merged
merged 45 commits into from
Jul 4, 2024
Merged

v3.5.0 #13213

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
fc8400c
Add missing paint_raster-particle entry (internal-1534)
Nelarius Jun 18, 2024
ea622fb
Add API to set color-theme property (internal-1519)
endanke Jun 19, 2024
424444c
Update TypeScript to v5.5.x (internal-1484)
stepankuzmin Jun 24, 2024
98a2239
Expose deprecated `FunctionSpecification` type (internal-1538)
stepankuzmin Jun 24, 2024
eaf252c
Bump the eslint-dependencies group with 4 updates (internal-1539)
dependabot[bot] Jun 25, 2024
6078272
Bump @octokit/rest from 20.1.1 to 21.0.0 (internal-1540)
dependabot[bot] Jun 25, 2024
d61b5a0
Bump cssnano from 7.0.2 to 7.0.3 (internal-1542)
dependabot[bot] Jun 25, 2024
4a628a6
Bump tsx from 4.15.6 to 4.15.7 (internal-1545)
dependabot[bot] Jun 25, 2024
8fe0fce
Bump playwright from 1.44.1 to 1.45.0 (internal-1543)
dependabot[bot] Jun 25, 2024
6cf640b
Bump glob from 10.4.1 to 10.4.2 (internal-1544)
dependabot[bot] Jun 25, 2024
e0e9d18
Bump address from 2.0.2 to 2.0.3 (internal-1541)
dependabot[bot] Jun 25, 2024
801870f
Bump stylelint-config-standard from 36.0.0 to 36.0.1 (internal-1547)
dependabot[bot] Jun 25, 2024
0916402
Bump @types/node from 20.14.3 to 20.14.8 (internal-1546)
dependabot[bot] Jun 25, 2024
c99b873
Add more unit tests to variant parsing (internal-1548)
jtorresfabra Jun 26, 2024
a1bc248
Add query test with symbol above horizon (internal-1550)
endanke Jun 26, 2024
43e0b6d
Update CODEOWNERS (internal-1553)
stepankuzmin Jun 27, 2024
e4de765
[MAPS3D-1398] Fix model-front-cutoff paint property for meshopt model…
lasselammi Jun 28, 2024
fbc2f35
[GLJS-894] Handle cache entries of empty tiles (internal-1551)
underoot Jun 28, 2024
09d8975
Update CODEOWNERS (internal-1557)
stepankuzmin Jun 28, 2024
2b1bd1a
Upgrade earcut & cheap-ruler (internal-1556)
mourner Jun 28, 2024
e7b38de
Improved precision line-pattern rendering for long-lines and high zoo…
aleksigron Jun 28, 2024
921bd62
Add new properties to control line trim coloring and fading (internal…
endanke Jul 1, 2024
6c90d13
Apply LUT on model colors without PBR buffer (internal-1558)
endanke Jul 1, 2024
ed4c1a9
Fix canvas fingerprint noise check on `Map.setTerrain` (internal-1561)
stepankuzmin Jul 1, 2024
99d8a32
Load LUT into image element (internal-1562)
endanke Jul 1, 2024
dc14c9b
fix initial value for globa clip bounds in ReplacementSource (interna…
akoylasar Jul 1, 2024
d109bed
Dynamic GeoJSON index for fast partial updates (internal-1549)
mourner Jul 1, 2024
3b779af
Bump typescript from 5.5.2 to 5.5.3 (internal-1570)
dependabot[bot] Jul 2, 2024
ae83d32
Bump postcss from 8.4.38 to 8.4.39 (internal-1569)
dependabot[bot] Jul 2, 2024
b5fe1d9
Bump esbuild from 0.21.5 to 0.22.0 (internal-1567)
dependabot[bot] Jul 2, 2024
165e461
Bump @types/node from 20.14.8 to 20.14.9 (internal-1566)
dependabot[bot] Jul 2, 2024
0ed085a
Bump @tweakpane/core from 2.0.3 to 2.0.4 (internal-1565)
dependabot[bot] Jul 2, 2024
1a41a80
Bump vite-plugin-arraybuffer from 0.0.7 to 0.0.8 (internal-1572)
dependabot[bot] Jul 2, 2024
de68154
Bump tsx from 4.15.7 to 4.16.0 (internal-1571)
dependabot[bot] Jul 2, 2024
d644ed4
Precompute mesh and nodes aabb transformations for landmarks to avoid…
jtorresfabra Jul 2, 2024
e12624e
Bump the eslint-dependencies group with 5 updates (internal-1564)
dependabot[bot] Jul 2, 2024
5ed6463
Bump esbuild from 0.22.0 to 0.23.0 (internal-1576)
dependabot[bot] Jul 2, 2024
c852f95
Improve unit tests in CI (internal-1574)
stepankuzmin Jul 2, 2024
dddcee8
Bump tweakpane from 4.0.3 to 4.0.4 (internal-1573)
dependabot[bot] Jul 2, 2024
f45080b
Bump testem from 3.14.0 to 3.15.0 (internal-1568)
dependabot[bot] Jul 2, 2024
cfca8a2
Fix missing `style` property on style.load event (internal-1578)
stepankuzmin Jul 2, 2024
92501bf
[GLJS-837] Fix queryRenderedFeatures if DEM tiles are missed (interna…
underoot Jul 3, 2024
6139653
Add `Map#getSlots` (internal-1580)
stepankuzmin Jul 3, 2024
bf0bf4c
v3.5.0
mourner Jul 3, 2024
860bbd0
change the repo for check-ts-suppressions check
mourner Jul 3, 2024
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
8 changes: 7 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,14 @@ jobs:
- attach_workspace:
at: ~/
- run:
command: npm run test-unit
name: Run unit tests
command: |
npm run test-unit
no_output_timeout: 5m
- store_artifacts:
path: test/unit/vitest
- store_test_results:
path: test/unit/test-results.xml

test-query:
<<: *linux-defaults
Expand Down
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @mapbox/gl-js
* @mapbox/gl-js @mapbox/gl-native @mapbox/mapbox-3d-team
10 changes: 6 additions & 4 deletions 3d-style/data/bucket/tiled_3d_model_bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ export class Tiled3dModelFeature {
this.emissionHeightBasedParams = [];
// Needs to calculate geometry
this.feature = {type: 'Point', id: node.id, geometry: [], properties: {'height' : getNodeHeight(node)}};
this.aabb = this._getLocalBounds();
}
getLocalBounds(): Aabb {
_getLocalBounds(): Aabb {
if (!this.node.meshes) {
return new Aabb([Infinity, Infinity, Infinity], [-Infinity, -Infinity, -Infinity]);
}
Expand All @@ -105,11 +106,12 @@ export class Tiled3dModelFeature {
const aabb = new Aabb([Infinity, Infinity, Infinity], [-Infinity, -Infinity, -Infinity]);
for (const mesh of this.node.meshes) {
if (this.node.lightMeshIndex !== i) {
aabb.encapsulate(mesh.aabb);
mesh.transformedAabb = Aabb.applyTransform(mesh.aabb, this.node.matrix);
aabb.encapsulate(mesh.transformedAabb);
}
i++;
}
this.aabb = Aabb.applyTransform(aabb, this.node.matrix);
this.aabb = aabb;
}
return this.aabb;
}
Expand Down Expand Up @@ -551,7 +553,7 @@ class Tiled3dModelBucket implements Bucket {
const nodeInfo = nodesInfo[i];
assert(nodeInfo.node.meshes.length > 0);
const mesh = nodeInfo.node.meshes[0];
const meshAabb = Aabb.applyTransform(mesh.aabb, nodeInfo.node.matrix);
const meshAabb = mesh.transformedAabb;
if (x < meshAabb.min[0] || y < meshAabb.min[1] || x > meshAabb.max[0] || y > meshAabb.max[1]) continue;
if (nodeInfo.node.hidden === true) return {height: 0.0, maxHeight: nodeInfo.feature.properties["height"], hidden: false, verticalScale: nodeInfo.evaluatedScale[2]};

Expand Down
1 change: 1 addition & 0 deletions 3d-style/data/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export type Mesh = {
pbrBuffer: VertexBuffer;
material: Material;
aabb: Aabb;
transformedAabb: Aabb;
segments: SegmentVector;
centroid: vec3;
heightmap: Float32Array;
Expand Down
9 changes: 4 additions & 5 deletions 3d-style/render/draw_model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ function drawBatchedModels(painter: Painter, source: SourceCache, layer: ModelSt
}

const nodeAabb = () => {
const localBounds = nodeInfo.getLocalBounds();
const localBounds = nodeInfo.aabb;
// @ts-expect-error - TS2322 - Type 'number[]' is not assignable to type 'vec3'.
aabb.min = [...localBounds.min];
// @ts-expect-error - TS2322 - Type 'number[]' is not assignable to type 'vec3'.
Expand Down Expand Up @@ -874,8 +874,7 @@ function drawBatchedModels(painter: Painter, source: SourceCache, layer: ModelSt
let opacity = layerOpacity;
if (!isShadowPass) {
if (frontCutoffEnabled) {

opacity *= calculateFrontCutoffOpacity(nodeModelMatrix, tr, nodeInfo.getLocalBounds(), frontCutoffParams);
opacity *= calculateFrontCutoffOpacity(tileModelMatrix as any, tr, nodeInfo.aabb, frontCutoffParams);
}

opacity *= calculateFarCutoffOpacity(cutoffParams, depth);
Expand Down Expand Up @@ -1120,7 +1119,7 @@ function calculateFarCutoffOpacity(cutoffParams: CutoffParams, depth: number): n
return clamp((linearDepth - cutoffStart) / (cutoffEnd - cutoffStart), 0.0, 1.0);
}

function calculateFrontCutoffOpacity(nodeModelMatrix: mat4, tr: Transform, aabb: Aabb, cutoffParams: [number, number, number]) {
function calculateFrontCutoffOpacity(tileModelMatrix: mat4, tr: Transform, aabb: Aabb, cutoffParams: [number, number, number]) {
// The cutoff opacity is completely disabled when pitch is lower than 20.
const fullyOpaquePitch = 20.0;
const fullyTransparentPitch = 40.0;
Expand All @@ -1131,7 +1130,7 @@ function calculateFrontCutoffOpacity(nodeModelMatrix: mat4, tr: Transform, aabb:
}

const worldToCamera = tr.getWorldToCameraMatrix();
const mat = mat4.multiply([] as any, worldToCamera, nodeModelMatrix);
const mat = mat4.multiply([] as any, worldToCamera, tileModelMatrix);

// The cutoff opacity is calculated based on how much below the view the AABB bottom corners are.
// For this, we find the AABB points with the highest and lowest y value in the view space.
Expand Down
4 changes: 2 additions & 2 deletions 3d-style/render/lights.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ function calculateGroundRadiance(dir: vec3, dirColor: vec3, ambientColor: vec3):
export const lightsUniformValues = (directional: Lights<Directional>, ambient: Lights<Ambient>, style: Style): UniformValues<LightsUniformsType> => {
const direction = directional.properties.get('direction');

const directionalColor = directional.properties.get('color').toRenderColor(style._luts[directional.scope]).toArray01();
const directionalColor = directional.properties.get('color').toRenderColor(style.getLut(directional.scope)).toArray01();
const directionalIntensity = directional.properties.get('intensity');

const ambientColor = ambient.properties.get('color').toRenderColor(style._luts[ambient.scope]).toArray01();
const ambientColor = ambient.properties.get('color').toRenderColor(style.getLut(ambient.scope)).toArray01();
const ambientIntensity = ambient.properties.get('intensity');

const dirVec: [number, number, number] = [direction.x, direction.y, direction.z];
Expand Down
4 changes: 2 additions & 2 deletions 3d-style/render/shadow_renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -621,10 +621,10 @@ export function calculateGroundShadowFactor(
const dirDirectionalFactor = Math.max(vec3.dot(groundNormal as [number, number, number], directionVec as [number, number, number]), 0.0);
const ambStrength = [0, 0, 0];
// @ts-expect-error - TS2339 - Property 'toRenderColor' does not exist on type 'unknown'. | TS2345 - Argument of type 'unknown' is not assignable to parameter of type 'number'.
vec3.scale(ambStrength as [number, number, number], ambientColor.toRenderColor(style._luts[directionalLight.scope]).toArray01Linear().slice(0, 3), ambientIntensity);
vec3.scale(ambStrength as [number, number, number], ambientColor.toRenderColor(style.getLut(directionalLight.scope)).toArray01Linear().slice(0, 3), ambientIntensity);
const dirStrength = [0, 0, 0];
// @ts-expect-error - TS2339 - Property 'toRenderColor' does not exist on type 'unknown'. | TS2363 - The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
vec3.scale(dirStrength as [number, number, number], dirColor.toRenderColor(style._luts[ambientLight.scope]).toArray01Linear().slice(0, 3), dirDirectionalFactor * dirIntensity);
vec3.scale(dirStrength as [number, number, number], dirColor.toRenderColor(style.getLut(ambientLight.scope)).toArray01Linear().slice(0, 3), dirDirectionalFactor * dirIntensity);

// Multiplier X to get from lit surface color L to shadowed surface color S
// X = A / (A + D)
Expand Down
4 changes: 4 additions & 0 deletions 3d-style/shaders/model.fragment.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,10 @@ vec4 finalColor;
distance += mix(0.5, 0.0, clamp(resEmission - 1.0, 0.0, 1.0));
opacity *= v_roughness_metallic_emissive_alpha.w * saturate(1.0 - distance * distance);
#endif
#else
#ifdef APPLY_LUT_ON_GPU
color = applyLUT(u_lutTexture, color);
#endif
#endif
// Use emissive strength as interpolation between lit and unlit color
// for coherence with other layer types.
Expand Down
2 changes: 1 addition & 1 deletion 3d-style/source/replacement_source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ReplacementSource {
this._sourceIds = [];
this._activeRegions = [];
this._prevRegions = [];
this._globalClipBounds = {min: new Point(0, 0), max: new Point(0, 0)};
this._globalClipBounds = {min: new Point(Infinity, Infinity), max: new Point(-Infinity, -Infinity)};
}

clear() {
Expand Down
16 changes: 13 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
## 3.5.0-beta.1
## 3.5.0

### Breaking changes ⚠️
- This release marks a significant transition for GL JS, moving from [Flow](https://flow.org/) to [TypeScript](https://www.typescriptlang.org/). While we have maintained backward compatibility where possible, the community typings `@types/mapbox-gl` are not fully compatible with the new first-class typings. Users relying on the community typings may experience breaking changes. Please remove the `@types/mapbox-gl` dependency and refer to the [v3.5.0 migration guide](https://github.com/mapbox/mapbox-gl-js/issues/13203) for instructions on upgrading, resolving common issues, and asking questions regarding the migration to the first-class typings. We welcome your feedback and contributions to make Mapbox GL JS better.

### Features and improvements ✨
- Add `color-theme` property to enable colorization with a lookup table (LUT) images.
- Add `color-theme` property and `Map` `setColorTheme` method to enable colorization with a lookup table (LUT) images.
- Significantly improve performance of `updateData` for `GeoJSON` sources in `dynamic` mode.
- Add `icon-occlusion-opacity` and `text-occlusion-opacity` properties to fade symbols behind models and landmarks.
- Add `line-occlusion-opacity` property to fade lines behind 3D objects.
- Add experimental `clip` layer to filter out rendering data.
- Add experimental `line-z-offset` property for a non-globe view.
- Add `model-cutoff-fade-range` property support to control fade out of faraway 3D buildings.
- Add `model-cutoff-fade-range` property to control fade out of faraway 3D buildings.
- Improve precision of `line-pattern` on long lines and higher zooms.
- Add experimental `line-trim-color` and `line-trim-fade-range` properties to customize rendering of lines trimmed with `line-trim-offset`.
- Add `Map` `getSlots` method for listing available slots of a style.

### Bug fixes 🐞
- Fix a performance regression in Standard style introduced in v3.4.0.
- Fix icon rotation during globe transition.
- Fix GeoJSON data loss due to frequent `updateData` calls.
- Improve `raster-particle` layer animation.
- Fix `model-front-cutoff` property for Meshopt-encoded models.
- Fix errors in the console on empty 3D tiles.
- Fix not properly detecting fingerprinting protection when adding terrain through `setTerrain`.
- Fix `style.load` event missing `style` property.
- Fix errors when using `queryRenderedFeatures` on areas with missing DEM tiles when terrain is enabled.

## 3.4.0

Expand Down
2 changes: 1 addition & 1 deletion build/check-ts-suppressions.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {Octokit} from '@octokit/rest';
import {execSync} from 'child_process';

const owner = 'mapbox';
const repo = 'mapbox-gl-js-internal';
const repo = 'mapbox-gl-js';
const branch = process.env['CIRCLE_BRANCH'] || execSync('git rev-parse --abbrev-ref HEAD').toString().trim();

async function getBannedTsComments() {
Expand Down
16 changes: 16 additions & 0 deletions build/generate-typed-style-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,21 @@ export type TransitionSpecification = {

// Note: doesn't capture interpolatable vs. non-interpolatable types.

export type PropertyFunctionStop<T> = [number, T];
export type ZoomAndPropertyFunctionStop<T> = [{zoom: number; value: string | number | boolean}, T];

/**
* @deprecated Use [Expressions](https://docs.mapbox.com/style-spec/reference/expressions/) syntax instead.
*/
export type FunctionSpecification<T> = {
stops: Array<PropertyFunctionStop<T> | ZoomAndPropertyFunctionStop<T>>;
base?: number;
property?: string;
type?: 'identity' | 'exponential' | 'interval' | 'categorical';
colorSpace?: 'rgb' | 'lab' | 'hcl';
default?: T;
};

export type CameraFunctionSpecification<T> =
| { type: 'exponential', stops: Array<[number, T]> }
| { type: 'interval', stops: Array<[number, T]> };
Expand All @@ -277,6 +292,7 @@ export type PropertyValueSpecification<T> =

export type DataDrivenPropertyValueSpecification<T> =
| T
| FunctionSpecification<T>
| CameraFunctionSpecification<T>
| SourceFunctionSpecification<T>
| CompositeFunctionSpecification<T>
Expand Down
43 changes: 43 additions & 0 deletions debug/line-pattern.html
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,28 @@
]
};

const longRoute = {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {},
"geometry": {
"coordinates": [
[ 48.884680, 16.085282 ], [ 49.061463, 16.515979 ], [ 48.891005, 16.562687 ], [ 48.974135, 16.763008 ],
[ 49.268492, 16.718297 ], [ 49.331357, 16.902966 ], [ 49.386120, 16.986536 ], [ 49.587155, 17.011794 ],
[ 49.936453, 17.009859 ], [ 50.180135, 17.013721 ], [ 50.236977, 16.961266 ], [ 49.676524, 16.889389 ],
[ 49.528352, 16.714410 ], [ 49.408444, 16.321152 ], [ 49.556546, 16.118124 ], [ 49.802388, 16.008736 ],
[ 50.056386, 15.991148 ], [ 50.415946, 16.075220 ], [ 50.674048, 16.215688 ], [ 50.180274, 16.204027 ],
[ 50.178172, 16.317207 ], [ 49.885689, 16.315238 ], [ 49.875532, 16.399057 ], [ 49.674499, 16.445862 ],
[ 50.186082, 16.722162 ], [ 50.699853, 16.720252 ]
],
"type": "LineString"
}
}
]
};

map.on('load', () => {
map.setFog({
'horizon-blend': 0.0
Expand All @@ -160,6 +182,13 @@
'maxzoom': 19,
});

map.addSource('longRoute', {
'type': 'geojson',
'data': longRoute,
'lineMetrics': true,
'maxzoom': 16,
});

map.addSource('mapbox-dem', {
'type': 'raster-dem',
'url': 'mapbox://mapbox.mapbox-terrain-dem-v1',
Expand Down Expand Up @@ -216,6 +245,20 @@
}
map.setPaintProperty('route', 'line-trim-offset', [0, progress]);
}, 100);

map.addLayer({
'id': 'longRoute',
'slot': 'top',
'source': 'longRoute',
'type': 'line',
'layout': {
'line-join': 'none'
},
'paint': {
'line-pattern': 'bluecircle',
'line-width': zoomConstExpression
}
});
});
});
});
Expand Down
Loading
Loading