bruce-cesium 7.1.9 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bruce-cesium.es5.js +108 -23
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +107 -20
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/entity-render-engine-model3d.js +2 -2
- package/dist/lib/rendering/entity-render-engine-model3d.js.map +1 -1
- package/dist/lib/rendering/render-managers/other/assembly-render-manager.js +1 -1
- package/dist/lib/rendering/render-managers/other/assembly-render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/tilesets/tileset-google-photos-render-manager.js +1 -1
- package/dist/lib/rendering/render-managers/tilesets/tileset-google-photos-render-manager.js.map +1 -1
- package/dist/lib/rendering/tileset-render-engine.js +1 -1
- package/dist/lib/rendering/tileset-render-engine.js.map +1 -1
- package/dist/lib/utils/view-utils.js +100 -15
- package/dist/lib/utils/view-utils.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/utils/view-utils.d.ts +30 -7
- package/package.json +1 -1
package/dist/bruce-cesium.umd.js
CHANGED
|
@@ -2969,9 +2969,30 @@
|
|
|
2969
2969
|
const CESIUM_TIMELINE_INTERVAL_KEY = "_nextspace_timeline_interval";
|
|
2970
2970
|
const CESIUM_MODEL_SPACE_KEY = "_nextspace_model_space";
|
|
2971
2971
|
const DEFAULT_LIVE_PADDING_SECONDS = 30 * 60;
|
|
2972
|
-
|
|
2973
|
-
|
|
2972
|
+
// Atmosphere shifts are left alone by default. Tuning against a CAD scene showed the lift washing the
|
|
2973
|
+
// sky without helping models, which are lit by the environment map rather than by the atmosphere.
|
|
2974
|
+
const DEFAULT_BRIGHTNESS_SHIFT = 0;
|
|
2975
|
+
/*
|
|
2976
|
+
* Environment lighting defaults, arrived at by tuning against a white CAD model on CesiumJS 1.143.
|
|
2977
|
+
*/
|
|
2978
|
+
function neutralEnvironmentMapOptions() {
|
|
2979
|
+
return {
|
|
2980
|
+
groundColor: Cesium.Color.WHITE.clone(),
|
|
2981
|
+
groundAlbedo: 0.26,
|
|
2982
|
+
brightness: 1.5,
|
|
2983
|
+
atmosphereScatteringIntensity: 3.2
|
|
2984
|
+
};
|
|
2985
|
+
}
|
|
2986
|
+
// Sun intensity used when the bookmark's lighting settings name none.
|
|
2987
|
+
const DEFAULT_LIGHT_INTENSITY = 2;
|
|
2988
|
+
// Current shape of a bookmark's lighting settings.
|
|
2974
2989
|
const LIGHTING_SETTINGS_VERSION = 2;
|
|
2990
|
+
// Settings we apply when version is unset or <=1 to compensate for newer Cesium looking darker and more yellow.
|
|
2991
|
+
const LIGHT_INTENSITY_COMPENSATION = 1.2;
|
|
2992
|
+
const MAX_COMPENSATED_LIGHT_INTENSITY = 3;
|
|
2993
|
+
// Set by a host that wants something other than the defaults above. Undefined means "not overridden".
|
|
2994
|
+
let overriddenEnvironmentMapOptions;
|
|
2995
|
+
let overriddenImageBasedLighting;
|
|
2975
2996
|
(function (ViewUtils) {
|
|
2976
2997
|
function GatherLegacyMapTiles(params) {
|
|
2977
2998
|
const viewer = params.viewer;
|
|
@@ -3339,33 +3360,97 @@
|
|
|
3339
3360
|
SCENE.skyAtmosphere.brightnessShift = shift;
|
|
3340
3361
|
}
|
|
3341
3362
|
}
|
|
3363
|
+
// The environment map is built from the atmosphere, and lighting it from the scene's own light
|
|
3364
|
+
// rather than from straight above is what stops it reading flat.
|
|
3365
|
+
const CESIUM = Cesium;
|
|
3366
|
+
if (EngineShadesModelsDarker() && SCENE.atmosphere && CESIUM.DynamicAtmosphereLightingType) {
|
|
3367
|
+
SCENE.atmosphere.dynamicLighting = CESIUM.DynamicAtmosphereLightingType.SCENE_LIGHT;
|
|
3368
|
+
}
|
|
3342
3369
|
}
|
|
3343
3370
|
ViewUtils.ApplyDefaultBrightness = ApplyDefaultBrightness;
|
|
3371
|
+
/**
|
|
3372
|
+
* Options applied to the environment based lighting of every tileset and model this library creates.
|
|
3373
|
+
* Null leaves CesiumJS's own defaults in place.
|
|
3374
|
+
* @param options eg { enabled: false } to switch the lighting off, or { saturation: 0 } to keep the
|
|
3375
|
+
* lift without the ground bounce tinting untextured geometry.
|
|
3376
|
+
*/
|
|
3377
|
+
function SetDefaultEnvironmentMapOptions(options) {
|
|
3378
|
+
overriddenEnvironmentMapOptions = options;
|
|
3379
|
+
}
|
|
3380
|
+
ViewUtils.SetDefaultEnvironmentMapOptions = SetDefaultEnvironmentMapOptions;
|
|
3381
|
+
/**
|
|
3382
|
+
* Whether the host app's CesiumJS is a build that shades models darker than the ones these bookmarks were set up against.
|
|
3383
|
+
* DynamicEnvironmentMapManager arrived with that change, so its presence marks
|
|
3384
|
+
*/
|
|
3385
|
+
function GetDefaultEnvironmentMapOptions(
|
|
3386
|
+
// Overridable so the tuned values can be asserted without swapping out CesiumJS.
|
|
3387
|
+
engineShadesDarker = EngineShadesModelsDarker()) {
|
|
3388
|
+
if (overriddenEnvironmentMapOptions !== undefined) {
|
|
3389
|
+
return overriddenEnvironmentMapOptions ? { ...overriddenEnvironmentMapOptions } : null;
|
|
3390
|
+
}
|
|
3391
|
+
if (!engineShadesDarker) {
|
|
3392
|
+
return null;
|
|
3393
|
+
}
|
|
3394
|
+
return neutralEnvironmentMapOptions();
|
|
3395
|
+
}
|
|
3396
|
+
ViewUtils.GetDefaultEnvironmentMapOptions = GetDefaultEnvironmentMapOptions;
|
|
3397
|
+
/**
|
|
3398
|
+
* The lighting options every tileset and model this library creates is built with.
|
|
3399
|
+
* Spread into the construction options, since both are read once when a primitive is made.
|
|
3400
|
+
*/
|
|
3401
|
+
function DefaultLightingProps(engineShadesDarker = EngineShadesModelsDarker()) {
|
|
3402
|
+
const props = {};
|
|
3403
|
+
const environmentMapOptions = GetDefaultEnvironmentMapOptions(engineShadesDarker);
|
|
3404
|
+
if (environmentMapOptions) {
|
|
3405
|
+
props.environmentMapOptions = environmentMapOptions;
|
|
3406
|
+
}
|
|
3407
|
+
const imageBasedLighting = GetDefaultImageBasedLighting();
|
|
3408
|
+
if (imageBasedLighting) {
|
|
3409
|
+
props.imageBasedLighting = imageBasedLighting;
|
|
3410
|
+
}
|
|
3411
|
+
return props;
|
|
3412
|
+
}
|
|
3413
|
+
ViewUtils.DefaultLightingProps = DefaultLightingProps;
|
|
3414
|
+
/**
|
|
3415
|
+
* ImageBasedLighting applied to every tileset and model this library creates. Null, the default,
|
|
3416
|
+
* leaves CesiumJS's own in place.
|
|
3417
|
+
* @param imageBasedLighting a Cesium.ImageBasedLighting, shared across primitives.
|
|
3418
|
+
*/
|
|
3419
|
+
function SetDefaultImageBasedLighting(imageBasedLighting) {
|
|
3420
|
+
overriddenImageBasedLighting = imageBasedLighting;
|
|
3421
|
+
}
|
|
3422
|
+
ViewUtils.SetDefaultImageBasedLighting = SetDefaultImageBasedLighting;
|
|
3423
|
+
function GetDefaultImageBasedLighting() {
|
|
3424
|
+
return overriddenImageBasedLighting || null;
|
|
3425
|
+
}
|
|
3426
|
+
ViewUtils.GetDefaultImageBasedLighting = GetDefaultImageBasedLighting;
|
|
3427
|
+
function EngineShadesModelsDarker() {
|
|
3428
|
+
return typeof Cesium.DynamicEnvironmentMapManager !== "undefined";
|
|
3429
|
+
}
|
|
3430
|
+
ViewUtils.EngineShadesModelsDarker = EngineShadesModelsDarker;
|
|
3344
3431
|
/**
|
|
3345
3432
|
* Resolves the sun colour and intensity to apply for a bookmark's lighting settings.
|
|
3346
3433
|
* @param lighting the bookmark's lighting settings, or null when it carries none.
|
|
3347
3434
|
* @returns the colour and intensity to put on the scene light.
|
|
3348
3435
|
*/
|
|
3349
|
-
function ResolveLightSettings(lighting
|
|
3436
|
+
function ResolveLightSettings(lighting,
|
|
3437
|
+
// Overridable so both branches can be exercised without swapping out CesiumJS.
|
|
3438
|
+
engineShadesDarker = EngineShadesModelsDarker()) {
|
|
3350
3439
|
const raw = lighting === null || lighting === void 0 ? void 0 : lighting.color;
|
|
3351
|
-
// An unreadable or missing colour would otherwise leave the light undefined.
|
|
3352
3440
|
const parsed = raw ? Cesium.Color.fromCssColorString(raw) : null;
|
|
3353
|
-
const version = Number(lighting === null || lighting === void 0 ? void 0 : lighting.lightingVer);
|
|
3354
|
-
const stale = !Number.isFinite(version) || version <= 1;
|
|
3355
3441
|
const intensity = Number(lighting === null || lighting === void 0 ? void 0 : lighting.intensity);
|
|
3442
|
+
const named = Number.isFinite(intensity) ? intensity : DEFAULT_LIGHT_INTENSITY;
|
|
3443
|
+
// No settings at all means nothing was carried over from the older engine, so there is nothing
|
|
3444
|
+
// to compensate. A settings object with no version in it is the case that predates the field.
|
|
3445
|
+
const version = Number(lighting === null || lighting === void 0 ? void 0 : lighting.lightingVer);
|
|
3446
|
+
const legacy = lighting != null && (!Number.isFinite(version) || version <= 1);
|
|
3447
|
+
const compensated = Math.min(named * LIGHT_INTENSITY_COMPENSATION, MAX_COMPENSATED_LIGHT_INTENSITY);
|
|
3356
3448
|
return {
|
|
3357
3449
|
color: parsed || Cesium.Color.WHITE,
|
|
3358
|
-
intensity:
|
|
3450
|
+
intensity: legacy && engineShadesDarker ? compensated : named
|
|
3359
3451
|
};
|
|
3360
3452
|
}
|
|
3361
3453
|
ViewUtils.ResolveLightSettings = ResolveLightSettings;
|
|
3362
|
-
/**
|
|
3363
|
-
* Options handed to every tileset and model this library creates.
|
|
3364
|
-
*/
|
|
3365
|
-
function DefaultEnvironmentMapOptions() {
|
|
3366
|
-
return { enabled: false };
|
|
3367
|
-
}
|
|
3368
|
-
ViewUtils.DefaultEnvironmentMapOptions = DefaultEnvironmentMapOptions;
|
|
3369
3454
|
function SetGlobeDetails(params) {
|
|
3370
3455
|
let { viewer, hidden, baseColor } = params;
|
|
3371
3456
|
const scene = viewer === null || viewer === void 0 ? void 0 : viewer.scene;
|
|
@@ -14690,8 +14775,8 @@
|
|
|
14690
14775
|
const defaultProps = {
|
|
14691
14776
|
// "Optimization option. Reduce the screen space error for tiles that are further away from the camera.".
|
|
14692
14777
|
dynamicScreenSpaceError: true,
|
|
14693
|
-
environmentMapOptions: exports.ViewUtils.DefaultEnvironmentMapOptions()
|
|
14694
14778
|
};
|
|
14779
|
+
Object.assign(defaultProps, exports.ViewUtils.DefaultLightingProps());
|
|
14695
14780
|
if (noMemoryLimit != true) {
|
|
14696
14781
|
// "The maximum amount of memory in MB that can be used by the tileset.".
|
|
14697
14782
|
defaultProps.maximumMemoryUsage = 512;
|
|
@@ -21407,7 +21492,7 @@
|
|
|
21407
21492
|
}
|
|
21408
21493
|
this.cTileset = await CESIUM.Cesium3DTileset.fromUrl(proxyRootUrl, {
|
|
21409
21494
|
showCreditsOnScreen: true,
|
|
21410
|
-
|
|
21495
|
+
...exports.ViewUtils.DefaultLightingProps()
|
|
21411
21496
|
});
|
|
21412
21497
|
}
|
|
21413
21498
|
else {
|
|
@@ -22943,7 +23028,7 @@
|
|
|
22943
23028
|
const cEntity = this.viewer.entities.add({
|
|
22944
23029
|
model: {
|
|
22945
23030
|
uri: lod["ClientFile"].URL,
|
|
22946
|
-
|
|
23031
|
+
...exports.ViewUtils.DefaultLightingProps(),
|
|
22947
23032
|
heightReference: Cesium.HeightReference.NONE
|
|
22948
23033
|
},
|
|
22949
23034
|
// point: {
|
|
@@ -38660,7 +38745,7 @@
|
|
|
38660
38745
|
id: BModels.ObjectUtils.UId(15),
|
|
38661
38746
|
model: {
|
|
38662
38747
|
uri: params.lodUrl,
|
|
38663
|
-
|
|
38748
|
+
...exports.ViewUtils.DefaultLightingProps(),
|
|
38664
38749
|
heightReference: heightRef,
|
|
38665
38750
|
scale: new Cesium.CallbackProperty(() => scale * styleScale, true),
|
|
38666
38751
|
shadows: Cesium.ShadowMode.ENABLED,
|
|
@@ -39303,7 +39388,7 @@
|
|
|
39303
39388
|
url: url,
|
|
39304
39389
|
asynchronous: true,
|
|
39305
39390
|
scale: scale,
|
|
39306
|
-
|
|
39391
|
+
...exports.ViewUtils.DefaultLightingProps()
|
|
39307
39392
|
});
|
|
39308
39393
|
}
|
|
39309
39394
|
// Older versions of Cesium have a fromGltf method.
|
|
@@ -43440,7 +43525,7 @@ void main() {
|
|
|
43440
43525
|
StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
|
|
43441
43526
|
})(exports.StyleUtils || (exports.StyleUtils = {}));
|
|
43442
43527
|
|
|
43443
|
-
const VERSION = "7.
|
|
43528
|
+
const VERSION = "7.2.0";
|
|
43444
43529
|
/**
|
|
43445
43530
|
* Updates the environment instance used by bruce-cesium to one specified.
|
|
43446
43531
|
* This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.
|
|
@@ -43474,6 +43559,8 @@ void main() {
|
|
|
43474
43559
|
exports.DEFAULT_BRIGHTNESS_SHIFT = DEFAULT_BRIGHTNESS_SHIFT;
|
|
43475
43560
|
exports.DEFAULT_LIGHT_INTENSITY = DEFAULT_LIGHT_INTENSITY;
|
|
43476
43561
|
exports.LIGHTING_SETTINGS_VERSION = LIGHTING_SETTINGS_VERSION;
|
|
43562
|
+
exports.LIGHT_INTENSITY_COMPENSATION = LIGHT_INTENSITY_COMPENSATION;
|
|
43563
|
+
exports.MAX_COMPENSATED_LIGHT_INTENSITY = MAX_COMPENSATED_LIGHT_INTENSITY;
|
|
43477
43564
|
exports.Draw3dPolygon = Draw3dPolygon;
|
|
43478
43565
|
exports.Draw3dPolyline = Draw3dPolyline;
|
|
43479
43566
|
exports.WidgetControlViewBarSearch = WidgetControlViewBarSearch;
|