diff --git a/.circleci/config.yml b/.circleci/config.yml index 34573b09483..646d54b8cc1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -177,7 +177,7 @@ workflows: linux-defaults: &linux-defaults docker: - - image: cimg/node:18.20-browsers + - image: cimg/node:20.15-browsers working_directory: ~/mapbox-gl-js mac-defaults: &mac-defaults diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 2ece201a3e0..0822bc9ea53 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -38,6 +38,12 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - if: matrix.language == 'javascript-typescript' + name: Setup Node.js 20.x + uses: actions/setup-node@v4 + with: + node-version: 20.x + # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v2 diff --git a/.nvmrc b/.nvmrc index 123b052798d..b8e593f5210 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -18.20.2 +20.15.1 diff --git a/3d-style/render/shadow_renderer.ts b/3d-style/render/shadow_renderer.ts index 968767a98fc..c9ceca202aa 100644 --- a/3d-style/render/shadow_renderer.ts +++ b/3d-style/render/shadow_renderer.ts @@ -54,6 +54,7 @@ type ShadowNormalOffsetMode = 'vector-tile' | 'model-tile'; const shadowParameters = { cascadeCount: 2, + normalOffset: 3, shadowMapResolution: 2048 }; @@ -168,6 +169,7 @@ export class ShadowRenderer { painter.tp.registerParameter(this, ["Shadows"], "_forceDisable", {label: "forceDisable"}, () => { this.painter.style.map.triggerRepaint(); }); painter.tp.registerParameter(shadowParameters, ["Shadows"], "cascadeCount", {min: 1, max: 2, step: 1}); + painter.tp.registerParameter(shadowParameters, ["Shadows"], "normalOffset", {min: 0, max: 10, step: 0.05}); painter.tp.registerParameter(shadowParameters, ["Shadows"], "shadowMapResolution", {min: 32, max: 2048, step: 32}); painter.tp.registerBinding(this, ["Shadows"], "_numCascadesToRender", {readonly: true, label: 'numCascadesToRender'}); } @@ -500,7 +502,7 @@ export class ShadowRenderer { this.useNormalOffset = normalOffset; if (normalOffset) { - const scale = 5.0; // Experimentally found value + const scale = shadowParameters.normalOffset; uniforms["u_shadow_normal_offset"] = [1.0, scale, scale]; // meterToTile isn't used uniforms["u_shadow_bias"] = [0.00006, 0.0012, 0.012]; // Reduce constant offset } else { diff --git a/3d-style/shaders/_prelude_shadow.vertex.glsl b/3d-style/shaders/_prelude_shadow.vertex.glsl index 46cfcd3a9d7..c28a750f0ef 100644 --- a/3d-style/shaders/_prelude_shadow.vertex.glsl +++ b/3d-style/shaders/_prelude_shadow.vertex.glsl @@ -14,7 +14,9 @@ vec3 shadow_normal_offset(vec3 normal) { } vec3 shadow_normal_offset_model(vec3 normal) { - float dotScale = min(1.0 - dot(normal, u_shadow_direction), 1.0) * 0.5 + 0.5; + vec3 transformed_normal = vec3(-normal.xy, normal.z); + float NDotL = dot(normalize(transformed_normal), u_shadow_direction); + float dotScale = min(1.0 - NDotL, 1.0) * 0.5 + 0.5; return normal * dotScale; } diff --git a/3d-style/shaders/model.fragment.glsl b/3d-style/shaders/model.fragment.glsl index f78252830ab..dcf9d097224 100644 --- a/3d-style/shaders/model.fragment.glsl +++ b/3d-style/shaders/model.fragment.glsl @@ -19,8 +19,8 @@ in highp vec4 v_position_height; in lowp vec4 v_color_mix; #ifdef RENDER_SHADOWS -in vec4 v_pos_light_view_0; -in vec4 v_pos_light_view_1; +in highp vec4 v_pos_light_view_0; +in highp vec4 v_pos_light_view_1; in float v_depth_shadows; #endif diff --git a/3d-style/shaders/model.vertex.glsl b/3d-style/shaders/model.vertex.glsl index ae5e0ca997c..079e808de5b 100644 --- a/3d-style/shaders/model.vertex.glsl +++ b/3d-style/shaders/model.vertex.glsl @@ -39,8 +39,8 @@ uniform highp mat4 u_normal_matrix; #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0; uniform mat4 u_light_matrix_1; -out vec4 v_pos_light_view_0; -out vec4 v_pos_light_view_1; +out highp vec4 v_pos_light_view_0; +out highp vec4 v_pos_light_view_1; out float v_depth_shadows; #endif @@ -181,7 +181,7 @@ void main() { vec3 offset = shadow_normal_offset(vec3(-normal_3f.xy, normal_3f.z)); shadow_pos.xyz += offset * shadow_normal_offset_multiplier0(); #else - vec3 offset = shadow_normal_offset_model(normalize(normal_3f)); + vec3 offset = shadow_normal_offset_model(normal_3f); shadow_pos.xyz += offset * shadow_normal_offset_multiplier0(); #endif #endif // HAS_ATTRIBUTE_a_normal_3f diff --git a/CHANGELOG.md b/CHANGELOG.md index fe0c20e5732..ce707d1cb02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,21 @@ +## 3.6.0-beta.1 + +### Features and improvements ✨ +- Improve initial load performance. +- Add inner glow effect for negative `circle-blur` values. +- Add support for inlining TileJSON in style source definitions using `data` field. +- Improve 3D models' shadow appearance. +- Improve performance of updating config values of a style. +- Add more descriptive expression evaluation error messages. +- Improve TypeScript typings. + +### Bug fixes 🐞 +- Fix `isSourceLoaded` flag on `sourcedata` event for already loaded sources. +- Fix firing `load` event when all tiles fail to load. +- Fix performance issues when GeoJSON in `dynamic` mode is updated too frequently. +- Fix rasterarray layer flickering from stale tiles cache. +- Fix spikes when viewing terrain-enabled maps in certain environments. + ## 3.5.2 - Improve 3D models rendering performance. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2053abb70b2..f28591b9350 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,9 +9,9 @@ Install the Xcode Command Line Tools Package xcode-select --install ``` -Install [node.js](https://nodejs.org/) version 18 +Install [node.js](https://nodejs.org/) version 20 ```bash -brew install node@18 +brew install node@20 ``` Clone the repository @@ -26,10 +26,10 @@ npm install ### Linux -Install [git](https://git-scm.com/), [node.js](https://nodejs.org/) version 18, [GNU Make](http://www.gnu.org/software/make/), and libglew-dev +Install [git](https://git-scm.com/), [node.js](https://nodejs.org/) version 20, [GNU Make](http://www.gnu.org/software/make/), and libglew-dev ```bash sudo apt-get update -curl -sL https://deb.nodesource.com/setup_18.x | sudo bash - +curl -sL https://deb.nodesource.com/setup_20.x | sudo bash - sudo apt-get install build-essential git nodejs libglew-dev libxi-dev ``` @@ -45,7 +45,7 @@ npm install ### Windows -Install [git](https://git-scm.com/), [node.js](https://nodejs.org/) version 18, [npm and node-gyp](https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#compiling-native-addon-modules). +Install [git](https://git-scm.com/), [node.js](https://nodejs.org/) version 20, [npm and node-gyp](https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#compiling-native-addon-modules). Clone the repository ```bash diff --git a/build/generate-typed-style-spec.ts b/build/generate-typed-style-spec.ts index fa4064e0d1f..0fdbaba40c0 100644 --- a/build/generate-typed-style-spec.ts +++ b/build/generate-typed-style-spec.ts @@ -236,6 +236,7 @@ export type ResolvedImageSpecification = string; export type PromoteIdSpecification = {[_: string]: string} | string; export type FilterSpecification = + | ExpressionSpecification | ['has', string] | ['!has', string] | ['==', string, string | number | boolean] diff --git a/build/publish.sh b/build/publish.sh index 730e8255bf3..4d080f6518d 100755 --- a/build/publish.sh +++ b/build/publish.sh @@ -35,9 +35,3 @@ 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 diff --git a/build/upload.sh b/build/upload.sh index 78c25ddc6de..de116729138 100755 --- a/build/upload.sh +++ b/build/upload.sh @@ -88,3 +88,6 @@ do aws s3 cp --acl public-read --content-type ${mimetype} ./dist/${file} s3://mapbox-gl-js/${tag}/${file} fi done + +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 diff --git a/buildspec.yml b/buildspec.yml index cbb684656e0..eec31a951d5 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -3,7 +3,7 @@ version: 0.2 phases: install: runtime-versions: - nodejs: 18 + nodejs: 20 commands: - echo "//registry.npmjs.org/:_authToken=$NPMAccessToken" > ~/.npmrc - npm whoami diff --git a/debug/circles.html b/debug/circles.html index 902ebd9ce6f..b52981296f4 100644 --- a/debug/circles.html +++ b/debug/circles.html @@ -22,6 +22,7 @@


+
@@ -101,6 +102,12 @@ map.setProjection(this.checked ? "globe" : null); }; +document.getElementById('blur-slider').oninput = function() { + const glow = parseInt(this.value) / 100.0; + map.setPaintProperty("circles", 'circle-blur', glow); + document.getElementById('glow').innerHTML = glow; +}; + let hovered = []; window.addEventListener('mousemove', function(e) { e.point = new mapboxgl.Point(e.clientX, e.clientY); diff --git a/debug/i18n.html b/debug/i18n.html index ca189c9d5f6..7575977651e 100644 --- a/debug/i18n.html +++ b/debug/i18n.html @@ -153,7 +153,7 @@ }); map.addControl(new mapboxgl.ScaleControl()); -mapboxgl.setRTLTextPlugin('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js'); +mapboxgl.setRTLTextPlugin('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.3.0/mapbox-gl-rtl-text.js'); map.on('style.load', () => { map.addSource('mapbox://mapbox.mapbox-streets-v8-i18n', { diff --git a/debug/raster-particle-layer.html b/debug/raster-particle-layer.html index b90fd15b4af..50f7172097d 100644 --- a/debug/raster-particle-layer.html +++ b/debug/raster-particle-layer.html @@ -60,51 +60,18 @@