bruce-cesium 7.1.7 → 7.1.9

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.
@@ -2970,6 +2970,8 @@
2970
2970
  const CESIUM_MODEL_SPACE_KEY = "_nextspace_model_space";
2971
2971
  const DEFAULT_LIVE_PADDING_SECONDS = 30 * 60;
2972
2972
  const DEFAULT_BRIGHTNESS_SHIFT = 0.2;
2973
+ const DEFAULT_LIGHT_INTENSITY = 3;
2974
+ const LIGHTING_SETTINGS_VERSION = 2;
2973
2975
  (function (ViewUtils) {
2974
2976
  function GatherLegacyMapTiles(params) {
2975
2977
  const viewer = params.viewer;
@@ -3320,23 +3322,50 @@
3320
3322
  */
3321
3323
  function ApplyDefaultBrightness(viewer, shift = DEFAULT_BRIGHTNESS_SHIFT) {
3322
3324
  const scene = viewer === null || viewer === void 0 ? void 0 : viewer.scene;
3323
- if (!scene || !(shift > 0)) {
3325
+ if (!scene) {
3324
3326
  return;
3325
3327
  }
3326
3328
  // Atmosphere settings moved from Globe onto Scene, and the sky keeps its own copy, so each is
3327
3329
  // probed rather than version checked: host apps bring their own CesiumJS.
3328
3330
  const SCENE = scene;
3329
- if (SCENE.atmosphere && typeof SCENE.atmosphere.brightnessShift === "number") {
3330
- SCENE.atmosphere.brightnessShift = shift;
3331
- }
3332
- if (SCENE.globe && typeof SCENE.globe.atmosphereBrightnessShift === "number") {
3333
- SCENE.globe.atmosphereBrightnessShift = shift;
3334
- }
3335
- if (SCENE.skyAtmosphere && typeof SCENE.skyAtmosphere.brightnessShift === "number") {
3336
- SCENE.skyAtmosphere.brightnessShift = shift;
3331
+ if (shift > 0) {
3332
+ if (SCENE.atmosphere && typeof SCENE.atmosphere.brightnessShift === "number") {
3333
+ SCENE.atmosphere.brightnessShift = shift;
3334
+ }
3335
+ if (SCENE.globe && typeof SCENE.globe.atmosphereBrightnessShift === "number") {
3336
+ SCENE.globe.atmosphereBrightnessShift = shift;
3337
+ }
3338
+ if (SCENE.skyAtmosphere && typeof SCENE.skyAtmosphere.brightnessShift === "number") {
3339
+ SCENE.skyAtmosphere.brightnessShift = shift;
3340
+ }
3337
3341
  }
3338
3342
  }
3339
3343
  ViewUtils.ApplyDefaultBrightness = ApplyDefaultBrightness;
3344
+ /**
3345
+ * Resolves the sun colour and intensity to apply for a bookmark's lighting settings.
3346
+ * @param lighting the bookmark's lighting settings, or null when it carries none.
3347
+ * @returns the colour and intensity to put on the scene light.
3348
+ */
3349
+ function ResolveLightSettings(lighting) {
3350
+ const raw = lighting === null || lighting === void 0 ? void 0 : lighting.color;
3351
+ // An unreadable or missing colour would otherwise leave the light undefined.
3352
+ 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
+ const intensity = Number(lighting === null || lighting === void 0 ? void 0 : lighting.intensity);
3356
+ return {
3357
+ color: parsed || Cesium.Color.WHITE,
3358
+ intensity: stale || !Number.isFinite(intensity) ? DEFAULT_LIGHT_INTENSITY : intensity
3359
+ };
3360
+ }
3361
+ 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;
3340
3369
  function SetGlobeDetails(params) {
3341
3370
  let { viewer, hidden, baseColor } = params;
3342
3371
  const scene = viewer === null || viewer === void 0 ? void 0 : viewer.scene;
@@ -14661,6 +14690,7 @@
14661
14690
  const defaultProps = {
14662
14691
  // "Optimization option. Reduce the screen space error for tiles that are further away from the camera.".
14663
14692
  dynamicScreenSpaceError: true,
14693
+ environmentMapOptions: exports.ViewUtils.DefaultEnvironmentMapOptions()
14664
14694
  };
14665
14695
  if (noMemoryLimit != true) {
14666
14696
  // "The maximum amount of memory in MB that can be used by the tileset.".
@@ -21376,7 +21406,8 @@
21376
21406
  return;
21377
21407
  }
21378
21408
  this.cTileset = await CESIUM.Cesium3DTileset.fromUrl(proxyRootUrl, {
21379
- showCreditsOnScreen: true
21409
+ showCreditsOnScreen: true,
21410
+ environmentMapOptions: exports.ViewUtils.DefaultEnvironmentMapOptions()
21380
21411
  });
21381
21412
  }
21382
21413
  else {
@@ -22912,6 +22943,7 @@
22912
22943
  const cEntity = this.viewer.entities.add({
22913
22944
  model: {
22914
22945
  uri: lod["ClientFile"].URL,
22946
+ environmentMapOptions: exports.ViewUtils.DefaultEnvironmentMapOptions(),
22915
22947
  heightReference: Cesium.HeightReference.NONE
22916
22948
  },
22917
22949
  // point: {
@@ -28969,13 +29001,15 @@
28969
29001
  if (lighting == null) {
28970
29002
  lighting = {
28971
29003
  color: Cesium.Color.WHITE.toCssColorString(),
28972
- intensity: 2
29004
+ intensity: DEFAULT_LIGHT_INTENSITY,
29005
+ lightingVer: LIGHTING_SETTINGS_VERSION
28973
29006
  };
28974
29007
  }
28975
29008
  const light = viewer.scene.light;
28976
29009
  if (light) {
28977
- light.color = Cesium.Color.fromCssColorString(lighting.color);
28978
- light.intensity = EnsureNumber(lighting.intensity);
29010
+ const resolved = exports.ViewUtils.ResolveLightSettings(lighting);
29011
+ light.color = resolved.color;
29012
+ light.intensity = resolved.intensity;
28979
29013
  }
28980
29014
  exports.ViewUtils.ApplyDefaultBrightness(viewer, EnsureNumber(lighting.brightnessShift, DEFAULT_BRIGHTNESS_SHIFT));
28981
29015
  let quality = bSettings === null || bSettings === void 0 ? void 0 : bSettings.quality;
@@ -38626,6 +38660,7 @@
38626
38660
  id: BModels.ObjectUtils.UId(15),
38627
38661
  model: {
38628
38662
  uri: params.lodUrl,
38663
+ environmentMapOptions: exports.ViewUtils.DefaultEnvironmentMapOptions(),
38629
38664
  heightReference: heightRef,
38630
38665
  scale: new Cesium.CallbackProperty(() => scale * styleScale, true),
38631
38666
  shadows: Cesium.ShadowMode.ENABLED,
@@ -39267,7 +39302,8 @@
39267
39302
  return await CESIUM.Model.fromGltfAsync({
39268
39303
  url: url,
39269
39304
  asynchronous: true,
39270
- scale: scale
39305
+ scale: scale,
39306
+ environmentMapOptions: exports.ViewUtils.DefaultEnvironmentMapOptions()
39271
39307
  });
39272
39308
  }
39273
39309
  // Older versions of Cesium have a fromGltf method.
@@ -43404,7 +43440,7 @@ void main() {
43404
43440
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
43405
43441
  })(exports.StyleUtils || (exports.StyleUtils = {}));
43406
43442
 
43407
- const VERSION = "7.1.7";
43443
+ const VERSION = "7.1.9";
43408
43444
  /**
43409
43445
  * Updates the environment instance used by bruce-cesium to one specified.
43410
43446
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.
@@ -43436,6 +43472,8 @@ void main() {
43436
43472
  exports.CESIUM_MODEL_SPACE_KEY = CESIUM_MODEL_SPACE_KEY;
43437
43473
  exports.DEFAULT_LIVE_PADDING_SECONDS = DEFAULT_LIVE_PADDING_SECONDS;
43438
43474
  exports.DEFAULT_BRIGHTNESS_SHIFT = DEFAULT_BRIGHTNESS_SHIFT;
43475
+ exports.DEFAULT_LIGHT_INTENSITY = DEFAULT_LIGHT_INTENSITY;
43476
+ exports.LIGHTING_SETTINGS_VERSION = LIGHTING_SETTINGS_VERSION;
43439
43477
  exports.Draw3dPolygon = Draw3dPolygon;
43440
43478
  exports.Draw3dPolyline = Draw3dPolyline;
43441
43479
  exports.WidgetControlViewBarSearch = WidgetControlViewBarSearch;