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.2.0 #13101

Merged
merged 26 commits into from
Mar 1, 2024
Merged

v3.2.0 #13101

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
022a8cd
Only generate atlas mipmaps for tiles that have patterns (internal-1148)
endanke Feb 19, 2024
424472a
Bump `@mapbox/mapbox-gl-supported` to v3 (internal-1150)
stepankuzmin Feb 19, 2024
fcb8f69
Bump eslint-plugin-jsdoc from 48.0.6 to 48.1.0 (internal-1152)
dependabot[bot] Feb 20, 2024
c0ed955
Bump selenium-webdriver from 4.17.0 to 4.18.0 (internal-1153)
dependabot[bot] Feb 20, 2024
9e918df
Bump tape from 5.7.4 to 5.7.5 (internal-1155)
dependabot[bot] Feb 20, 2024
8a4b0b6
[MAPS3D-1265] Fix tile ordering for overlap case. (internal-1149)
alexey-romanov Feb 20, 2024
5f43544
Improve typings (internal-1151)
stepankuzmin Feb 21, 2024
8eccb32
Tracked Parameters - remove rollup alias plugin warning (internal-1160)
alexey-romanov Feb 22, 2024
390a39f
Refactor Tracked Parameters UI (internal-1162)
stepankuzmin Feb 22, 2024
d934b25
Add test to verify cutoff-fade-range on lower zoom levels (internal-1…
endanke Feb 22, 2024
1c2a522
Fix debug pages (internal-1163)
stepankuzmin Feb 22, 2024
138f81c
draw terrain proxy tile borders with silhouetting (internal-1164)
alexey-romanov Feb 22, 2024
7a88b24
Fix tweakpane button hover (internal-1173)
stepankuzmin Feb 23, 2024
51432dc
Use highp precision for fill outline inputs (internal-1171)
endanke Feb 23, 2024
2c2ab38
Tracker Parameters - allow buttons. Expose terrain proxy cache parame…
alexey-romanov Feb 23, 2024
0065a4c
Fix devtools container (internal-1175)
stepankuzmin Feb 23, 2024
4176168
[GLJS-712] Fix config serialization issue when configuration value is…
zmiao Feb 26, 2024
0be1dd3
Improve Flow typings (internal-1165)
stepankuzmin Feb 26, 2024
4203bce
Bump selenium-webdriver from 4.18.0 to 4.18.1 (internal-1183)
dependabot[bot] Feb 27, 2024
4766213
Bump testem from 3.11.0 to 3.12.0 (internal-1186)
dependabot[bot] Feb 27, 2024
cb66b85
Bump eslint-plugin-jsdoc from 48.1.0 to 48.2.0 (internal-1185)
dependabot[bot] Feb 27, 2024
d35d760
[GLJS-643] Run unit tests with Vitest (internal-713)
stepankuzmin Feb 27, 2024
9c58cc0
Bump playwright from 1.41.1 to 1.41.2 (internal-1192)
dependabot[bot] Feb 27, 2024
d66267c
Remove tap-related legacy dependencies (internal-1194)
mourner Feb 27, 2024
cb3622b
Add occlusion texture transform for meshopt support in gl-native (int…
jtorresfabra Feb 28, 2024
d6eacf6
v3.2.0 (internal-1198)
mourner Feb 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
27 changes: 0 additions & 27 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,6 @@ workflows:
filters:
tags:
only: /.*/
- test-browser:
requires:
- prepare-linux
filters:
tags:
only: /.*/
- test-webpack:
requires:
- build
Expand Down Expand Up @@ -327,27 +321,6 @@ jobs:
yarn run codegen
git add -A && git diff --staged --exit-code | tee check.patch

test-browser:
<<: *linux-defaults
steps:
- attach_workspace:
at: ~/
- browser-tools/install-browser-tools:
chrome-version: "114.0.5735.90"
- run: yarn run build-token
- run:
name: Test Chrome
environment:
SELENIUM_BROWSER: chrome
TAP_COLORS: 1
command: yarn run test-browser
- run:
name: Test Firefox
environment:
SELENIUM_BROWSER: firefox
TAP_COLORS: 1
command: yarn run test-browser

test-expressions:
<<: *linux-defaults
steps:
Expand Down
6 changes: 1 addition & 5 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,7 @@
}
}
],
"globals": {
"performance": true
},
"env": {
"es6": true,
"browser": false
"es6": true
}
}
1 change: 0 additions & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
.*/node_modules/@mapbox/geojson-types/fixtures/.*
.*/node_modules/browserify/.*
.*/node_modules/nyc/.*
.*/node_modules/jsdom/.*
.*/node_modules/eslint.*/.*
.*/node_modules/highlight.*/.*
.*/node_modules/@?babel.*/.*
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ yarn-error.log
yarn-debug.log
npm-debug.log
.idea
# https://github.com/vitejs/vite/issues/9470
vitest.config.js.*
17 changes: 9 additions & 8 deletions 3d-style/data/bucket/model_bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@ import EXTENT from '../../../src/style-spec/data/extent.js';
import {register} from '../../../src/util/web_worker_transfer.js';
import loadGeometry from '../../../src/data/load_geometry.js';
import toEvaluationFeature from '../../../src/data/evaluation_feature.js';
import type {EvaluationFeature} from '../../../src/data/evaluation_feature.js';
import EvaluationParameters from '../../../src/style/evaluation_parameters.js';
import Point from '@mapbox/point-geometry';
import {vec3} from 'gl-matrix';
import {InstanceVertexArray} from '../../../src/data/array_types.js';
import assert from 'assert';
import {warnOnce} from '../../../src/util/util.js';
import ModelStyleLayer from '../../style/style_layer/model_style_layer.js';
import {rotationScaleYZFlipMatrix} from '../../util/model_util.js';
import {tileToMeter} from '../../../src/geo/mercator_coordinate.js';
import {instanceAttributes} from '../model_attributes.js';

