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.2 #13230

Merged
merged 44 commits into from
Jul 18, 2024
Merged

v3.5.2 #13230

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
335ef1c
use NPM workspaces for typings test folder (internal-1585)
mourner Jul 5, 2024
8f86d7a
Simplify MRT decoder (internal-1587)
mourner Jul 5, 2024
16abd5a
Apply LUT directly on emissive color in model fragment shader (intern…
endanke Jul 8, 2024
05c6d57
Ignore older LUT loading results (internal-1595)
endanke Jul 8, 2024
88d45ab
[MAPS3D-1405] test for hidden 3d layers and symbols elevation (intern…
alexey-romanov Jul 8, 2024
8bbf4bd
Do not include source in NPM package (internal-1596)
mourner Jul 8, 2024
6b9f0eb
[MAPS3D-1405] simplify test case for hidden 3d layers and symbols ele…
alexey-romanov Jul 8, 2024
c2cf1c5
Fix raster particle data decoding (internal-1554)
rreusser Jul 8, 2024
a25e577
Bump quickselect from 2.0.0 to 3.0.0 (internal-1607)
dependabot[bot] Jul 9, 2024
d59243a
Bump the eslint-dependencies group with 3 updates (internal-1605)
dependabot[bot] Jul 9, 2024
945d0a8
Bump playwright from 1.45.0 to 1.45.1 (internal-1615)
dependabot[bot] Jul 9, 2024
7b6ebff
Bump tinyqueue from 2.0.3 to 3.0.0 (internal-1612)
dependabot[bot] Jul 9, 2024
ac069b7
Bump tsx from 4.16.0 to 4.16.2 (internal-1611)
dependabot[bot] Jul 9, 2024
b671925
Bump eslint-plugin-jsdoc from 48.5.0 to 48.5.2 (internal-1609)
dependabot[bot] Jul 9, 2024
92ce587
Bump cssnano from 7.0.3 to 7.0.4 (internal-1610)
dependabot[bot] Jul 9, 2024
419dfdb
[GLJS-885] Move versions publishing to CI (internal-1603)
underoot Jul 9, 2024
42554a2
Bump @types/node from 20.14.9 to 20.14.10 (internal-1614)
dependabot[bot] Jul 9, 2024
caf468d
Optimize applyTransform to transform the aabb directly (internal-1591)
nicozink Jul 9, 2024
81b7494
Bump tiny-lru from 11.2.6 to 11.2.11 (internal-1613)
dependabot[bot] Jul 9, 2024
f28dd71
[GLJS-906] Improve TypeScript types (internal-1601)
stepankuzmin Jul 10, 2024
cc01ddc
regenerate package-lock.json (internal-1620)
mourner Jul 10, 2024
35a6213
move CI build-dts out of build job (internal-1623)
mourner Jul 10, 2024
29ea4b7
Counteract brightness change by LUT in model emissive color (internal…
endanke Jul 10, 2024
04f54b5
Improve Source interface type (internal-1625)
stepankuzmin Jul 11, 2024
d9bbdfb
[GLJS-906] Strongly typed `Evented` class (internal-1626)
stepankuzmin Jul 12, 2024
559aa63
Update to Vitest 2.x (internal-1631)
underoot Jul 16, 2024
21a6d46
[MAPS3D-1410] remove terrain depth render pass (internal-1630)
alexey-romanov Jul 16, 2024
883c32d
Fix clip layer experimental tag (internal-1641)
natiginfo Jul 16, 2024
d3a9c51
Bump stylelint from 16.6.1 to 16.7.0 (internal-1634)
dependabot[bot] Jul 16, 2024
d1c76d8
Bump the eslint-dependencies group with 3 updates (internal-1632)
dependabot[bot] Jul 16, 2024
02e0517
Bump eslint-plugin-jsdoc from 48.5.2 to 48.7.0 (internal-1635)
dependabot[bot] Jul 16, 2024
d3fbb9a
Improve TypeScript compatibility test (internal-1643)
stepankuzmin Jul 16, 2024
22cc60d
Bump glob from 10.4.2 to 11.0.0 (internal-1636)
dependabot[bot] Jul 16, 2024
f338be4
[GLJS-906] Strongly typed Map events (internal-1604)
stepankuzmin Jul 17, 2024
2056362
Port use even distance for tile splitting (internal-1642)
jtorresfabra Jul 17, 2024
0b6bb32
Improve TypeScript types (internal-1644)
stepankuzmin Jul 17, 2024
0719926
[MAPS3D-1411] Remove remaining shadows after fill-extrusion cutoff (i…
lasselammi Jul 17, 2024
590c8a4
Refactor raster particle update shader (internal-1586)
rreusser Jul 17, 2024
831ee0c
Improve Source class types (internal-1647)
stepankuzmin Jul 17, 2024
6c5953b
Allow optional feature id in `Map#removeFeatureState` (internal-1648)
stepankuzmin Jul 17, 2024
6999b97
Fix Android and iOS availability version for ClipLayer (internal-1646)
natiginfo Jul 18, 2024
8901ae3
Improve types (internal-1650)
stepankuzmin Jul 18, 2024
bcaa6bc
[GLJS-921] Update CircleCI runners (internal-1649)
stepankuzmin Jul 18, 2024
0759ea9
v3.5.2 (internal-1651)
stepankuzmin Jul 18, 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
13 changes: 6 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ version: 2.1
orbs:
aws-cli: circleci/[email protected]
browser-tools: circleci/[email protected]
win: circleci/[email protected]

workflows:
default:
Expand Down Expand Up @@ -56,7 +55,7 @@ workflows:
only: /.*/
- test-typings:
requires:
- build
- prepare-linux
filters:
tags:
only: /.*/
Expand Down Expand Up @@ -191,10 +190,10 @@ mac-defaults: &mac-defaults
working_directory: ~/mapbox-gl-js

windows-defaults: &windows-defaults
executor:
# windows-server-2022-gui:current
# https://circleci.com/developer/machine/image/windows-server-2022-gui
name: win/default
resource_class: windows.medium
machine:
image: default
shell: powershell.exe -ExecutionPolicy Bypass
working_directory: ~/mapbox-gl-js

jobs:
Expand Down Expand Up @@ -272,7 +271,6 @@ jobs:
- run: npm run build-csp
- run: npm run build-css
- run: npm run build-style-spec
- run: npm run build-dts
- run: npm run test-build
- run: npm run prepare-release-pages
- run:
Expand Down Expand Up @@ -344,6 +342,7 @@ jobs:
steps:
- attach_workspace:
at: ~/
- run: npm run build-dts
- run:
name: Test public typings
command: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ coverage
.nyc_output
*_generated.js
*_generated.js.map
test/**/__screenshots__/
test/integration/**/index*.html
test/integration/**/actual.png
test/integration/**/actual.json
Expand Down
3 changes: 2 additions & 1 deletion 3d-style/data/bucket/model_bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import type {

import type Context from '../../../src/gl/context';
import type VertexBuffer from '../../../src/gl/vertex_buffer';
import type {FeatureState} from '../../../src/style-spec/expression/index';
import type {FeatureStates} from '../../../src/source/source_state';
import type {SpritePositions} from '../../../src/util/image';
import type {ProjectionSpecification} from '../../../src/style-spec/types';
Expand Down Expand Up @@ -405,7 +406,7 @@ class ModelBucket implements Bucket {
return this.modelUris;
}

evaluate(feature: ModelFeature, featureState: FeatureStates, perModelVertexArray: PerModelAttributes, update: boolean) {
evaluate(feature: ModelFeature, featureState: FeatureState, perModelVertexArray: PerModelAttributes, update: boolean) {
const layer = this.layers[0];
const evaluationFeature = feature.feature;
const canonical = this.canonical;
Expand Down
2 changes: 1 addition & 1 deletion 3d-style/data/bucket/tiled_3d_model_bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ 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) {
mesh.transformedAabb = Aabb.applyTransform(mesh.aabb, this.node.matrix);
mesh.transformedAabb = Aabb.applyTransformFast(mesh.aabb, this.node.matrix);
aabb.encapsulate(mesh.transformedAabb);
}
i++;
Expand Down
2 changes: 1 addition & 1 deletion 3d-style/data/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ export default class Model {
// apply local transform to bounding volume
if (node.meshes) {
for (const mesh of node.meshes) {
const enclosingBounds = Aabb.applyTransform(mesh.aabb, node.matrix);
const enclosingBounds = Aabb.applyTransformFast(mesh.aabb, node.matrix);
this.aabb.encapsulate(enclosingBounds);
}
}
Expand Down
12 changes: 10 additions & 2 deletions 3d-style/render/draw_model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,9 @@ function drawMesh(sortedMesh: SortedMesh, painter: Painter, layer: ModelStyleLay
}

export function prepare(layer: ModelStyleLayer, sourceCache: SourceCache, painter: Painter) {
const modelSource = sourceCache.getSource() as ModelSource | Tiled3DModelSource | VectorTileSource | GeoJSONSource;
const modelSource = sourceCache.getSource();
if (!modelSource.loaded()) return;

if (modelSource.type === 'vector' || modelSource.type === 'geojson') {
const scope = modelSource.type === 'vector' ? layer.scope : "";
if (painter.modelManager) {
Expand All @@ -252,10 +253,14 @@ export function prepare(layer: ModelStyleLayer, sourceCache: SourceCache, painte
}
return;
}

if (modelSource.type === 'batched-model') {
// batched models uploads happen in tile_3d_bucket
return;
}

if (modelSource.type !== 'model') return;

const models = modelSource.getModels();
// Upload models
for (const model of models) {
Expand Down Expand Up @@ -354,7 +359,7 @@ function drawModels(painter: Painter, sourceCache: SourceCache, layer: ModelStyl
}
};

const modelSource = sourceCache.getSource() as ModelSource | Tiled3DModelSource | VectorTileSource | GeoJSONSource;
const modelSource = sourceCache.getSource();
if (painter.renderPass === 'light-beam' && modelSource.type !== 'batched-model') {
return;
}
Expand All @@ -373,6 +378,9 @@ function drawModels(painter: Painter, sourceCache: SourceCache, layer: ModelStyl
cleanup();
return;
}

if (modelSource.type !== 'model') return;

const models = modelSource.getModels();
const modelParametersVector: ModelParameters[] = [];

Expand Down
9 changes: 9 additions & 0 deletions 3d-style/shaders/_prelude_shadow.fragment.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@ float shadowed_light_factor_normal(vec3 N, highp vec4 light_view_pos0, highp vec
return mix(0.0, (1.0 - (u_shadow_intensity * occlusion)) * NDotL, step(0.0, NDotL));
}

float shadowed_light_factor_normal_opacity(vec3 N, highp vec4 light_view_pos0, highp vec4 light_view_pos1, float view_depth, float shadow_opacity) {
float NDotL = dot(N, u_shadow_direction);

float bias = calculate_shadow_bias(NDotL);
float occlusion = shadow_occlusion(light_view_pos0, light_view_pos1, view_depth, bias) * shadow_opacity;

return mix(0.0, (1.0 - (u_shadow_intensity * occlusion)) * NDotL, step(0.0, NDotL));
}

float shadowed_light_factor_normal_unbiased(vec3 N, highp vec4 light_view_pos0, highp vec4 light_view_pos1, float view_depth) {
float NDotL = dot(N, u_shadow_direction);

Expand Down
36 changes: 30 additions & 6 deletions 3d-style/shaders/model.fragment.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,34 @@ uniform highp sampler3D u_lutTexture;

#ifdef TERRAIN_FRAGMENT_OCCLUSION
in highp float v_depth;
uniform sampler2D u_depthTexture;
uniform highp sampler2D u_depthTexture;
uniform vec2 u_inv_depth_size;
uniform vec2 u_depth_range_unpack;

#ifdef TERRAIN_DEPTH_D24
float unpack_depth(float depth) {
return depth * u_depth_range_unpack.x + u_depth_range_unpack.y;
}
#else
// Unpack depth from RGBA. A piece of code copied in various libraries and WebGL
// shadow mapping examples.
// https://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/
highp float unpack_depth_rgba(highp vec4 rgba_depth)
{
const highp vec4 bit_shift = vec4(1.0 / (255.0 * 255.0 * 255.0), 1.0 / (255.0 * 255.0), 1.0 / 255.0, 1.0);
return dot(rgba_depth, bit_shift) * 2.0 - 1.0;
}
#endif

bool isOccluded() {
vec2 coord = gl_FragCoord.xy * u_inv_depth_size;
highp float depth = unpack_depth(texture(u_depthTexture, coord));

#ifdef TERRAIN_DEPTH_D24
highp float depth = unpack_depth(texture(u_depthTexture, coord).r);
#else
highp float depth = unpack_depth_rgba(texture(u_depthTexture, coord));
#endif

// Add some marging to avoid depth precision issues
return v_depth > depth + 0.0005;
}
Expand Down Expand Up @@ -472,6 +494,12 @@ vec4 finalColor;

#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
emissive.rgb *= sRGBToLinear(texture(u_emissionTexture, uv_2f).rgb);
#endif
#ifdef APPLY_LUT_ON_GPU
// Note: the color is multiplied by the length of u_emissiveFactor
// which avoids increasing the brightness if the LUT doesn't have pure black.
float emissiveFactorLength = max(length(u_emissiveFactor.rgb), 0.001);
emissive.rgb = sRGBToLinear(applyLUT(u_lutTexture, linearTosRGB(emissive.rgb / emissiveFactorLength).rbg)) * emissiveFactorLength;
#endif
color += emissive.rgb;

Expand All @@ -494,10 +522,6 @@ 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
6 changes: 3 additions & 3 deletions 3d-style/source/model_source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import Model from '../data/model';
import convertModel from './model_loader';
import {loadGLTF} from '../util/loaders';

import type {ISource} from '../../src/source/source';
import type Tile from '../../src/source/tile';
import type {Callback} from '../../src/types/callback';
import type Dispatcher from '../../src/util/dispatcher';
import type {Map} from '../../src/ui/map';
import type {Callback} from '../../src/types/callback';
import type {ISource, SourceEvents} from '../../src/source/source';
import type {ModelSourceSpecification} from '../../src/style-spec/types';

/**
Expand All @@ -18,7 +18,7 @@ import type {ModelSourceSpecification} from '../../src/style-spec/types';
// Important Note: ModelSource is legacy and should not be offered in the API, as the only valid official sources to add models
// are batched-models and via GeoJson/vector sources. We keep this one (for now) just for ease development and get the render-tests
// passing.
class ModelSource extends Evented implements ISource {
class ModelSource extends Evented<SourceEvents> implements ISource {
type: 'model';
id: string;
scope: string;
Expand Down
12 changes: 6 additions & 6 deletions 3d-style/source/tiled_3d_model_source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ import {postTurnstileEvent} from '../../src/util/mapbox';
// it's registered as a serializable class on the main thread
import '../data/bucket/tiled_3d_model_bucket';

import type Tiled3dModelBucket from '../data/bucket/tiled_3d_model_bucket';
import type {ISource} from '../../src/source/source';
import type Tile from '../../src/source/tile';
import type {Callback} from '../../src/types/callback';
import type {Cancelable} from '../../src/types/cancelable';
import type Dispatcher from '../../src/util/dispatcher';
import type {ModelSourceSpecification} from '../../src/style-spec/types';
import type Tiled3dModelBucket from '../data/bucket/tiled_3d_model_bucket';
import type {Map} from '../../src/ui/map';
import type {Callback} from '../../src/types/callback';
import type {Cancelable} from '../../src/types/cancelable';
import type {OverscaledTileID} from '../../src/source/tile_id';
import type {ISource, SourceEvents} from '../../src/source/source';
import type {ModelSourceSpecification} from '../../src/style-spec/types';

class Tiled3DModelSource extends Evented implements ISource {
class Tiled3DModelSource extends Evented<SourceEvents> implements ISource {
type: 'batched-model';
id: string;
scope: string;
Expand Down
4 changes: 2 additions & 2 deletions 3d-style/style/style_layer/model_style_layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {convertModelMatrixForGlobe, queryGeometryIntersectsProjectedAabb} from '
import type {VectorTileFeature} from '@mapbox/vector-tile';
import Tiled3dModelBucket from '../../data/bucket/tiled_3d_model_bucket';
import type {FeatureFilter} from '../../../src/style-spec/feature_filter/index';
import type {QueryFeature} from '../../../src/source/query_features';
import type {GeoJSONFeature} from '../../../src/util/vectortile_to_geojson';
import {CanonicalTileID} from '../../../src/source/tile_id';
import EvaluationParameters from '../../../src/style/evaluation_parameters';
import type {LUT} from "../../../src/util/lut";
Expand Down Expand Up @@ -173,7 +173,7 @@ class ModelStyleLayer extends StyleLayer {
filter: FeatureFilter,
transform: Transform,
): {
queryFeature: QueryFeature | null | undefined;
queryFeature: GeoJSONFeature | null | undefined;
intersectionZ: number;
} {

Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## 3.5.2

- Improve 3D models rendering performance.
- Slightly improve terrain rendering performance.
- Fix raster particle data decoding and improve rendering quality.
- Fix 3D lighting rendering when lookup tables (LUT) image is applied.
- Fix shadows rendering artifacts on `fill-extrusion-cutoff-fade-range`.
- Improve TypeScript API, including strongly typed Map event listeners, improved type narrowing, and more.

## 3.5.1

- Revert default behavior of symbol occlusion behind terrain to maintain compatibility. Set `icon-occlusion-opacity`/`text-occlusion-opacity` properties to opt-in to new occlusion behavior.
Expand Down
3 changes: 0 additions & 3 deletions build/mapbox-gl.js.flow

This file was deleted.

6 changes: 6 additions & 0 deletions build/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,9 @@ git tag --points-at HEAD | while read tag; do
echo "Unrecognized tag: $tag"
fi
done

if [ -n "$(git tag --points-at HEAD)" ]; then
node build/generate-release-list.js &&
aws s3 cp --acl public-read --content-type application/json dist/versions.json s3://mapbox-gl-js/versions.json &&
aws s3 cp --acl public-read --content-type application/javascript dist/versions.jsonp s3://mapbox-gl-js/versions.jsonp
fi
Loading
Loading