diff --git a/.idea/prettier.xml b/.idea/prettier.xml new file mode 100644 index 000000000000..63c9d9948ee9 --- /dev/null +++ b/.idea/prettier.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/.slackbot.yml b/.slackbot.yml deleted file mode 100644 index e2cfc9e9c6ac..000000000000 --- a/.slackbot.yml +++ /dev/null @@ -1,11 +0,0 @@ -releaseSchedule: - - jjspace, 4/1/2024 - - ggetz, 5/1/2024 - - jjhembd, 6/1/2024 - - ggetz, 7/1/2024 - - jjhembd, 8/1/2024 - - jjspace, 9/1/2024 - - ggetz, 10/1/2024 - - lukemckinstry, 11/1/2024 - - jjspace, 12/1/2024 - diff --git a/.vscode/cspell.json b/.vscode/cspell.json index e247f0c4a285..f8083d9b09d2 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -36,6 +36,7 @@ "3DTILES", "aabb", "Amato", + "basisu", "bathymetric", "bitangent", "bitangents", @@ -43,6 +44,7 @@ "Bourke", "brdf", "cartesians", + "carto", "cartographics", "cesiumjs", "comms", @@ -93,6 +95,7 @@ "unregisters", "unrenderable", "voxel", + "VVLH", "WEBG", "xdescribe" ] diff --git a/CHANGES.md b/CHANGES.md index f430332fe688..b3751eaadc0f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,10 +1,29 @@ # Change Log +### 1.126 - 2025-02-03 + +#### @cesium/engine + +##### Fixes :wrench: + +- Fixed error when resetting `Cesium3DTileset.modelMatrix` to its initial value. [#12409](https://github.com/CesiumGS/cesium/pull/12409) +- Fixed the parameter types of the `ClippingPolygon.equals` function, and fixed cases where parameters to `equals` functions had erroneously not been marked as 'optional'. [#12394](https://github.com/CesiumGS/cesium/pull/12394) +- Fixed type of `ImageryLayer.fromProviderAsync`, to correctly show that the param `options` is optional. [#12400](https://github.com/CesiumGS/cesium/pull/12400) + ### 1.125 - 2025-01-02 +#### @cesium/engine + +##### Additions :tada: + +- Expanded integration with the [iTwin Platform](https://developer.bentley.com/) to load GeoJSON and KML data from the Reality Management API. Use `ITwinData.createDataSourceForRealityDataId` to load data as either GeoJSON or KML`. [#12344](https://github.com/CesiumGS/cesium/pull/12344) +- Added `environmentMapOptions` to `ModelGraphics`. For performance reasons by default, the environment map will not update if the entity position change. If environment map updates based on entity position are desired, provide an appropriate `environmentMapOptions.maximumPositionEpsilon` value. [#12358](https://github.com/CesiumGS/cesium/pull/12358) + ##### Fixes :wrench: -- Fixed JulianDate to always generate valid ISO strings for fractional milliseconds [#12345](https://github.com/CesiumGS/cesium/pull/12345) +- Reduced memory usage and performance bottlenecks when using environment maps with models. [#12356](https://github.com/CesiumGS/cesium/issues/12356) +- Fixed `JulianDate` to always generate valid ISO strings for fractional milliseconds. [#12345](https://github.com/CesiumGS/cesium/pull/12345) +- Fixed intermittent z-fighting issue. [#12337](https://github.com/CesiumGS/cesium/issues/12337) ### 1.124 - 2024-12-02 @@ -13,7 +32,7 @@ ##### Additions :tada: - Added an integration with the [iTwin Platform](https://developer.bentley.com/) to load iModels as 3D Tiles. Use `ITwinPlatform.defaultAccessToken` to set the access token. Use `ITwinData.createTilesetFromIModelId(iModelId)` to load the iModel as a `Cesium3DTileset`. [#12289](https://github.com/CesiumGS/cesium/pull/12289) -- Added an integration with the [iTwin Platform](https://developer.bentley.com/) to load Reality Data terrain meshes and GeoJSON. Use `ITwinPlatform.defaultAccessToken` to set the access token. Then use `ITwinData.createTilesetForRealityDataId(iTwinId, dataId)` to load terrain meshes as a `Cesium3DTileset` or `ITwinData.createDataSourceForRealityDataId(iTwinId, dataId)` to load GeoJSON or KML files as data sources. [#12344](https://github.com/CesiumGS/cesium/pull/12344) +- Added an integration with the [iTwin Platform](https://developer.bentley.com/) to load Reality Data terrain meshes. Use `ITwinPlatform.defaultAccessToken` to set the access token. Then use `ITwinData.createTilesetForRealityDataId(iTwinId, dataId)` to load terrain meshes as a `Cesium3DTileset` [#12334](https://github.com/CesiumGS/cesium/pull/12334) - Added `getSample` to `SampledProperty` to get the time of samples. [#12253](https://github.com/CesiumGS/cesium/pull/12253) - Added `Entity.trackingReferenceFrame` property to allow tracking entities in various reference frames. [#12194](https://github.com/CesiumGS/cesium/pull/12194), [#12314](https://github.com/CesiumGS/cesium/pull/12314) - `TrackingReferenceFrame.AUTODETECT` (default): uses either VVLH or ENU depending on entity's dynamic. Use `TrackingReferenceFrame.ENU` if your camera orientation flips abruptly from time to time. @@ -96,9 +115,6 @@ - Fix flickering issue caused by bounding sphere retrieval being blocked by the bounding sphere of another entity. [#12230](https://github.com/CesiumGS/cesium/pull/12230) - Fixed `ImageBasedLighting.imageBasedLightingFactor` not affecting lighting. [#12129](https://github.com/CesiumGS/cesium/pull/12129) - Fix error with normalization of corner points for lines and corridors with collinear points. [#12255](https://github.com/CesiumGS/cesium/pull/12255) - -##### Fixes :wrench: - - Properly handle `offset` and `scale` properties when picking metadata from property textures. [#12237](https://github.com/CesiumGS/cesium/pull/12237) ### 1.122 - 2024-10-01 diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index bc8598aeda78..17f5b0378540 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -419,3 +419,6 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu - [Kirn Kim](https://github.com/squrki) - [Emanuele Mastaglia](https://github.com/Masty88) - [Connor Manning](https://github.com/connormanning) +- [Isaac Young](https://github.com/ibreathebsb) +- [Nick Crews](https://github.com/NickCrews) +- [胡文康](https://github.com/XiaoHu1994) diff --git a/Documentation/Contributors/ReleaseGuide/README.md b/Documentation/Contributors/ReleaseGuide/README.md index e8733d379fbc..14ccad454d73 100644 --- a/Documentation/Contributors/ReleaseGuide/README.md +++ b/Documentation/Contributors/ReleaseGuide/README.md @@ -1,6 +1,6 @@ # Release Guide -We release Cesium on the first work day of every month. [This file](../../../.slackbot.yml) outlines the release schedule and the developer responsible for each month's release. +We release Cesium on the first work day of every month. The [Release Schedule](./ReleaseSchedule.md) outlines the release schedule and the developer responsible for each month's release. There is no release manager; instead, our community shares the responsibility. Any committer can create the release for a given month, and at any point, they can pass the responsibility to someone else, or someone else can ask for it. This spreads knowledge, avoids stratification, avoids a single point of failure, and is beautifully unstructured ([more info](https://community.cesium.com/t/cesium-releases/45)). diff --git a/Documentation/Contributors/ReleaseGuide/ReleaseSchedule.md b/Documentation/Contributors/ReleaseGuide/ReleaseSchedule.md new file mode 100644 index 000000000000..75b8eef22a92 --- /dev/null +++ b/Documentation/Contributors/ReleaseGuide/ReleaseSchedule.md @@ -0,0 +1,16 @@ +# Release Schedule + +| Date | User | +| --------- | ---------------- | +| 1/2/2025 | `@ggetz` | +| 2/3/2025 | `@jjhembd` | +| 3/3/2025 | `@lukemckinstry` | +| 4/1/2025 | `@jjspace` | +| 5/1/2025 | `@ggetz` | +| 6/2/2025 | `@jjhembd` | +| 7/1/2025 | `@lukemckinstry` | +| 8/1/2025 | `@jjspace` | +| 9/1/2025 | `@ggetz` | +| 10/1/2025 | `@jjhembd` | +| 11/3/2025 | `@lukemckinstry` | +| 12/1/2025 | `@jjspace` | diff --git a/ThirdParty.json b/ThirdParty.json index ed72a070a4c1..e94b8cf49d93 100644 --- a/ThirdParty.json +++ b/ThirdParty.json @@ -12,7 +12,7 @@ "license": [ "BSD-3-Clause" ], - "version": "2.7.53", + "version": "2.7.54", "url": "https://www.npmjs.com/package/@zip.js/zip.js" }, { @@ -20,7 +20,7 @@ "license": [ "MIT" ], - "version": "4.0.0", + "version": "4.1.0", "url": "https://www.npmjs.com/package/autolinker" }, { @@ -44,7 +44,7 @@ "license": [ "Apache-2.0" ], - "version": "3.2.2", + "version": "3.2.3", "url": "https://www.npmjs.com/package/dompurify", "notes": "dompurify is available as both MPL-2.0 OR Apache-2.0" }, @@ -61,7 +61,7 @@ "license": [ "ISC" ], - "version": "3.0.0", + "version": "3.0.1", "url": "https://www.npmjs.com/package/earcut" }, { diff --git a/package.json b/package.json index 5f1ed19eb0bd..dea10612ca58 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cesium", - "version": "1.124.0", + "version": "1.125.0", "description": "CesiumJS is a JavaScript library for creating 3D globes and 2D maps in a web browser without a plugin.", "homepage": "http://cesium.com/cesiumjs/", "license": "Apache-2.0", @@ -51,8 +51,8 @@ "./Specs/**/*" ], "dependencies": { - "@cesium/engine": "^13.0.0", - "@cesium/widgets": "^10.0.0" + "@cesium/engine": "^13.1.0", + "@cesium/widgets": "^10.1.0" }, "devDependencies": { "@playwright/test": "^1.41.1", @@ -159,4 +159,4 @@ "packages/engine", "packages/widgets" ] -} +} \ No newline at end of file diff --git a/packages/engine/Source/Core/Color.js b/packages/engine/Source/Core/Color.js index 8fd5b033119f..5f39d2ddac3a 100644 --- a/packages/engine/Source/Core/Color.js +++ b/packages/engine/Source/Core/Color.js @@ -536,8 +536,8 @@ Color.clone = function (color, result) { /** * Returns true if the first Color equals the second color. * - * @param {Color} left The first Color to compare for equality. - * @param {Color} right The second Color to compare for equality. + * @param {Color} [left] The first Color to compare for equality. + * @param {Color} [right] The second Color to compare for equality. * @returns {boolean} true if the Colors are equal; otherwise, false. */ Color.equals = function (left, right) { @@ -577,7 +577,7 @@ Color.prototype.clone = function (result) { /** * Returns true if this Color equals other. * - * @param {Color} other The Color to compare for equality. + * @param {Color} [other] The Color to compare for equality. * @returns {boolean} true if the Colors are equal; otherwise, false. */ Color.prototype.equals = function (other) { diff --git a/packages/engine/Source/Core/Credit.js b/packages/engine/Source/Core/Credit.js index bbbe7984a43f..863a64be80d0 100644 --- a/packages/engine/Source/Core/Credit.js +++ b/packages/engine/Source/Core/Credit.js @@ -115,8 +115,8 @@ Object.defineProperties(Credit.prototype, { /** * Returns true if the credits are equal * - * @param {Credit} left The first credit - * @param {Credit} right The second credit + * @param {Credit} [left] The first credit + * @param {Credit} [right] The second credit * @returns {boolean} true if left and right are equal, false otherwise. */ Credit.equals = function (left, right) { @@ -132,7 +132,7 @@ Credit.equals = function (left, right) { /** * Returns true if the credits are equal * - * @param {Credit} credit The credit to compare to. + * @param {Credit} [credit] The credit to compare to. * @returns {boolean} true if left and right are equal, false otherwise. */ Credit.prototype.equals = function (credit) { diff --git a/packages/engine/Source/Core/DistanceDisplayCondition.js b/packages/engine/Source/Core/DistanceDisplayCondition.js index e00e08aec341..8d57139dc702 100644 --- a/packages/engine/Source/Core/DistanceDisplayCondition.js +++ b/packages/engine/Source/Core/DistanceDisplayCondition.js @@ -115,8 +115,8 @@ DistanceDisplayCondition.unpack = function (array, startingIndex, result) { /** * Determines if two distance display conditions are equal. * - * @param {DistanceDisplayCondition} left A distance display condition. - * @param {DistanceDisplayCondition} right Another distance display condition. + * @param {DistanceDisplayCondition} [left] A distance display condition. + * @param {DistanceDisplayCondition} [right] Another distance display condition. * @return {boolean} Whether the two distance display conditions are equal. */ DistanceDisplayCondition.equals = function (left, right) { @@ -163,7 +163,7 @@ DistanceDisplayCondition.prototype.clone = function (result) { /** * Determines if this distance display condition is equal to another. * - * @param {DistanceDisplayCondition} other Another distance display condition. + * @param {DistanceDisplayCondition} [other] Another distance display condition. * @return {boolean} Whether this distance display condition is equal to the other. */ DistanceDisplayCondition.prototype.equals = function (other) { diff --git a/packages/engine/Source/Core/Ion.js b/packages/engine/Source/Core/Ion.js index a0a75ec33486..fb02a59c509e 100644 --- a/packages/engine/Source/Core/Ion.js +++ b/packages/engine/Source/Core/Ion.js @@ -4,7 +4,7 @@ import Resource from "./Resource.js"; let defaultTokenCredit; const defaultAccessToken = - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI0ZDdmNWJiNy0wMmNlLTQ1MWUtODM2YS02NGM1MTBlOGMwMWQiLCJpZCI6MjU5LCJpYXQiOjE3MzMxNTc4OTV9.B3URHf0VdHDtGckb-hv7uqATdn8KfvkiuoAFZUq8tAo"; + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIzYTBjYzY2NC0yMGEyLTQxZDYtYmI2MC1hMWE4ZTBlMGNlNjciLCJpZCI6MjU5LCJpYXQiOjE3MzU4NTEwMzF9.nshpaoC5qpRD4F5diwcjwJ3tddp1OjCSXoMrv37Ales"; /** * Default settings for accessing the Cesium ion API. * diff --git a/packages/engine/Source/Core/OrientedBoundingBox.js b/packages/engine/Source/Core/OrientedBoundingBox.js index cf4a6d392b47..64d588b06d94 100644 --- a/packages/engine/Source/Core/OrientedBoundingBox.js +++ b/packages/engine/Source/Core/OrientedBoundingBox.js @@ -1236,8 +1236,8 @@ OrientedBoundingBox.prototype.isOccluded = function (occluder) { * Compares the provided OrientedBoundingBox componentwise and returns * true if they are equal, false otherwise. * - * @param {OrientedBoundingBox} left The first OrientedBoundingBox. - * @param {OrientedBoundingBox} right The second OrientedBoundingBox. + * @param {OrientedBoundingBox} [left] The first OrientedBoundingBox. + * @param {OrientedBoundingBox} [right] The second OrientedBoundingBox. * @returns {boolean} true if left and right are equal, false otherwise. */ OrientedBoundingBox.equals = function (left, right) { diff --git a/packages/engine/Source/Core/Spherical.js b/packages/engine/Source/Core/Spherical.js index 57dca19407fd..e0d84bd387ea 100644 --- a/packages/engine/Source/Core/Spherical.js +++ b/packages/engine/Source/Core/Spherical.js @@ -107,8 +107,8 @@ Spherical.normalize = function (spherical, result) { /** * Returns true if the first spherical is equal to the second spherical, false otherwise. * - * @param {Spherical} left The first Spherical to be compared. - * @param {Spherical} right The second Spherical to be compared. + * @param {Spherical} [left] The first Spherical to be compared. + * @param {Spherical} [right] The second Spherical to be compared. * @returns {boolean} true if the first spherical is equal to the second spherical, false otherwise. */ Spherical.equals = function (left, right) { @@ -145,7 +145,7 @@ Spherical.equalsEpsilon = function (left, right, epsilon) { /** * Returns true if this spherical is equal to the provided spherical, false otherwise. * - * @param {Spherical} other The Spherical to be compared. + * @param {Spherical} [other] The Spherical to be compared. * @returns {boolean} true if this spherical is equal to the provided spherical, false otherwise. */ Spherical.prototype.equals = function (other) { diff --git a/packages/engine/Source/Core/writeTextToCanvas.js b/packages/engine/Source/Core/writeTextToCanvas.js index 3a23c602d7e3..26863863ced7 100644 --- a/packages/engine/Source/Core/writeTextToCanvas.js +++ b/packages/engine/Source/Core/writeTextToCanvas.js @@ -104,7 +104,6 @@ let imageSmoothingEnabledName; * @param {string} text The text to write. * @param {object} [options] Object with the following properties: * @param {string} [options.font='10px sans-serif'] The CSS font to use. - * @param {string} [options.textBaseline='bottom'] The baseline of the text. * @param {boolean} [options.fill=true] Whether to fill the text. * @param {boolean} [options.stroke=false] Whether to stroke the text. * @param {Color} [options.fillColor=Color.WHITE] The fill color. diff --git a/packages/engine/Source/DataSources/DataSourceClock.js b/packages/engine/Source/DataSources/DataSourceClock.js index 58d55e2a3f0f..8bebb21cc2b4 100644 --- a/packages/engine/Source/DataSources/DataSourceClock.js +++ b/packages/engine/Source/DataSources/DataSourceClock.js @@ -108,7 +108,7 @@ DataSourceClock.prototype.clone = function (result) { /** * Returns true if this DataSourceClock is equivalent to the other * - * @param {DataSourceClock} other The other DataSourceClock to compare to. + * @param {DataSourceClock} [other] The other DataSourceClock to compare to. * @returns {boolean} true if the DataSourceClocks are equal; otherwise, false. */ DataSourceClock.prototype.equals = function (other) { diff --git a/packages/engine/Source/DataSources/ModelGraphics.js b/packages/engine/Source/DataSources/ModelGraphics.js index 8320768fa319..10c5d8718c91 100644 --- a/packages/engine/Source/DataSources/ModelGraphics.js +++ b/packages/engine/Source/DataSources/ModelGraphics.js @@ -18,6 +18,10 @@ function createArticulationStagePropertyBag(value) { return new PropertyBag(value); } +function createEnvironmentMapPropertyBag(value) { + return new PropertyBag(value); +} + /** * @typedef {object} ModelGraphics.ConstructorOptions * @@ -40,6 +44,7 @@ function createArticulationStagePropertyBag(value) { * @property {Property | ColorBlendMode} [colorBlendMode=ColorBlendMode.HIGHLIGHT] An enum Property specifying how the color blends with the model. * @property {Property | number} [colorBlendAmount=0.5] A numeric Property specifying the color strength when the colorBlendMode is MIX. A value of 0.0 results in the model's rendered color while a value of 1.0 results in a solid color, with any value in-between resulting in a mix of the two. * @property {Property | Cartesian2} [imageBasedLightingFactor=new Cartesian2(1.0, 1.0)] A property specifying the contribution from diffuse and specular image-based lighting. + * @property {PropertyBag | Object} [environmentMapOptions] The properties for managing dynamic environment maps on this entity. * @property {Property | Color} [lightColor] A property specifying the light color when shading the model. When undefined the scene's light color is used instead. * @property {Property | DistanceDisplayCondition} [distanceDisplayCondition] A Property specifying at what distance from the camera that this model will be displayed. * @property {PropertyBag | Object} [nodeTransformations] An object, where keys are names of nodes, and values are {@link TranslationRotationScale} Properties describing the transformation to apply to that node. The transformation is applied after the node's existing transformation as specified in the glTF, and does not replace the node's existing transformation. @@ -101,6 +106,8 @@ function ModelGraphics(options) { this._colorBlendAmountSubscription = undefined; this._imageBasedLightingFactor = undefined; this._imageBasedLightingFactorSubscription = undefined; + this._environmentMapOptions = undefined; + this._environmentMapOptionsSubscription = undefined; this._lightColor = undefined; this._lightColorSubscription = undefined; this._distanceDisplayCondition = undefined; @@ -279,6 +286,17 @@ Object.defineProperties(ModelGraphics.prototype, { "imageBasedLightingFactor", ), + /** + * Gets or sets the {@link DynamicEnvironmentMapManager.ConstructorOptions} to apply to this model. This is represented as an {@link PropertyBag}. + * @memberof ModelGraphics.prototype + * @type {PropertyBag} + */ + environmentMapOptions: createPropertyDescriptor( + "environmentMapOptions", + undefined, + createEnvironmentMapPropertyBag, + ), + /** * A property specifying the {@link Cartesian3} light color when shading the model. When undefined the scene's light color is used instead. * @memberOf ModelGraphics.prototype @@ -361,6 +379,7 @@ ModelGraphics.prototype.clone = function (result) { result.colorBlendMode = this.colorBlendMode; result.colorBlendAmount = this.colorBlendAmount; result.imageBasedLightingFactor = this.imageBasedLightingFactor; + result.environmentMapOptions = this.environmentMapOptions; result.lightColor = this.lightColor; result.distanceDisplayCondition = this.distanceDisplayCondition; result.nodeTransformations = this.nodeTransformations; @@ -430,7 +449,10 @@ ModelGraphics.prototype.merge = function (source) { this.imageBasedLightingFactor, source.imageBasedLightingFactor, ); - + this.environmentMapOptions = defaultValue( + this.environmentMapOptions, + source.environmentMapOptions, + ); this.lightColor = defaultValue(this.lightColor, source.lightColor); this.distanceDisplayCondition = defaultValue( this.distanceDisplayCondition, diff --git a/packages/engine/Source/DataSources/ModelVisualizer.js b/packages/engine/Source/DataSources/ModelVisualizer.js index 42d1bd177592..0b8f5a54938b 100644 --- a/packages/engine/Source/DataSources/ModelVisualizer.js +++ b/packages/engine/Source/DataSources/ModelVisualizer.js @@ -35,6 +35,9 @@ const defaultColor = Color.WHITE; const defaultColorBlendMode = ColorBlendMode.HIGHLIGHT; const defaultColorBlendAmount = 0.5; const defaultImageBasedLightingFactor = new Cartesian2(1.0, 1.0); +const defaultEnvironmentMapOptions = { + maximumPositionEpsilon: Number.POSITIVE_INFINITY, +}; const modelMatrixScratch = new Matrix4(); const nodeMatrixScratch = new Matrix4(); @@ -76,6 +79,7 @@ async function createModelPrimitive( entity, resource, incrementallyLoadTextures, + environmentMapOptions, ) { const primitives = visualizer._primitives; const modelHash = visualizer._modelHash; @@ -85,6 +89,7 @@ async function createModelPrimitive( url: resource, incrementallyLoadTextures: incrementallyLoadTextures, scene: visualizer._scene, + environmentMapOptions: environmentMapOptions, }); if (visualizer.isDestroyed() || !defined(modelHash[entity.id])) { @@ -176,6 +181,9 @@ ModelVisualizer.prototype.update = function (time) { articulationsScratch: {}, loadFailed: false, modelUpdated: false, + environmentMapOptionsScratch: { + ...defaultEnvironmentMapOptions, + }, }; modelHash[entity.id] = modelData; @@ -185,7 +193,20 @@ ModelVisualizer.prototype.update = function (time) { defaultIncrementallyLoadTextures, ); - createModelPrimitive(this, entity, resource, incrementallyLoadTextures); + const environmentMapOptions = Property.getValueOrDefault( + modelGraphics._environmentMapOptions, + time, + defaultEnvironmentMapOptions, + modelData.environmentMapOptionsScratch, + ); + + createModelPrimitive( + this, + entity, + resource, + incrementallyLoadTextures, + environmentMapOptions, + ); } const model = modelData.modelPrimitive; diff --git a/packages/engine/Source/Renderer/AutomaticUniforms.js b/packages/engine/Source/Renderer/AutomaticUniforms.js index 73382e649f7a..29801f986f7a 100644 --- a/packages/engine/Source/Renderer/AutomaticUniforms.js +++ b/packages/engine/Source/Renderer/AutomaticUniforms.js @@ -1488,11 +1488,11 @@ const AutomaticUniforms = { * * @example * // GLSL declaration - * uniform sampler2D czm_specularEnvironmentMaps; + * uniform samplerCube czm_specularEnvironmentMaps; */ czm_specularEnvironmentMaps: new AutomaticUniform({ size: 1, - datatype: WebGLConstants.SAMPLER_2D, + datatype: WebGLConstants.SAMPLER_CUBE, getValue: function (uniformState) { return uniformState.specularEnvironmentMaps; }, diff --git a/packages/engine/Source/Scene/ArcGisMapService.js b/packages/engine/Source/Scene/ArcGisMapService.js index 693004b42cd1..500fd79cd5f8 100644 --- a/packages/engine/Source/Scene/ArcGisMapService.js +++ b/packages/engine/Source/Scene/ArcGisMapService.js @@ -4,7 +4,7 @@ import Resource from "../Core/Resource.js"; let defaultTokenCredit; const defaultAccessToken = - "AAPTxy8BH1VEsoebNVZXo8HurEOF051kAEKlhkOhBEc9BmSrZYLHFXe7j_lQcsSJKc8-7rwh0IFSNWLGZErkzXRnYjMjURTz-hGiKMEeAJIZBG7uiYEn0Mt1rrwlJGIpirZQC4iO428519DlO3QC9DnRBqLXGTBhirgoU7-Z2209sy87s49kw6NOC8_Eew6nCLf-pZ883DRPRyAYH7LC8cvRLInud0EdndtUFa4y83TamrA.AT1_ahjrWDrq"; + "AAPTxy8BH1VEsoebNVZXo8HurEOF051kAEKlhkOhBEc9BmSFctdVnwhKUPPSRxMpNygUNlP8JmGGUdPJSkOUNGzOjDGJ6_IBw0ZIYb2CxiR6SbKR4hMj3np1HXa_Idxv_txLhu62WcUsFQSTBvq7ktym5DNKxqVmIzBnPljNsM8ff9hCKEXq0LTd8VzkHqjVA7-ig_wg7BqJGg7vUMgG1QseyUAjpmY2OaEv9rA8aeBjRrc.AT1_8nZ92i8c"; /** * Default options for accessing the ArcGIS image tile service. * diff --git a/packages/engine/Source/Scene/Billboard.js b/packages/engine/Source/Scene/Billboard.js index d06129800960..9834474f59ba 100644 --- a/packages/engine/Source/Scene/Billboard.js +++ b/packages/engine/Source/Scene/Billboard.js @@ -1562,7 +1562,7 @@ Billboard.getScreenSpaceBoundingBox = function ( * Determines if this billboard equals another billboard. Billboards are equal if all their properties * are equal. Billboards in different collections can be equal. * - * @param {Billboard} other The billboard to compare for equality. + * @param {Billboard} [other] The billboard to compare for equality. * @returns {boolean} true if the billboards are equal; otherwise, false. */ Billboard.prototype.equals = function (other) { diff --git a/packages/engine/Source/Scene/Cesium3DTile.js b/packages/engine/Source/Scene/Cesium3DTile.js index 53e21c781f15..d1ddeb5165da 100644 --- a/packages/engine/Source/Scene/Cesium3DTile.js +++ b/packages/engine/Source/Scene/Cesium3DTile.js @@ -1729,28 +1729,57 @@ function createBoxFromTransformedRegion( } /** + * Creates a TileBoundingVolume from the given region and transform + * information. + * + * This may either be a TileBoundingRegion or a TileOrientedBoundingBox. + * + * If the given transform is the initial transform, then this will return + * a TileBoundingRegion. This will either be the given result parameter, + * or a new TileBoundingRegion, if the given result parameter was not + * a TileBoundingRegion. + * + * If the given transform deviates from the initial transform, then this + * will return a TileOrientedBoundingBox that was computed by applying + * the given transform to the given region. This will either be the + * given result parameter, or a new TileOrientedBoundingBox, if the given + * result parameter was not a TileOrientedBoundingBox + * * @private - * @param {Array} region An array of six numbers that define a bounding geographic region in EPSG:4979 coordinates with the order [west, south, east, north, minimum height, maximum height] - * @param {Matrix4} transform - * @param {Matrix4} initialTransform - * @param {TileBoundingVolume} [result] - * @returns {TileBoundingVolume} + * @param {Array} region An array of six numbers that define a bounding + * geographic region in EPSG:4979 coordinates with the order + * [west, south, east, north, minimum height, maximum height] + * @param {Matrix4} transform The current computedTransform of the tile, + * which includes the parent transform (which, in turn, includes the + * modelMatrix of the containing tileset) + * @param {Matrix4} initialTransform The initial transform of the tile, + * before any changes to the modelMatrix of the containing tileset + * @param {TileBoundingVolume} [result] An optional result. + * @returns {TileBoundingVolume} The resulting bounding volume */ function createRegion(region, transform, initialTransform, result) { if ( !Matrix4.equalsEpsilon(transform, initialTransform, CesiumMath.EPSILON8) ) { + if (result instanceof TileOrientedBoundingBox) { + return createBoxFromTransformedRegion( + region, + transform, + initialTransform, + result, + ); + } return createBoxFromTransformedRegion( region, transform, initialTransform, - result, + undefined, ); } const rectangleRegion = Rectangle.unpack(region, 0, scratchRectangle); - if (defined(result)) { + if (result instanceof TileBoundingRegion) { result.rectangle = Rectangle.clone(rectangleRegion, result.rectangle); result.minimumHeight = region[4]; result.maximumHeight = region[5]; diff --git a/packages/engine/Source/Scene/Cesium3DTileset.js b/packages/engine/Source/Scene/Cesium3DTileset.js index e23d1061792b..bf2779cc6dcc 100644 --- a/packages/engine/Source/Scene/Cesium3DTileset.js +++ b/packages/engine/Source/Scene/Cesium3DTileset.js @@ -105,7 +105,7 @@ import DynamicEnvironmentMapManager from "./DynamicEnvironmentMapManager.js"; * @property {object} [pointCloudShading] Options for constructing a {@link PointCloudShading} object to control point attenuation based on geometric error and lighting. * @property {Cartesian3} [lightColor] The light color when shading models. When undefined the scene's light color is used instead. * @property {ImageBasedLighting} [imageBasedLighting] The properties for managing image-based lighting for this tileset. - * @param {DynamicEnvironmentMapManager.ConstructorOptions} [options.environmentMapOptions] The properties for managing dynamic environment maps on this model. + * @property {DynamicEnvironmentMapManager.ConstructorOptions} [environmentMapOptions] The properties for managing dynamic environment maps on this tileset. * @property {boolean} [backFaceCulling=true] Whether to cull back-facing geometry. When true, back face culling is determined by the glTF material's doubleSided property; when false, back face culling is disabled. * @property {boolean} [enableShowOutline=true] Whether to enable outlines for models using the {@link https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/CESIUM_primitive_outline|CESIUM_primitive_outline} extension. This can be set to false to avoid the additional processing of geometry at load time. When false, the showOutlines and outlineColor options are ignored. * @property {boolean} [showOutline=true] Whether to display the outline for models using the {@link https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/CESIUM_primitive_outline|CESIUM_primitive_outline} extension. When true, outlines are displayed. When false, outlines are not displayed. diff --git a/packages/engine/Source/Scene/ClippingPolygon.js b/packages/engine/Source/Scene/ClippingPolygon.js index 3b1886aa44b4..566f6941e844 100644 --- a/packages/engine/Source/Scene/ClippingPolygon.js +++ b/packages/engine/Source/Scene/ClippingPolygon.js @@ -117,8 +117,8 @@ ClippingPolygon.clone = function (polygon, result) { * Compares the provided ClippingPolygons and returns * true if they are equal, false otherwise. * - * @param {Plane} left The first polygon. - * @param {Plane} right The second polygon. + * @param {ClippingPolygon} left The first polygon. + * @param {ClippingPolygon} right The second polygon. * @returns {boolean} true if left and right are equal, false otherwise. */ ClippingPolygon.equals = function (left, right) { diff --git a/packages/engine/Source/Scene/DynamicEnvironmentMapManager.js b/packages/engine/Source/Scene/DynamicEnvironmentMapManager.js index f3897e2ff0c3..1469d31fe1a8 100644 --- a/packages/engine/Source/Scene/DynamicEnvironmentMapManager.js +++ b/packages/engine/Source/Scene/DynamicEnvironmentMapManager.js @@ -33,7 +33,7 @@ import ConvolveSpecularMapVS from "../Shaders/ConvolveSpecularMapVS.js"; * @typedef {object} DynamicEnvironmentMapManager.ConstructorOptions * Options for the DynamicEnvironmentMapManager constructor * @property {boolean} [enabled=true] If true, the environment map and related properties will continue to update. - * @property {number} [mipmapLevels=10] The number of mipmap levels to generate for specular maps. More mipmap levels will produce a higher resolution specular reflection. + * @property {number} [mipmapLevels=7] The number of mipmap levels to generate for specular maps. More mipmap levels will produce a higher resolution specular reflection. * @property {number} [maximumSecondsDifference=3600] The maximum amount of elapsed seconds before a new environment map is created. * @property {number} [maximumPositionEpsilon=1000] The maximum difference in position before a new environment map is created, in meters. Small differences in position will not visibly affect results. * @property {number} [atmosphereScatteringIntensity=2.0] The intensity of the scattered light emitted from the atmosphere. This should be adjusted relative to the value of {@link Scene.light} intensity. @@ -77,11 +77,12 @@ function DynamicEnvironmentMapManager(options) { this._sphericalHarmonicCoefficientsDirty = false; this._shouldRegenerateShaders = false; + this._shouldReset = false; options = defaultValue(options, defaultValue.EMPTY_OBJECT); const mipmapLevels = Math.min( - defaultValue(options.mipmapLevels, 10), + defaultValue(options.mipmapLevels, 7), Math.log2(ContextLimits.maximumCubeMapSize), ); @@ -251,7 +252,7 @@ Object.defineProperties(DynamicEnvironmentMapManager.prototype, { } this._position = Cartesian3.clone(value, this._position); - this.reset(); + this._shouldReset = true; }, }, @@ -345,7 +346,7 @@ DynamicEnvironmentMapManager._updateCommandQueue = (frameState) => { DynamicEnvironmentMapManager._activeComputeCommandCount < DynamicEnvironmentMapManager._maximumComputeCommandCount ) { - if (command.canceled) { + if (command.owner.isDestroyed() || command.canceled) { command = DynamicEnvironmentMapManager._nextFrameCommandQueue.shift(); continue; } @@ -354,6 +355,10 @@ DynamicEnvironmentMapManager._updateCommandQueue = (frameState) => { DynamicEnvironmentMapManager._activeComputeCommandCount++; command = DynamicEnvironmentMapManager._nextFrameCommandQueue.shift(); } + + if (defined(command)) { + DynamicEnvironmentMapManager._nextFrameCommandQueue.push(command); + } } }; @@ -398,7 +403,6 @@ DynamicEnvironmentMapManager.prototype.reset = function () { for (let i = 0; i < length; ++i) { if (defined(this._radianceMapComputeCommands[i])) { this._radianceMapComputeCommands[i].canceled = true; - DynamicEnvironmentMapManager._activeComputeCommandCount--; } this._radianceMapComputeCommands[i] = undefined; } @@ -407,19 +411,19 @@ DynamicEnvironmentMapManager.prototype.reset = function () { for (let i = 0; i < length; ++i) { if (defined(this._convolutionComputeCommands[i])) { this._convolutionComputeCommands[i].canceled = true; - DynamicEnvironmentMapManager._activeComputeCommandCount--; } this._convolutionComputeCommands[i] = undefined; } if (defined(this._irradianceComputeCommand)) { this._irradianceComputeCommand.canceled = true; - DynamicEnvironmentMapManager._activeComputeCommandCount--; this._irradianceComputeCommand = undefined; } this._radianceMapDirty = true; this._radianceCommandsDirty = true; + this._convolutionsCommandsDirty = false; + this._irradianceCommandDirty = false; }; const scratchPackedAtmosphere = new Cartesian3(); @@ -539,7 +543,8 @@ function updateRadianceMap(manager, frameState) { let i = 0; for (const face of CubeMap.faceNames()) { let texture = manager._radianceMapTextures[i]; - if (defined(texture)) { + // Destroy any existing textures that have no yet been cleaned up + if (defined(texture) && !texture.isDestroyed()) { texture.destroy(); } @@ -570,36 +575,35 @@ function updateRadianceMap(manager, frameState) { ); }, }, - persists: true, owner: manager, - postExecute: () => { - const commands = manager._radianceMapComputeCommands; - if (!defined(commands[index])) { - // This command was cancelled - return; - } - commands[index] = undefined; - - const framebuffer = new Framebuffer({ - context: context, - colorTextures: [manager._radianceMapTextures[index]], - destroyAttachments: false, - }); - - // Copy the output texture into the corresponding cubemap face - framebuffer._bind(); - manager._radianceCubeMap[face].copyFromFramebuffer(); - framebuffer._unBind(); - framebuffer.destroy(); - + }); + command.postExecute = () => { + if (manager.isDestroyed() || command.canceled) { DynamicEnvironmentMapManager._activeComputeCommandCount--; + return; + } - if (!commands.some(defined)) { - manager._convolutionsCommandsDirty = true; - manager._shouldRegenerateShaders = true; - } - }, - }); + const commands = manager._radianceMapComputeCommands; + commands[index] = undefined; + + const framebuffer = new Framebuffer({ + context: context, + colorTextures: [manager._radianceMapTextures[index]], + }); + + // Copy the output texture into the corresponding cubemap face + framebuffer._bind(); + manager._radianceCubeMap[face].copyFromFramebuffer(); + framebuffer._unBind(); + framebuffer.destroy(); + + DynamicEnvironmentMapManager._activeComputeCommandCount--; + + if (!commands.some(defined)) { + manager._convolutionsCommandsDirty = true; + manager._shouldRegenerateShaders = true; + } + }; manager._radianceMapComputeCommands[i] = command; DynamicEnvironmentMapManager._queueCommand(command, frameState); @@ -626,32 +630,48 @@ function updateSpecularMaps(manager, frameState) { const context = frameState.context; let facesCopied = 0; - const getPostExecute = (index, texture, face, level) => () => { - // Copy output texture to corresponding face and mipmap level - const commands = manager._convolutionComputeCommands; - if (!defined(commands[index]) || commands[index].canceled) { - // This command was cancelled + const getPostExecute = (command, index, texture, face, level) => () => { + if (manager.isDestroyed() || command.canceled) { + DynamicEnvironmentMapManager._activeComputeCommandCount--; return; } + + // Copy output texture to corresponding face and mipmap level + const commands = manager._convolutionComputeCommands; commands[index] = undefined; radianceCubeMap.copyFace(frameState, texture, face, level); facesCopied++; DynamicEnvironmentMapManager._activeComputeCommandCount--; - // All faces and levels have been copied - if (facesCopied === manager._specularMapTextures.length) { + texture.destroy(); + manager._specularMapTextures[index] = undefined; + + // All faces for each mipmap level have been copied + const length = manager._specularMapTextures.length; + if (facesCopied >= length) { manager._irradianceCommandDirty = true; radianceCubeMap.sampler = new Sampler({ minificationFilter: TextureMinificationFilter.LINEAR_MIPMAP_LINEAR, }); + manager._shouldRegenerateShaders = true; + + // Cleanup shared resources + manager._va.destroy(); + manager._va = undefined; + manager._convolveSP.destroy(); + manager._convolveSP = undefined; } }; let index = 0; for (let level = 1; level < mipmapLevels; ++level) { for (const face of CubeMap.faceNames()) { + if (defined(manager._specularMapTextures[index])) { + manager._specularMapTextures[index].destroy(); + } + const texture = (manager._specularMapTextures[index] = new Texture({ context: context, width: width, @@ -683,6 +703,8 @@ function updateSpecularMaps(manager, frameState) { shaderProgram: shaderProgram, vertexArray: vertexArray, outputTexture: texture, + // Persist so we can use a shared shader progam and vertex array across all commands + // Shared resources are instead destroyed in postExecute persists: true, owner: manager, uniformMap: { @@ -692,8 +714,14 @@ function updateSpecularMaps(manager, frameState) { return CubeMap.getDirection(face, scratchCartesian); }, }, - postExecute: getPostExecute(index, texture, face, level), }); + command.postExecute = getPostExecute( + command, + index, + texture, + face, + level, + ); manager._convolutionComputeCommands[index] = command; DynamicEnvironmentMapManager._queueCommand(command, frameState); ++index; @@ -717,17 +745,19 @@ function updateIrradianceResources(manager, frameState) { const dimensions = irradianceTextureDimensions; let texture = manager._irradianceMapTexture; - if (!defined(texture)) { - texture = new Texture({ - context: context, - width: dimensions.x, - height: dimensions.y, - pixelDatatype: PixelDatatype.FLOAT, - pixelFormat: PixelFormat.RGBA, - }); - manager._irradianceMapTexture = texture; + if (defined(texture) && !texture.isDestroyed()) { + texture.destroy(); } + texture = new Texture({ + context: context, + width: dimensions.x, + height: dimensions.y, + pixelDatatype: PixelDatatype.FLOAT, + pixelFormat: PixelFormat.RGBA, + }); + manager._irradianceMapTexture = texture; + let fs = manager._irradianceMapFS; if (!defined(fs)) { fs = new ShaderSource({ @@ -739,21 +769,25 @@ function updateIrradianceResources(manager, frameState) { const command = new ComputeCommand({ fragmentShaderSource: fs, outputTexture: texture, + owner: manager, uniformMap: { u_radianceMap: () => manager._radianceCubeMap ?? context.defaultTexture, }, - postExecute: () => { - if (!defined(manager._irradianceComputeCommand)) { - // This command was cancelled - return; - } - manager._irradianceTextureDirty = false; - manager._irradianceComputeCommand = undefined; - manager._sphericalHarmonicCoefficientsDirty = true; + }); + command.postExecute = () => { + if (manager.isDestroyed() || command.canceled) { DynamicEnvironmentMapManager._activeComputeCommandCount--; - }, - }); + return; + } + manager._irradianceTextureDirty = false; + manager._irradianceComputeCommand = undefined; + manager._sphericalHarmonicCoefficientsDirty = true; + manager._irradianceMapFS = undefined; + + DynamicEnvironmentMapManager._activeComputeCommandCount--; + }; + manager._irradianceComputeCommand = command; DynamicEnvironmentMapManager._queueCommand(command, frameState); manager._irradianceTextureDirty = true; @@ -768,6 +802,11 @@ function updateIrradianceResources(manager, frameState) { function updateSphericalHarmonicCoefficients(manager, frameState) { const context = frameState.context; + if (!defined(manager._irradianceMapTexture)) { + // Operation was canceled + return; + } + const framebuffer = new Framebuffer({ context: context, colorTextures: [manager._irradianceMapTexture], @@ -793,6 +832,8 @@ function updateSphericalHarmonicCoefficients(manager, frameState) { } framebuffer.destroy(); + manager._irradianceMapTexture.destroy(); + manager._irradianceMapTexture = undefined; manager._shouldRegenerateShaders = true; } @@ -834,9 +875,11 @@ DynamicEnvironmentMapManager.prototype.update = function (frameState) { this.maximumSecondsDifference, )); - if (regenerateEnvironmentMap) { + if (this._shouldReset || regenerateEnvironmentMap) { this.reset(); + this._shouldReset = false; this._lastTime = JulianDate.clone(frameState.time, this._lastTime); + return; } if (this._radianceMapDirty) { @@ -910,19 +953,33 @@ DynamicEnvironmentMapManager.prototype.destroy = function () { length = this._radianceMapTextures.length; for (let i = 0; i < length; ++i) { this._radianceMapTextures[i] = - this._radianceMapTextures[i] && this._radianceMapTextures[i].destroy(); + this._radianceMapTextures[i] && + !this._radianceMapTextures[i].isDestroyed() && + this._radianceMapTextures[i].destroy(); } length = this._specularMapTextures.length; for (let i = 0; i < length; ++i) { this._specularMapTextures[i] = - this._specularMapTextures[i] && this._specularMapTextures[i].destroy(); + this._specularMapTextures[i] && + !this._specularMapTextures[i].isDestroyed() && + this._specularMapTextures[i].destroy(); } this._radianceCubeMap = this._radianceCubeMap && this._radianceCubeMap.destroy(); this._irradianceMapTexture = - this._irradianceMapTexture && this._irradianceMapTexture.destroy(); + this._irradianceMapTexture && + !this._irradianceMapTexture.isDestroyed() && + this._irradianceMapTexture.destroy(); + + if (defined(this._va)) { + this._va.destroy(); + } + + if (defined(this._convolveSP)) { + this._convolveSP.destroy(); + } return destroyObject(this); }; diff --git a/packages/engine/Source/Scene/ImageryLayer.js b/packages/engine/Source/Scene/ImageryLayer.js index 897686064402..b2a72c71adac 100644 --- a/packages/engine/Source/Scene/ImageryLayer.js +++ b/packages/engine/Source/Scene/ImageryLayer.js @@ -511,7 +511,7 @@ ImageryLayer.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD = 0.004; * Create a new imagery layer from an asynchronous imagery provider. The layer will handle any asynchronous loads or errors, and begin rendering the imagery layer once ready. * * @param {Promise} imageryProviderPromise A promise which resolves to a imagery provider - * @param {ImageryLayer.ConstructorOptions} options An object describing initialization options + * @param {ImageryLayer.ConstructorOptions} [options] An object describing initialization options * @returns {ImageryLayer} The created imagery layer. * * @example diff --git a/packages/engine/Source/Scene/Label.js b/packages/engine/Source/Scene/Label.js index 61168a5ff2c0..19b645ac13e7 100644 --- a/packages/engine/Source/Scene/Label.js +++ b/packages/engine/Source/Scene/Label.js @@ -1364,7 +1364,7 @@ Label.filterUnsupportedCharacters = function (text) { * Determines if this label equals another label. Labels are equal if all their properties * are equal. Labels in different collections can be equal. * - * @param {Label} other The label to compare for equality. + * @param {Label} [other] The label to compare for equality. * @returns {boolean} true if the labels are equal; otherwise, false. */ Label.prototype.equals = function (other) { diff --git a/packages/engine/Source/Scene/LabelCollection.js b/packages/engine/Source/Scene/LabelCollection.js index 6bd01bac9ee8..c33eda125c77 100644 --- a/packages/engine/Source/Scene/LabelCollection.js +++ b/packages/engine/Source/Scene/LabelCollection.js @@ -68,7 +68,6 @@ function createGlyphCanvas( outlineColor, outlineWidth, style, - verticalOrigin, ) { writeTextToCanvasParameters.font = font; writeTextToCanvasParameters.fillColor = fillColor; @@ -77,15 +76,6 @@ function createGlyphCanvas( // Setting the padding to something bigger is necessary to get enough space for the outlining. writeTextToCanvasParameters.padding = SDFSettings.PADDING; - if (verticalOrigin === VerticalOrigin.CENTER) { - writeTextToCanvasParameters.textBaseline = "middle"; - } else if (verticalOrigin === VerticalOrigin.TOP) { - writeTextToCanvasParameters.textBaseline = "top"; - } else { - // VerticalOrigin.BOTTOM and VerticalOrigin.BASELINE - writeTextToCanvasParameters.textBaseline = "bottom"; - } - writeTextToCanvasParameters.fill = style === LabelStyle.FILL || style === LabelStyle.FILL_AND_OUTLINE; writeTextToCanvasParameters.stroke = @@ -211,7 +201,6 @@ function rebindAllGlyphs(labelCollection, label) { Color.WHITE, 0.0, LabelStyle.FILL, - verticalOrigin, ); glyphTextureInfo = new GlyphTextureInfo( diff --git a/packages/engine/Source/Scene/Model/Model.js b/packages/engine/Source/Scene/Model/Model.js index 1e76382b423c..d1aae816fd2a 100644 --- a/packages/engine/Source/Scene/Model/Model.js +++ b/packages/engine/Source/Scene/Model/Model.js @@ -1823,7 +1823,7 @@ Model.prototype.applyArticulations = function () { * * The given name may be the name of a glTF extension, like `"EXT_example_extension"`. * If the specified extension was present in the root of the underlying glTF asset, - * and a loder for the specified extension has processed the extension data, then + * and a loader for the specified extension has processed the extension data, then * this will return the model representation of the extension. * * @param {string} extensionName The name of the extension diff --git a/packages/engine/Source/Scene/PointPrimitive.js b/packages/engine/Source/Scene/PointPrimitive.js index db93554292cc..cafd54eabfe6 100644 --- a/packages/engine/Source/Scene/PointPrimitive.js +++ b/packages/engine/Source/Scene/PointPrimitive.js @@ -665,7 +665,7 @@ PointPrimitive.getScreenSpaceBoundingBox = function ( * Determines if this point equals another point. Points are equal if all their properties * are equal. Points in different collections can be equal. * - * @param {PointPrimitive} other The point to compare for equality. + * @param {PointPrimitive} [other] The point to compare for equality. * @returns {boolean} true if the points are equal; otherwise, false. */ PointPrimitive.prototype.equals = function (other) { diff --git a/packages/engine/Source/Shaders/DepthPlaneVS.glsl b/packages/engine/Source/Shaders/DepthPlaneVS.glsl index b5204ec2f53d..4141585366a6 100644 --- a/packages/engine/Source/Shaders/DepthPlaneVS.glsl +++ b/packages/engine/Source/Shaders/DepthPlaneVS.glsl @@ -5,7 +5,7 @@ out vec4 positionEC; void main() { positionEC = czm_modelView * position; - gl_Position = czm_modelViewProjection * position; + gl_Position = czm_projection * positionEC; czm_vertexLogDepth(); } diff --git a/packages/engine/Specs/DataSources/ModelVisualizerSpec.js b/packages/engine/Specs/DataSources/ModelVisualizerSpec.js index 738d0db51195..862380d7c28b 100644 --- a/packages/engine/Specs/DataSources/ModelVisualizerSpec.js +++ b/packages/engine/Specs/DataSources/ModelVisualizerSpec.js @@ -196,6 +196,11 @@ describe( expect(primitive.lightColor).toEqual(new Cartesian3(1.0, 1.0, 0.0)); + expect(primitive.environmentMapManager.enabled).toBeTrue(); + expect(primitive.environmentMapManager.maximumPositionEpsilon).toEqual( + Number.POSITIVE_INFINITY, + ); + // wait till the model is loaded before we can check node transformations await pollToPromise(function () { scene.render(); @@ -276,6 +281,43 @@ describe( expect(node.matrix).toEqualEpsilon(expected, CesiumMath.EPSILON14); }); + it("can apply model environmentMapOptions", async function () { + const time = JulianDate.now(); + + const model = new ModelGraphics(); + model.uri = new ConstantProperty(boxArticulationsUrl); + + model.environmentMapOptions = { + enabled: false, + }; + + const testObject = entityCollection.getOrCreateEntity("test"); + testObject.position = new ConstantPositionProperty( + Cartesian3.fromDegrees(1, 2, 3), + ); + testObject.model = model; + + visualizer.update(time); + + let primitive; + await pollToPromise(function () { + primitive = scene.primitives.get(0); + return defined(primitive); + }); + + // wait till the model is loaded before we can check articulations + await pollToPromise(function () { + scene.render(); + return primitive.ready; + }); + visualizer.update(time); + + expect(primitive.environmentMapManager.enabled).toBeFalse(); + expect(primitive.environmentMapManager.maximumPositionEpsilon).toEqual( + Number.POSITIVE_INFINITY, + ); + }); + it("creates a primitive from ModelGraphics with a Resource", async function () { const time = JulianDate.now(); diff --git a/packages/engine/Specs/Scene/Cesium3DTilesetSpec.js b/packages/engine/Specs/Scene/Cesium3DTilesetSpec.js index a05b1be4dc28..dd342349aa57 100644 --- a/packages/engine/Specs/Scene/Cesium3DTilesetSpec.js +++ b/packages/engine/Specs/Scene/Cesium3DTilesetSpec.js @@ -43,6 +43,8 @@ import { Resource, ResourceCache, RuntimeError, + TileBoundingRegion, + TileOrientedBoundingBox, Transforms, } from "../../index.js"; import Cesium3DTilesTester from "../../../../Specs/Cesium3DTilesTester.js"; @@ -487,6 +489,8 @@ describe( }), ); expect(root.contentFailed).toBeTrue(); + + await Cesium3DTilesTester.waitForTilesLoaded(scene, tileset); }); it("handles failed tile requests", async function () { @@ -4803,6 +4807,38 @@ describe( ); }); + it("allows setting the model matrix to its initial value when a tile contains a region", function () { + // Regression test for https://github.com/CesiumGS/cesium/issues/12002 + return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then( + function (tileset) { + expect(function () { + viewAllTiles(); + + // Initially, the tileset tileset modelMatrix is the identity matrix. + // When changing it, the tile boundingVolume instances will become + // TileOrientedBoundingBox instances that have been created from the + // transformed regions. + tileset.modelMatrix = Matrix4.fromTranslation( + new Cartesian3(0.1, 0, 0), + ); + scene.renderForSpecs(); + expect(tileset.root.boundingVolume).toBeInstanceOf( + TileOrientedBoundingBox, + ); + + // When setting the modelMatrix back to its initial value, the tile + // boundingVolume instances should be the TileBoundingRegion instances + // that reflect the original bounding region + tileset.modelMatrix = Matrix4.clone(Matrix4.IDENTITY); + scene.renderForSpecs(); + expect(tileset.root.boundingVolume).toBeInstanceOf( + TileBoundingRegion, + ); + }).not.toThrow(); + }, + ); + }); + describe("clippingPolygons", () => { const positions = Cartesian3.fromRadiansArray([ -1.3194369277314022, 0.6988062530900625, -1.31941, 0.69879, diff --git a/packages/engine/Specs/Scene/DynamicEnvironmentMapManagerSpec.js b/packages/engine/Specs/Scene/DynamicEnvironmentMapManagerSpec.js index 0783774b7482..4e4f3d5ef0e0 100644 --- a/packages/engine/Specs/Scene/DynamicEnvironmentMapManagerSpec.js +++ b/packages/engine/Specs/Scene/DynamicEnvironmentMapManagerSpec.js @@ -183,6 +183,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { const primitive = new EnvironmentMockPrimitive(manager); scene.primitives.add(primitive); + scene.renderForSpecs(); scene.renderForSpecs(); expect(manager.radianceCubeMap).toBeInstanceOf(CubeMap); @@ -202,7 +203,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.13869766891002655, 0.17165547609329224, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[1]).toEqualEpsilon( new Cartesian3( @@ -210,7 +211,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.11016352474689484, 0.15077166259288788, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[2]).toEqualEpsilon( new Cartesian3( @@ -218,7 +219,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { -0.0013909616973251104, -0.00141593546140939, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[3]).toEqualEpsilon( new Cartesian3( @@ -226,7 +227,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.00016706169117242098, 0.00006681153899990022, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[4].x).toBeLessThan(0.0); @@ -269,6 +270,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { const primitive = new EnvironmentMockPrimitive(manager); scene.primitives.add(primitive); + scene.renderForSpecs(); scene.renderForSpecs(); expect(manager.radianceCubeMap).toBeInstanceOf(CubeMap); @@ -288,7 +290,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.03880387544631958, 0.050429586321115494, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[1]).toEqualEpsilon( new Cartesian3( @@ -296,7 +298,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { -0.00047372994595207274, 0.011921915225684643, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[2]).toEqualEpsilon( new Cartesian3( @@ -304,7 +306,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { -0.0005534383235499263, -0.001172146643511951, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[3]).toEqualEpsilon( new Cartesian3( @@ -312,22 +314,22 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.00010014028521254659, -0.0005452318582683802, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[4].x).toBeLessThan(0.0); expect(manager.sphericalHarmonicCoefficients[4].y).toBeLessThan(0.0); expect(manager.sphericalHarmonicCoefficients[4].z).toBeLessThan(0.0); - expect(manager.sphericalHarmonicCoefficients[5].x).toBeGreaterThan(0.0); - expect(manager.sphericalHarmonicCoefficients[5].y).toBeGreaterThan(0.0); - expect(manager.sphericalHarmonicCoefficients[5].z).toBeGreaterThan(0.0); + expect(manager.sphericalHarmonicCoefficients[5].x).toBeLessThan(0.0); + expect(manager.sphericalHarmonicCoefficients[5].y).toBeLessThan(0.0); + expect(manager.sphericalHarmonicCoefficients[5].z).toBeLessThan(0.0); expect(manager.sphericalHarmonicCoefficients[6].x).toBeGreaterThan(0.0); expect(manager.sphericalHarmonicCoefficients[6].y).toBeGreaterThan(0.0); expect(manager.sphericalHarmonicCoefficients[6].z).toBeGreaterThan(0.0); - expect(manager.sphericalHarmonicCoefficients[7].x).toBeGreaterThan(0.0); + expect(manager.sphericalHarmonicCoefficients[7].x).toBeLessThan(0.0); expect(manager.sphericalHarmonicCoefficients[7].y).toBeGreaterThan(0.0); expect(manager.sphericalHarmonicCoefficients[7].z).toBeGreaterThan(0.0); @@ -355,6 +357,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { const primitive = new EnvironmentMockPrimitive(manager); scene.primitives.add(primitive); + scene.renderForSpecs(); scene.renderForSpecs(); expect(manager.radianceCubeMap).toBeInstanceOf(CubeMap); @@ -374,7 +377,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.3365404009819031, 0.3376566469669342, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[1]).toEqualEpsilon( new Cartesian3( @@ -382,7 +385,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.25208908319473267, 0.25084879994392395, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[2]).toEqualEpsilon( new Cartesian3( @@ -390,7 +393,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.0009837104007601738, 0.0008832928724586964, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[3]).toEqualEpsilon( @@ -399,7 +402,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { -0.0015308377332985401, -0.0012394117657095194, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[4].x).toBeGreaterThan(0.0); @@ -442,6 +445,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { DynamicAtmosphereLightingType.SUNLIGHT; scene.renderForSpecs(time); + scene.renderForSpecs(time); expect(manager.radianceCubeMap).toBeInstanceOf(CubeMap); @@ -460,7 +464,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.04265068098902702, 0.04163559526205063, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[1]).toEqualEpsilon( new Cartesian3( @@ -468,7 +472,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.023243442177772522, 0.025639381259679794, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[2]).toEqualEpsilon( new Cartesian3( @@ -476,7 +480,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { -0.0033528741914778948, -0.0031588575802743435, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[3]).toEqualEpsilon( new Cartesian3( @@ -484,7 +488,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.007121194154024124, 0.005899451207369566, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[4].x).toBeGreaterThan(0.0); @@ -527,6 +531,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { DynamicAtmosphereLightingType.SUNLIGHT; scene.renderForSpecs(time); + scene.renderForSpecs(time); expect(manager.radianceCubeMap).toBeInstanceOf(CubeMap); @@ -545,7 +550,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.0054358793422579765, 0.0027179396711289883, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[1]).toEqualEpsilon( new Cartesian3( @@ -553,7 +558,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.0037772462237626314, 0.0018886231118813157, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[2]).toEqualEpsilon( new Cartesian3( @@ -561,7 +566,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { -0.000007333524990826845, -0.0000036667624954134226, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[3]).toEqualEpsilon( new Cartesian3( @@ -569,7 +574,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.000008501945558236912, 0.000004250972779118456, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[4].x).toBeLessThan(0.0); @@ -614,6 +619,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { const primitive = new EnvironmentMockPrimitive(manager); scene.primitives.add(primitive); + scene.renderForSpecs(); scene.renderForSpecs(); expect(manager.radianceCubeMap).toBeInstanceOf(CubeMap); @@ -633,7 +639,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.04545757919549942, 0.02313476987183094, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[1]).toEqualEpsilon( new Cartesian3( @@ -641,7 +647,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.004114487674087286, -0.0017214358085766435, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[2]).toEqualEpsilon( new Cartesian3( @@ -649,7 +655,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { -0.0008244783966802061, -0.00026270488160662353, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[3]).toEqualEpsilon( new Cartesian3( @@ -657,16 +663,16 @@ describe("Scene/DynamicEnvironmentMapManager", function () { -0.000012375472579151392, 0.0005265426589176059, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[4].x).toBeLessThan(0.0); expect(manager.sphericalHarmonicCoefficients[4].y).toBeLessThan(0.0); expect(manager.sphericalHarmonicCoefficients[4].z).toBeLessThan(0.0); - expect(manager.sphericalHarmonicCoefficients[5].x).toBeGreaterThan(0.0); - expect(manager.sphericalHarmonicCoefficients[5].y).toBeGreaterThan(0.0); - expect(manager.sphericalHarmonicCoefficients[5].z).toBeGreaterThan(0.0); + expect(manager.sphericalHarmonicCoefficients[5].x).toBeLessThan(0.0); + expect(manager.sphericalHarmonicCoefficients[5].y).toBeLessThan(0.0); + expect(manager.sphericalHarmonicCoefficients[5].z).toBeLessThan(0.0); expect(manager.sphericalHarmonicCoefficients[6].x).toBeGreaterThan(0.0); expect(manager.sphericalHarmonicCoefficients[6].y).toBeGreaterThan(0.0); @@ -696,6 +702,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { const primitive = new EnvironmentMockPrimitive(manager); scene.primitives.add(primitive); + scene.renderForSpecs(); scene.renderForSpecs(); expect(manager.radianceCubeMap).toBeInstanceOf(CubeMap); @@ -715,7 +722,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.039464931935071945, 0.047749463468790054, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[1]).toEqualEpsilon( new Cartesian3( @@ -723,7 +730,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.031872138381004333, 0.04223670810461044, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[2]).toEqualEpsilon( new Cartesian3( @@ -731,7 +738,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { -0.0008044499554671347, -0.0008345510577782989, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[3]).toEqualEpsilon( new Cartesian3( @@ -739,7 +746,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { -0.000017321406630799174, -0.000006108442903496325, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[4].x).toBeLessThan(0.0); @@ -779,6 +786,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { const primitive = new EnvironmentMockPrimitive(manager); scene.primitives.add(primitive); + scene.renderForSpecs(); scene.renderForSpecs(); expect(manager.radianceCubeMap).toBeInstanceOf(CubeMap); @@ -798,7 +806,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.21367456018924713, 0.23666927218437195, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[1]).toEqualEpsilon( new Cartesian3( @@ -806,7 +814,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.15787045657634735, 0.19085952639579773, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[2]).toEqualEpsilon( new Cartesian3( @@ -814,7 +822,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { -0.0010327763156965375, -0.001100384397432208, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[3]).toEqualEpsilon( new Cartesian3( @@ -822,7 +830,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.00028964842204004526, 0.00021805899450555444, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[4].x).toBeLessThan(0.0); @@ -862,6 +870,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { const primitive = new EnvironmentMockPrimitive(manager); scene.primitives.add(primitive); + scene.renderForSpecs(); scene.renderForSpecs(); expect(manager.radianceCubeMap).toBeInstanceOf(CubeMap); @@ -881,7 +890,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.07419705390930176, 0.09077795594930649, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[1]).toEqualEpsilon( new Cartesian3( @@ -889,7 +898,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.06336799263954163, 0.08409948647022247, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[2]).toEqualEpsilon( new Cartesian3( @@ -897,7 +906,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { -0.0006284310948103666, -0.000669674074742943, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[3]).toEqualEpsilon( new Cartesian3( @@ -905,7 +914,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.000024254957679659128, 0.00004792874096892774, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[4].x).toBeLessThan(0.0); @@ -945,6 +954,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { const primitive = new EnvironmentMockPrimitive(manager); scene.primitives.add(primitive); + scene.renderForSpecs(); scene.renderForSpecs(); expect(manager.radianceCubeMap).toBeInstanceOf(CubeMap); @@ -964,7 +974,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.13499368727207184, 0.13499368727207184, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[1]).toEqualEpsilon( new Cartesian3( @@ -972,7 +982,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.1081928238272667, 0.1081928238272667, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[2]).toEqualEpsilon( new Cartesian3( @@ -980,7 +990,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { -0.0013909616973251104, -0.00141593546140939, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[3]).toEqualEpsilon( new Cartesian3( @@ -988,7 +998,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.00016706169117242098, 0.00006681153899990022, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[4].x).toBeLessThan(0.0); @@ -1028,6 +1038,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { const primitive = new EnvironmentMockPrimitive(manager); scene.primitives.add(primitive); + scene.renderForSpecs(); scene.renderForSpecs(); expect(manager.radianceCubeMap).toBeInstanceOf(CubeMap); @@ -1047,7 +1058,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.11958353966474533, 0.15991388261318207, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[1]).toEqualEpsilon( new Cartesian3( @@ -1055,7 +1066,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.11915278434753418, 0.15629366040229797, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[2]).toEqualEpsilon( new Cartesian3( @@ -1063,7 +1074,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { -0.0016134318429976702, -0.0015525781782343984, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[3]).toEqualEpsilon( new Cartesian3( @@ -1071,16 +1082,22 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.000019326049368828535, -0.000023931264877319336, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[4].x).toBeLessThan(0.0); - expect(manager.sphericalHarmonicCoefficients[4].y).toBeGreaterThan(0.0); - expect(manager.sphericalHarmonicCoefficients[4].z).toBeLessThan(0.0); + expect(manager.sphericalHarmonicCoefficients[4].y).toEqualEpsilon( + 0.0, + CesiumMath.EPSILON2, + ); + expect(manager.sphericalHarmonicCoefficients[4].z).toEqualEpsilon( + 0.0, + CesiumMath.EPSILON2, + ); expect(manager.sphericalHarmonicCoefficients[5].x).toBeGreaterThan(0.0); - expect(manager.sphericalHarmonicCoefficients[5].y).toBeLessThan(0.0); - expect(manager.sphericalHarmonicCoefficients[5].z).toBeLessThan(0.0); + expect(manager.sphericalHarmonicCoefficients[5].y).toBeGreaterThan(0.0); + expect(manager.sphericalHarmonicCoefficients[5].z).toBeGreaterThan(0.0); expect(manager.sphericalHarmonicCoefficients[6].x).toBeLessThan(0.0); expect(manager.sphericalHarmonicCoefficients[6].y).toBeLessThan(0.0); @@ -1111,6 +1128,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { const primitive = new EnvironmentMockPrimitive(manager); scene.primitives.add(primitive); + scene.renderForSpecs(); scene.renderForSpecs(); expect(manager.radianceCubeMap).toBeInstanceOf(CubeMap); @@ -1130,7 +1148,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.1812949925661087, 0.19759616255760193, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[1]).toEqualEpsilon( new Cartesian3( @@ -1138,7 +1156,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.09013032913208008, 0.13857196271419525, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[2]).toEqualEpsilon( new Cartesian3( @@ -1146,7 +1164,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { -0.000895244418643415, -0.0011140345595777035, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[3]).toEqualEpsilon( new Cartesian3( @@ -1154,7 +1172,7 @@ describe("Scene/DynamicEnvironmentMapManager", function () { 0.0004962628008797765, 0.0002673182752914727, ), - CesiumMath.EPSILON4, + CesiumMath.EPSILON2, ); expect(manager.sphericalHarmonicCoefficients[4].x).toBeLessThan(0.0); diff --git a/packages/engine/package.json b/packages/engine/package.json index f95090f5176f..1c33ec28b78a 100644 --- a/packages/engine/package.json +++ b/packages/engine/package.json @@ -1,6 +1,6 @@ { "name": "@cesium/engine", - "version": "13.0.0", + "version": "13.1.0", "description": "CesiumJS is a JavaScript library for creating 3D globes and 2D maps in a web browser without a plugin.", "keywords": [ "3D", diff --git a/packages/widgets/package.json b/packages/widgets/package.json index eecf87e2728d..fbcc895a51bb 100644 --- a/packages/widgets/package.json +++ b/packages/widgets/package.json @@ -1,6 +1,6 @@ { "name": "@cesium/widgets", - "version": "10.0.0", + "version": "10.1.0", "description": "A widgets library for use with CesiumJS. CesiumJS is a JavaScript library for creating 3D globes and 2D maps in a web browser without a plugin.", "keywords": [ "3D", @@ -28,7 +28,7 @@ "node": ">=14.0.0" }, "dependencies": { - "@cesium/engine": "^13.0.0", + "@cesium/engine": "^13.1.0", "nosleep.js": "^0.12.0" }, "type": "module",