Skip to content

Commit

Permalink
Merge branch 'main' into fix-czm_specularEnvironmentMaps-datatype
Browse files Browse the repository at this point in the history
  • Loading branch information
XiaoHu1994 authored Jan 3, 2025
2 parents 11006cf + 0717fcf commit 106da8e
Show file tree
Hide file tree
Showing 17 changed files with 152 additions and 36 deletions.
11 changes: 0 additions & 11 deletions .slackbot.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@
"3DTILES",
"aabb",
"Amato",
"basisu",
"bathymetric",
"bitangent",
"bitangents",
"bivariate",
"Bourke",
"brdf",
"cartesians",
"carto",
"cartographics",
"cesiumjs",
"comms",
Expand Down Expand Up @@ -93,6 +95,7 @@
"unregisters",
"unrenderable",
"voxel",
"VVLH",
"WEBG",
"xdescribe"
]
Expand Down
15 changes: 10 additions & 5 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@

### 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
Expand All @@ -14,7 +22,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.
Expand Down Expand Up @@ -97,9 +105,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
Expand Down
2 changes: 1 addition & 1 deletion Documentation/Contributors/ReleaseGuide/README.md
Original file line number Diff line number Diff line change
@@ -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)).

Expand Down
16 changes: 16 additions & 0 deletions Documentation/Contributors/ReleaseGuide/ReleaseSchedule.md
Original file line number Diff line number Diff line change
@@ -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` |
8 changes: 4 additions & 4 deletions ThirdParty.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
"license": [
"BSD-3-Clause"
],
"version": "2.7.53",
"version": "2.7.54",
"url": "https://www.npmjs.com/package/@zip.js/zip.js"
},
{
"name": "autolinker",
"license": [
"MIT"
],
"version": "4.0.0",
"version": "4.1.0",
"url": "https://www.npmjs.com/package/autolinker"
},
{
Expand All @@ -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"
},
Expand All @@ -61,7 +61,7 @@
"license": [
"ISC"
],
"version": "3.0.0",
"version": "3.0.1",
"url": "https://www.npmjs.com/package/earcut"
},
{
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -159,4 +159,4 @@
"packages/engine",
"packages/widgets"
]
}
}
2 changes: 1 addition & 1 deletion packages/engine/Source/Core/Ion.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
24 changes: 23 additions & 1 deletion packages/engine/Source/DataSources/ModelGraphics.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ function createArticulationStagePropertyBag(value) {
return new PropertyBag(value);
}

function createEnvironmentMapPropertyBag(value) {
return new PropertyBag(value);
}

/**
* @typedef {object} ModelGraphics.ConstructorOptions
*
Expand All @@ -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 <code>colorBlendMode</code> is <code>MIX</code>. 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<string, *>} [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 <code>undefined</code> 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<string, TranslationRotationScale>} [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.
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 <code>undefined</code> the scene's light color is used instead.
* @memberOf ModelGraphics.prototype
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
23 changes: 22 additions & 1 deletion packages/engine/Source/DataSources/ModelVisualizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -76,6 +79,7 @@ async function createModelPrimitive(
entity,
resource,
incrementallyLoadTextures,
environmentMapOptions,
) {
const primitives = visualizer._primitives;
const modelHash = visualizer._modelHash;
Expand All @@ -85,6 +89,7 @@ async function createModelPrimitive(
url: resource,
incrementallyLoadTextures: incrementallyLoadTextures,
scene: visualizer._scene,
environmentMapOptions: environmentMapOptions,
});

if (visualizer.isDestroyed() || !defined(modelHash[entity.id])) {
Expand Down Expand Up @@ -176,6 +181,9 @@ ModelVisualizer.prototype.update = function (time) {
articulationsScratch: {},
loadFailed: false,
modelUpdated: false,
environmentMapOptionsScratch: {
...defaultEnvironmentMapOptions,
},
};
modelHash[entity.id] = modelData;

Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion packages/engine/Source/Scene/ArcGisMapService.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
2 changes: 1 addition & 1 deletion packages/engine/Source/Scene/Cesium3DTileset.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <code>undefined</code> 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.
Expand Down
2 changes: 1 addition & 1 deletion packages/engine/Source/Scene/Model/Model.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
42 changes: 42 additions & 0 deletions packages/engine/Specs/DataSources/ModelVisualizerSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();

Expand Down
Loading

0 comments on commit 106da8e

Please sign in to comment.