import type {EvaluationFeature} from '../../../src/data/evaluation_feature.js';
import type {Mat4} from 'gl-matrix';
import type {CanonicalTileID, OverscaledTileID} from '../../../src/source/tile_id.js';
import type {
Expand All @@ -25,13 +33,6 @@ import type {SpritePositions} from '../../../src/util/image.js';
import type {ProjectionSpecification} from '../../../src/style-spec/types.js';
import type {TileTransform} from '../../../src/geo/projection/tile_transform.js';
import type {IVectorTileLayer} from '@mapbox/vector-tile';
import {InstanceVertexArray} from '../../../src/data/array_types.js';
import assert from 'assert';
import {warnOnce} from '../../../src/util/util.js';
import ModelStyleLayer from '../../style/style_layer/model_style_layer.js';
import {rotationScaleYZFlipMatrix} from '../../util/model_util.js';
import {tileToMeter} from '../../../src/geo/mercator_coordinate.js';
import {instanceAttributes} from '../model_attributes.js';

class ModelFeature {
feature: EvaluationFeature;
Expand Down
23 changes: 12 additions & 11 deletions 3d-style/data/bucket/tiled_3d_model_bucket.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
// @flow

import {register} from '../../../src/util/web_worker_transfer.js';
import type {Bucket} from '../../../src/data/bucket.js';
import type {Node} from '../model.js';
import {uploadNode, destroyNodeArrays, destroyBuffers, ModelTraits, HEIGHTMAP_DIM} from '../model.js';
import type {EvaluationFeature} from '../../../src/data/evaluation_feature.js';
import {OverscaledTileID} from '../../../src/source/tile_id.js';
import type {CanonicalTileID} from '../../../src/source/tile_id.js';
import ModelStyleLayer from '../../style/style_layer/model_style_layer.js';
import type Context from '../../../src/gl/context.js';
import type {ProjectionSpecification} from '../../../src/style-spec/types.js';
import type Painter from '../../../src/render/painter.js';
import type {Vec4} from 'gl-matrix';
import {ReplacementSource} from '../../source/replacement_source.js';
import {FeatureVertexArray} from '../../../src/data/array_types.js';
import {number as interpolate} from '../../../src/style-spec/util/interpolate.js';
import {clamp} from '../../../src/util/util.js';
import {DEMSampler} from '../../../src/terrain/elevation.js';
import type {Terrain} from '../../../src/terrain/terrain.js';
import {ZoomConstantExpression} from '../../../src/style-spec/expression/index.js';
import assert from 'assert';
import Point from '@mapbox/point-geometry';
import browser from '../../../src/util/browser.js';

import type {Bucket} from '../../../src/data/bucket.js';
import type {Node} from '../model.js';
import type {EvaluationFeature} from '../../../src/data/evaluation_feature.js';
import type {CanonicalTileID} from '../../../src/source/tile_id.js';
import type Context from '../../../src/gl/context.js';
import type {ProjectionSpecification} from '../../../src/style-spec/types.js';
import type Painter from '../../../src/render/painter.js';
import type {Vec4} from 'gl-matrix';
import type {Terrain} from '../../../src/terrain/terrain.js';

const lookup = new Float32Array(512 * 512);
const passLookup = new Uint8Array(512 * 512);

Expand Down Expand Up @@ -183,7 +184,7 @@ class Tiled3dModelBucket implements Bucket {
const canonical = this.id.canonical;
for (const nodeInfo of nodesInfo) {
const evaluationFeature = nodeInfo.feature;
nodeInfo.evaluatedScale = (layer.paint.get('model-scale').evaluate(evaluationFeature, {}, canonical): any);
nodeInfo.evaluatedScale = layer.paint.get('model-scale').evaluate(evaluationFeature, {}, canonical);
}
}

Expand Down Expand Up @@ -224,7 +225,7 @@ class Tiled3dModelBucket implements Bucket {
} else {
nodeInfo.evaluatedRMEA[0][2] = layer.paint.get('model-emissive-strength').evaluate(evaluationFeature, {}, canonical);
}
nodeInfo.evaluatedScale = (layer.paint.get('model-scale').evaluate(evaluationFeature, {}, canonical): any);
nodeInfo.evaluatedScale = layer.paint.get('model-scale').evaluate(evaluationFeature, {}, canonical);
if (!this.updatePbrBuffer(nodeInfo.node)) {
this.needsUpload = true;
}
Expand Down
15 changes: 8 additions & 7 deletions 3d-style/data/model.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
// @flow

import type Painter from '../../src/render/painter.js';
import LngLat from '../../src/geo/lng_lat.js';
import Color from "../../src/style-spec/util/color.js";
import Color from '../../src/style-spec/util/color.js';
import Texture from '../../src/render/texture.js';
import type IndexBuffer from '../../src/gl/index_buffer.js';
import {ModelLayoutArray, TriangleIndexArray, NormalLayoutArray, TexcoordLayoutArray, FeatureVertexArray} from '../../src/data/array_types.js';
import {StructArray} from '../../src/util/struct_array.js';
import type VertexBuffer from '../../src/gl/vertex_buffer.js';
import type {Mat4, Vec2, Vec3, Vec4, Quat} from 'gl-matrix';
import type Context from "../../src/gl/context.js";
import {Aabb} from '../../src/util/primitives.js';
import {mat4, vec4} from 'gl-matrix';
import {modelAttributes, normalAttributes, texcoordAttributes, color3fAttributes, color4fAttributes, featureAttributes} from './model_attributes.js';
import type {TextureImage, TextureWrap, TextureFilter} from '../../src/render/texture.js';
import SegmentVector from '../../src/data/segment.js';
import {globeToMercatorTransition} from '../../src/geo/projection/globe_util.js';
import {number as interpolate} from '../../src/style-spec/util/interpolate.js';
import MercatorCoordinate, {getMetersPerPixelAtLatitude, getLatitudeScale, mercatorZfromAltitude} from '../../src/geo/mercator_coordinate.js';
import Transform from '../../src/geo/transform.js';
import {rotationScaleYZFlipMatrix, getBoxBottomFace, rotationFor3Points, convertModelMatrixForGlobe} from '../util/model_util.js';

import type Point from '@mapbox/point-geometry';
import type {Mat4, Vec2, Vec3, Vec4, Quat} from 'gl-matrix';
import type Context from '../../src/gl/context.js';
import type IndexBuffer from '../../src/gl/index_buffer.js';
import type Painter from '../../src/render/painter.js';
import type TriangleGridIndex from '../../src/util/triangle_grid_index.js';
import type VertexBuffer from '../../src/gl/vertex_buffer.js';
import type {TextureImage, TextureWrap, TextureFilter} from '../../src/render/texture.js';

export type Sampler = {
minFilter: TextureFilter;
Expand Down
18 changes: 9 additions & 9 deletions 3d-style/render/draw_model.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
// @flow

import type Painter from '../../src/render/painter.js';
import type {CreateProgramParams} from '../../src/render/painter.js';
import type SourceCache from '../../src/source/source_cache.js';
import type ModelStyleLayer from '../style/style_layer/model_style_layer.js';

import {modelUniformValues, modelDepthUniformValues} from './program/model_program.js';
import type {Mesh, Node, ModelTexture} from '../data/model.js';
import {ModelTraits, DefaultModelScale} from '../data/model.js';
import type {DynamicDefinesType} from '../../src/render/program/program_uniforms.js';

import Transform from '../../src/geo/transform.js';
import EXTENT from '../../src/style-spec/data/extent.js';
Expand All @@ -17,13 +10,11 @@ import ColorMode from '../../src/gl/color_mode.js';
import DepthMode from '../../src/gl/depth_mode.js';
import CullFaceMode from '../../src/gl/cull_face_mode.js';
import {mat4, vec3} from 'gl-matrix';
import type {Mat4} from 'gl-matrix';
import {getMetersPerPixelAtLatitude, mercatorZfromAltitude} from '../../src/geo/mercator_coordinate.js';
import TextureSlots from './texture_slots.js';
import {convertModelMatrixForGlobe} from '../util/model_util.js';
import {clamp, warnOnce} from '../../src/util/util.js';
import ModelBucket from '../data/bucket/model_bucket.js';
import type VertexBuffer from '../../src/gl/vertex_buffer.js';
import Tiled3dModelBucket from '../data/bucket/tiled_3d_model_bucket.js';
import assert from 'assert';
import {DEMSampler} from '../../src/terrain/elevation.js';
Expand All @@ -33,6 +24,15 @@ import {getCutoffParams} from '../../src/render/cutoff.js';
import {FOG_OPACITY_THRESHOLD} from '../../src/style/fog_helpers.js';
import {ZoomDependentExpression} from '../../src/style-spec/expression/index.js';

import type Painter from '../../src/render/painter.js';
import type {CreateProgramParams} from '../../src/render/painter.js';
import type SourceCache from '../../src/source/source_cache.js';
import type ModelStyleLayer from '../style/style_layer/model_style_layer.js';
import type {Mesh, Node, ModelTexture} from '../data/model.js';
import type {DynamicDefinesType} from '../../src/render/program/program_uniforms.js';
import type {Mat4} from 'gl-matrix';
import type VertexBuffer from '../../src/gl/vertex_buffer.js';

export default drawModels;

type ModelParameters = {
Expand Down
2 changes: 1 addition & 1 deletion 3d-style/render/lights.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// @flow

import Context from '../../src/gl/context.js';
import type {UniformValues} from '../../src/render/uniform_binding.js';
import {Uniform3f} from '../../src/render/uniform_binding.js';
import {sRGBToLinearAndScale, linearVec3TosRGB, clamp} from '../../src/util/util.js';
import {vec3} from 'gl-matrix';

import Lights from '../style/lights.js';
import type {UniformValues} from '../../src/render/uniform_binding.js';
import type {LightProps as Ambient} from '../style/ambient_light_properties.js';
import type {LightProps as Directional} from '../style/directional_light_properties.js';
import type {Vec3} from 'gl-matrix';
Expand Down
7 changes: 4 additions & 3 deletions 3d-style/render/program/model_program.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import {
UniformMatrix4f
} from '../../../src/render/uniform_binding.js';

import Color from '../../../src/style-spec/util/color.js';
import ModelStyleLayer from '../../style/style_layer/model_style_layer.js';
import TextureSlots from '../texture_slots.js';

import type {UniformValues} from '../../../src/render/uniform_binding.js';
import type Context from '../../../src/gl/context.js';
import type Painter from '../../../src/render/painter.js';
import type {Material} from '../../data/model.js';
import Color from '../../../src/style-spec/util/color.js';
import ModelStyleLayer from '../../style/style_layer/model_style_layer.js';
import TextureSlots from '../texture_slots.js';

export type ModelUniformsType = {
'u_matrix': UniformMatrix4f,
Expand Down
11 changes: 6 additions & 5 deletions 3d-style/render/shadow_renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,26 @@ import {FreeCamera} from '../../src/ui/free_camera.js';
import {OverscaledTileID, UnwrappedTileID} from '../../src/source/tile_id.js';
import Painter from '../../src/render/painter.js';
import Program from '../../src/render/program.js';
import type {UniformValues} from '../../src/render/uniform_binding.js';
import {mercatorZfromAltitude, tileToMeter} from '../../src/geo/mercator_coordinate.js';
import {cartesianPositionToSpherical, sphericalPositionToCartesian, clamp, linearVec3TosRGB} from '../../src/util/util.js';

import type {LightProps as Directional} from '../style/directional_light_properties.js';
import type {LightProps as Ambient} from '../style/ambient_light_properties.js';
import Lights from '../style/lights.js';
import {defaultShadowUniformValues} from '../render/shadow_uniforms.js';
import type {ShadowUniformsType} from '../render/shadow_uniforms.js';
import TextureSlots from './texture_slots.js';

import assert from 'assert';

import {mat4, vec3} from 'gl-matrix';
import type {Mat4, Vec3, Vec4} from 'gl-matrix';
import {groundShadowUniformValues} from './program/ground_shadow_program.js';
import EXTENT from '../../src/style-spec/data/extent.js';
import {getCutoffParams} from '../../src/render/cutoff.js';

import type {UniformValues} from '../../src/render/uniform_binding.js';
import type {LightProps as Directional} from '../style/directional_light_properties.js';
import type {LightProps as Ambient} from '../style/ambient_light_properties.js';
import type {ShadowUniformsType} from '../render/shadow_uniforms.js';
import type {Mat4, Vec3, Vec4} from 'gl-matrix';

type ShadowCascade = {
framebuffer: Framebuffer,
texture: Texture,
Expand Down
13 changes: 12 additions & 1 deletion 3d-style/shaders/model.fragment.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ in vec4 v_pos_light_view_1;
in float v_depth_shadows;
#endif

#ifdef OCCLUSION_TEXTURE_TRANSFORM
// offset[0], offset[1], scale[0], scale[1]
uniform vec4 u_occlusionTextureTransform;
#endif

#pragma mapbox: define-attribute highp vec3 normal_3f
#pragma mapbox: define-attribute highp vec3 color_3f
#pragma mapbox: define-attribute highp vec4 color_4f
Expand Down Expand Up @@ -445,7 +450,13 @@ vec4 finalColor;
// Ambient Occlusion
float ao = 1.0;
#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
ao = (texture(u_occlusionTexture, uv_2f).x - 1.0) * u_aoIntensity + 1.0;

#ifdef OCCLUSION_TEXTURE_TRANSFORM
vec2 uv = uv_2f.xy * u_occlusionTextureTransform.zw + u_occlusionTextureTransform.xy;
#else
vec2 uv = uv_2f;
#endif
ao = (texture(u_occlusionTexture, uv).x - 1.0) * u_aoIntensity + 1.0;
color *= ao;
#endif
// Emission
Expand Down
8 changes: 4 additions & 4 deletions 3d-style/source/model_loader.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
// @flow

import {type Footprint, type Mesh, type Node, type Material, type ModelTexture, type Sampler, type AreaLight, HEIGHTMAP_DIM} from '../data/model.js';
import type {TextureImage} from '../../src/render/texture.js';
import {Aabb} from '../../src/util/primitives.js';
import Color from '../../src/style-spec/util/color.js';
import type {Vec2, Vec3} from 'gl-matrix';
import {mat4, vec3} from 'gl-matrix';
import {TriangleIndexArray,
ModelLayoutArray,
Expand All @@ -18,14 +16,16 @@ import {GLTF_TO_ARRAY_TYPE, GLTF_COMPONENTS, GLTF_USHORT, GLTF_FLOAT} from '../u
import Point from '@mapbox/point-geometry';
import earcut from 'earcut';

import window from '../../src/util/window.js';
import {warnOnce, base64DecToArr} from '../../src/util/util.js';
import assert from 'assert';
import TriangleGridIndex from '../../src/util/triangle_grid_index.js';

import type {Vec2, Vec3} from 'gl-matrix';
import type {TextureImage} from '../../src/render/texture.js';

function convertTextures(gltf: Object, images: Array<TextureImage>): Array<ModelTexture> {
const textures: ModelTexture[] = [];
const gl = window.WebGL2RenderingContext;
const gl = WebGL2RenderingContext;
if (gltf.json.textures) {
for (const textureDesc of gltf.json.textures) {
const sampler: Sampler = {
Expand Down
11 changes: 6 additions & 5 deletions 3d-style/source/model_source.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
// @flow

import {Evented, ErrorEvent, Event} from '../../src/util/evented.js';
import {ResourceType} from '../../src/util/ajax.js';

import Model from '../data/model.js';
import convertModel from './model_loader.js';
import {loadGLTF} from '../util/loaders.js';

import type {Source} from '../../src/source/source.js';
import type Tile from '../../src/source/tile.js';
import type {Callback} from '../../src/types/callback.js';
import type Dispatcher from '../../src/util/dispatcher.js';
import {ResourceType} from '../../src/util/ajax.js';
import type Map from '../../src/ui/map.js';

import type {ModelSourceSpecification} from '../../src/style-spec/types.js';
import Model from '../data/model.js';
import convertModel from './model_loader.js';
import {loadGLTF} from '../util/loaders.js';

/**
* A source containing single models.
Expand Down