@cesium/engine 12.0.1 → 13.1.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.
Files changed (161) hide show
  1. package/Build/Workers/{chunk-7D6T2WYT.js → chunk-2ONAV62A.js} +14 -47
  2. package/Build/Workers/{chunk-MV7YO647.js → chunk-2SRHVCFD.js} +6 -6
  3. package/Build/Workers/{chunk-ZPTNVB3S.js → chunk-3SCCWLZS.js} +34 -8
  4. package/Build/Workers/{chunk-7CKQ7PVJ.js → chunk-54I6VSRP.js} +6 -6
  5. package/Build/Workers/{chunk-XDJ7V4NZ.js → chunk-5I3LPAS7.js} +5 -5
  6. package/Build/Workers/{chunk-GSJ6LWIS.js → chunk-5ICYLS6B.js} +35 -21
  7. package/Build/Workers/{chunk-BH5M522L.js → chunk-5JY4LYO3.js} +7 -7
  8. package/Build/Workers/{chunk-DR56WFYZ.js → chunk-APCS5YJI.js} +7 -7
  9. package/Build/Workers/{chunk-COHL4R3G.js → chunk-AXYZUG4N.js} +1 -1
  10. package/Build/Workers/{chunk-2IJZVFHY.js → chunk-B34JXFHF.js} +5 -5
  11. package/Build/Workers/{chunk-54NYY4U4.js → chunk-B6IJY6AN.js} +7 -7
  12. package/Build/Workers/{chunk-H3RMGG7L.js → chunk-BMFWWTD7.js} +5 -5
  13. package/Build/Workers/{chunk-PJHRB4YJ.js → chunk-CBE4HRBH.js} +7 -7
  14. package/Build/Workers/{chunk-U7SH6OK7.js → chunk-CNPP6TQ2.js} +4 -4
  15. package/Build/Workers/{chunk-2XOUWNPN.js → chunk-DWIKWWEE.js} +5 -5
  16. package/Build/Workers/{chunk-PNA47CR7.js → chunk-EHGQQA7C.js} +1 -1
  17. package/Build/Workers/{chunk-7EBHNJTG.js → chunk-EJ5DT5BP.js} +1 -1
  18. package/Build/Workers/{chunk-3Y4UGAYI.js → chunk-EYZFEJX3.js} +6 -6
  19. package/Build/Workers/{chunk-EMCXAVSG.js → chunk-FNCXBBCF.js} +2 -2
  20. package/Build/Workers/{chunk-NL73INJS.js → chunk-GIOZHX7U.js} +2 -2
  21. package/Build/Workers/{chunk-VHGI7D3P.js → chunk-GSLKQJM2.js} +10 -10
  22. package/Build/Workers/{chunk-647NL6VU.js → chunk-HI73PIPQ.js} +2 -2
  23. package/Build/Workers/{chunk-GRQQHWMD.js → chunk-IP7F2MVW.js} +7 -7
  24. package/Build/Workers/{chunk-LBNGHEJY.js → chunk-IXNXKVOB.js} +4 -4
  25. package/Build/Workers/{chunk-2F42VIW6.js → chunk-J7BMSSY7.js} +13 -13
  26. package/Build/Workers/{chunk-PH3T7LNP.js → chunk-K62EHZFT.js} +15 -15
  27. package/Build/Workers/{chunk-GBPW65E3.js → chunk-K6SQV4IS.js} +6 -6
  28. package/Build/Workers/{chunk-WMHJAREU.js → chunk-KO232FLP.js} +2 -2
  29. package/Build/Workers/{chunk-AER5CLXD.js → chunk-KRVALCCI.js} +5 -5
  30. package/Build/Workers/{chunk-22FZ334F.js → chunk-LFUFGHL3.js} +10 -10
  31. package/Build/Workers/{chunk-AGYO4ZSF.js → chunk-LQT2ZK7D.js} +17 -17
  32. package/Build/Workers/{chunk-KJ65M35B.js → chunk-M2AA2ARJ.js} +11 -11
  33. package/Build/Workers/{chunk-YT5PQMSP.js → chunk-MGABCOOH.js} +6 -6
  34. package/Build/Workers/{chunk-JPNFQRN7.js → chunk-NQDKNE7V.js} +13 -13
  35. package/Build/Workers/{chunk-IJWXYSFC.js → chunk-OARMSJUU.js} +2 -2
  36. package/Build/Workers/{chunk-K7QC3WDT.js → chunk-OGRXNUR2.js} +1 -1
  37. package/Build/Workers/{chunk-KKMH4BKN.js → chunk-OZTFRHA2.js} +6 -6
  38. package/Build/Workers/{chunk-DJ7K7EYK.js → chunk-PBJQFLKS.js} +11 -11
  39. package/Build/Workers/{chunk-ETXXXGMP.js → chunk-PM76TX2X.js} +6 -6
  40. package/Build/Workers/{chunk-PISTPJXS.js → chunk-PTFIVVLX.js} +12 -12
  41. package/Build/Workers/{chunk-VXVQITFC.js → chunk-R2KGFZBA.js} +13 -13
  42. package/Build/Workers/{chunk-VO4SXJXT.js → chunk-S3UM4OKP.js} +7 -7
  43. package/Build/Workers/{chunk-NELAPOO6.js → chunk-SAKQO5NX.js} +2 -2
  44. package/Build/Workers/{chunk-ENARO52I.js → chunk-T34EOLFR.js} +14 -14
  45. package/Build/Workers/{chunk-X6YBZOOA.js → chunk-THDHWSEJ.js} +4 -4
  46. package/Build/Workers/{chunk-LVHHB5T6.js → chunk-TOHDFUJM.js} +4 -4
  47. package/Build/Workers/{chunk-Q7IIOKAT.js → chunk-UBAHTE4Q.js} +1 -1
  48. package/Build/Workers/{chunk-IAX6MIST.js → chunk-WAJNX74N.js} +17 -17
  49. package/Build/Workers/{chunk-76KRKKEF.js → chunk-WE4KF4AM.js} +9 -9
  50. package/Build/Workers/{chunk-JAKTB6CE.js → chunk-WUIDEXAN.js} +7 -7
  51. package/Build/Workers/{chunk-IVCFTVYW.js → chunk-YVGU235V.js} +4 -4
  52. package/Build/Workers/{chunk-ZCCI55EY.js → chunk-ZWSWJYJP.js} +13 -13
  53. package/Build/Workers/combineGeometry.js +22 -22
  54. package/Build/Workers/createBoxGeometry.js +16 -16
  55. package/Build/Workers/createBoxOutlineGeometry.js +14 -14
  56. package/Build/Workers/createCircleGeometry.js +24 -24
  57. package/Build/Workers/createCircleOutlineGeometry.js +17 -17
  58. package/Build/Workers/createCoplanarPolygonGeometry.js +31 -31
  59. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +29 -29
  60. package/Build/Workers/createCorridorGeometry.js +27 -27
  61. package/Build/Workers/createCorridorOutlineGeometry.js +26 -26
  62. package/Build/Workers/createCylinderGeometry.js +18 -18
  63. package/Build/Workers/createCylinderOutlineGeometry.js +16 -16
  64. package/Build/Workers/createEllipseGeometry.js +24 -24
  65. package/Build/Workers/createEllipseOutlineGeometry.js +17 -17
  66. package/Build/Workers/createEllipsoidGeometry.js +17 -17
  67. package/Build/Workers/createEllipsoidOutlineGeometry.js +16 -16
  68. package/Build/Workers/createFrustumGeometry.js +16 -16
  69. package/Build/Workers/createFrustumOutlineGeometry.js +16 -16
  70. package/Build/Workers/createGeometry.js +22 -22
  71. package/Build/Workers/createGroundPolylineGeometry.js +20 -20
  72. package/Build/Workers/createPlaneGeometry.js +14 -14
  73. package/Build/Workers/createPlaneOutlineGeometry.js +13 -13
  74. package/Build/Workers/createPolygonGeometry.js +30 -30
  75. package/Build/Workers/createPolygonOutlineGeometry.js +28 -28
  76. package/Build/Workers/createPolylineGeometry.js +23 -23
  77. package/Build/Workers/createPolylineVolumeGeometry.js +31 -32
  78. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +25 -25
  79. package/Build/Workers/createRectangleGeometry.js +25 -25
  80. package/Build/Workers/createRectangleOutlineGeometry.js +18 -18
  81. package/Build/Workers/createSimplePolylineGeometry.js +21 -21
  82. package/Build/Workers/createSphereGeometry.js +17 -17
  83. package/Build/Workers/createSphereOutlineGeometry.js +16 -16
  84. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  85. package/Build/Workers/createVectorTileClampedPolylines.js +13 -13
  86. package/Build/Workers/createVectorTileGeometries.js +22 -22
  87. package/Build/Workers/createVectorTilePoints.js +12 -12
  88. package/Build/Workers/createVectorTilePolygons.js +20 -20
  89. package/Build/Workers/createVectorTilePolylines.js +13 -13
  90. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +20 -20
  91. package/Build/Workers/createVerticesFromHeightmap.js +20 -20
  92. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +17 -17
  93. package/Build/Workers/createWallGeometry.js +22 -22
  94. package/Build/Workers/createWallOutlineGeometry.js +21 -21
  95. package/Build/Workers/decodeDraco.js +11 -11
  96. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  97. package/Build/Workers/decodeI3S.js +10 -10
  98. package/Build/Workers/transcodeKTX2.js +7 -7
  99. package/Build/Workers/transferTypedArrayTest.js +1 -1
  100. package/Build/Workers/upsampleQuantizedTerrainMesh.js +20 -20
  101. package/Source/Core/BingMapsGeocoderService.js +2 -0
  102. package/Source/Core/Check.d.ts +2 -1
  103. package/Source/Core/GoogleGeocoderService.js +110 -0
  104. package/Source/Core/ITwinPlatform.js +324 -0
  105. package/Source/Core/Ion.js +1 -1
  106. package/Source/Core/IonGeocodeProviderType.js +33 -0
  107. package/Source/Core/IonGeocoderService.js +72 -0
  108. package/Source/Core/JulianDate.js +14 -7
  109. package/Source/Core/Rectangle.js +0 -20
  110. package/Source/Core/TrackingReferenceFrame.js +45 -0
  111. package/Source/Core/defined.d.ts +11 -0
  112. package/Source/DataSources/Entity.js +15 -1
  113. package/Source/DataSources/EntityView.js +55 -4
  114. package/Source/DataSources/ModelGraphics.js +23 -1
  115. package/Source/DataSources/ModelVisualizer.js +22 -1
  116. package/Source/DataSources/SampledProperty.js +24 -0
  117. package/Source/Renderer/ContextLimits.js +1 -1
  118. package/Source/Renderer/Texture.js +104 -92
  119. package/Source/Scene/ArcGisMapService.js +1 -1
  120. package/Source/Scene/Cesium3DTileset.js +1 -1
  121. package/Source/Scene/Cesium3DTilesetStatistics.js +109 -42
  122. package/Source/Scene/DerivedCommand.js +109 -16
  123. package/Source/Scene/DynamicEnvironmentMapManager.js +202 -65
  124. package/Source/Scene/GltfTextureLoader.js +16 -1
  125. package/Source/Scene/ITwinData.js +208 -0
  126. package/Source/Scene/Label.js +17 -3
  127. package/Source/Scene/MetadataClassProperty.js +26 -0
  128. package/Source/Scene/MetadataPicking.js +108 -17
  129. package/Source/Scene/MetadataType.js +20 -0
  130. package/Source/Scene/Model/Extensions/Gpm/GltfMeshPrimitiveGpmLoader.js +6 -11
  131. package/Source/Scene/Model/Model.js +1 -1
  132. package/Source/Scene/Model/Model3DTileContent.js +23 -1
  133. package/Source/Scene/Model/ModelStatistics.js +33 -5
  134. package/Source/Scene/Model/PointCloudStylingPipelineStage.js +2 -1
  135. package/Source/Scene/PickedMetadataInfo.js +21 -3
  136. package/Source/Scene/Picking.js +7 -1
  137. package/Source/Scene/PostProcessStage.js +14 -17
  138. package/Source/Scene/PostProcessStageCollection.js +4 -16
  139. package/Source/Scene/PostProcessStageLibrary.js +13 -51
  140. package/Source/Scene/PropertyAttributeProperty.js +15 -3
  141. package/Source/Scene/PropertyTextureProperty.js +12 -0
  142. package/Source/Scene/Scene.js +17 -2
  143. package/Source/Scene/SkyBox.js +23 -4
  144. package/Source/Scene/UrlTemplateImageryProvider.js +5 -5
  145. package/Source/Scene/createGooglePhotorealistic3DTileset.js +55 -16
  146. package/Source/Scene/getMetadataProperty.js +48 -0
  147. package/Source/Shaders/Builtin/Functions/reverseLogDepth.glsl +1 -1
  148. package/Source/Shaders/Builtin/Functions/reverseLogDepth.js +1 -1
  149. package/Source/Shaders/ConvolveSpecularMapFS.glsl +1 -1
  150. package/Source/Shaders/ConvolveSpecularMapFS.js +1 -1
  151. package/Source/Shaders/DepthPlaneVS.glsl +1 -1
  152. package/Source/Shaders/DepthPlaneVS.js +1 -1
  153. package/Source/Shaders/Model/ModelFS.glsl +7 -0
  154. package/Source/Shaders/Model/ModelFS.js +7 -0
  155. package/Source/Shaders/Model/ModelVS.glsl +9 -1
  156. package/Source/Shaders/Model/ModelVS.js +9 -1
  157. package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.glsl +66 -37
  158. package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.js +66 -37
  159. package/index.d.ts +295 -42
  160. package/index.js +67 -61
  161. package/package.json +1 -1
@@ -8,8 +8,11 @@ import JulianDate from "../Core/JulianDate.js";
8
8
  import CesiumMath from "../Core/Math.js";
9
9
  import Matrix3 from "../Core/Matrix3.js";
10
10
  import Matrix4 from "../Core/Matrix4.js";
11
+ import Quaternion from "../Core/Quaternion.js";
12
+ import TrackingReferenceFrame from "../Core/TrackingReferenceFrame.js";
11
13
  import Transforms from "../Core/Transforms.js";
12
14
  import SceneMode from "../Scene/SceneMode.js";
15
+ import VelocityVectorProperty from "./VelocityVectorProperty.js";
13
16
 
14
17
  const updateTransformMatrix3Scratch1 = new Matrix3();
15
18
  const updateTransformMatrix3Scratch2 = new Matrix3();
@@ -21,6 +24,9 @@ const updateTransformCartesian3Scratch3 = new Cartesian3();
21
24
  const updateTransformCartesian3Scratch4 = new Cartesian3();
22
25
  const updateTransformCartesian3Scratch5 = new Cartesian3();
23
26
  const updateTransformCartesian3Scratch6 = new Cartesian3();
27
+ const updateTransformOrientationScratch = new Quaternion();
28
+ const velocityScratch = new Cartesian3();
29
+ const rotationScratch = new Matrix3();
24
30
  const deltaTime = new JulianDate();
25
31
  const northUpAxisFactor = 1.25; // times ellipsoid's maximum radius
26
32
 
@@ -30,6 +36,9 @@ function updateTransform(
30
36
  updateLookAt,
31
37
  saveCamera,
32
38
  positionProperty,
39
+ velocityProperty,
40
+ orientationProperty,
41
+ trackingReferenceFrame,
33
42
  time,
34
43
  ellipsoid,
35
44
  ) {
@@ -228,7 +237,44 @@ function updateTransform(
228
237
  }
229
238
 
230
239
  const transform = updateTransformMatrix4Scratch;
231
- if (hasBasis) {
240
+
241
+ let orientation;
242
+ if (defined(orientationProperty)) {
243
+ orientation = orientationProperty.getValue(
244
+ time,
245
+ updateTransformOrientationScratch,
246
+ );
247
+ }
248
+
249
+ const velocity = velocityProperty.getValue(time, velocityScratch);
250
+
251
+ if (
252
+ trackingReferenceFrame === TrackingReferenceFrame.INERTIAL &&
253
+ defined(orientation)
254
+ ) {
255
+ Matrix4.fromTranslationQuaternionRotationScale(
256
+ cartesian,
257
+ orientation,
258
+ Cartesian3.ONE,
259
+ transform,
260
+ );
261
+ } else if (
262
+ trackingReferenceFrame === TrackingReferenceFrame.VELOCITY &&
263
+ defined(velocity)
264
+ ) {
265
+ const rotation = Transforms.rotationMatrixFromPositionVelocity(
266
+ cartesian,
267
+ velocity,
268
+ ellipsoid,
269
+ rotationScratch,
270
+ );
271
+ Matrix4.fromRotationTranslation(rotation, cartesian, transform);
272
+ } else if (
273
+ trackingReferenceFrame === TrackingReferenceFrame.ENU ||
274
+ !hasBasis
275
+ ) {
276
+ Transforms.eastNorthUpToFixedFrame(cartesian, ellipsoid, transform);
277
+ } else {
232
278
  transform[0] = xBasis.x;
233
279
  transform[1] = xBasis.y;
234
280
  transform[2] = xBasis.z;
@@ -245,9 +291,6 @@ function updateTransform(
245
291
  transform[13] = cartesian.y;
246
292
  transform[14] = cartesian.z;
247
293
  transform[15] = 0.0;
248
- } else {
249
- // Stationary or slow-moving, low-altitude objects use East-North-Up.
250
- Transforms.eastNorthUpToFixedFrame(cartesian, ellipsoid, transform);
251
294
  }
252
295
 
253
296
  camera._setTransform(transform);
@@ -316,6 +359,8 @@ function EntityView(entity, scene, ellipsoid) {
316
359
  this._lastCartesian = new Cartesian3();
317
360
  this._defaultOffset3D = undefined;
318
361
 
362
+ this._velocityProperty = new VelocityVectorProperty(entity.position, true);
363
+
319
364
  this._offset3D = new Cartesian3();
320
365
  }
321
366
 
@@ -362,10 +407,13 @@ EntityView.prototype.update = function (time, boundingSphere) {
362
407
  }
363
408
 
364
409
  const entity = this.entity;
410
+ const trackingReferenceFrame = entity.trackingReferenceFrame;
365
411
  const positionProperty = entity.position;
366
412
  if (!defined(positionProperty)) {
367
413
  return;
368
414
  }
415
+ const velocityProperty = this._velocityProperty;
416
+ const orientationProperty = entity.orientation;
369
417
  const objectChanged = entity !== this._lastEntity;
370
418
  const sceneModeChanged = sceneMode !== this._mode;
371
419
 
@@ -419,6 +467,9 @@ EntityView.prototype.update = function (time, boundingSphere) {
419
467
  updateLookAt,
420
468
  saveCamera,
421
469
  positionProperty,
470
+ velocityProperty,
471
+ orientationProperty,
472
+ trackingReferenceFrame,
422
473
  time,
423
474
  ellipsoid,
424
475
  );
@@ -18,6 +18,10 @@ function createArticulationStagePropertyBag(value) {
18
18
  return new PropertyBag(value);
19
19
  }
20
20
 
21
+ function createEnvironmentMapPropertyBag(value) {
22
+ return new PropertyBag(value);
23
+ }
24
+
21
25
  /**
22
26
  * @typedef {object} ModelGraphics.ConstructorOptions
23
27
  *
@@ -40,6 +44,7 @@ function createArticulationStagePropertyBag(value) {
40
44
  * @property {Property | ColorBlendMode} [colorBlendMode=ColorBlendMode.HIGHLIGHT] An enum Property specifying how the color blends with the model.
41
45
  * @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.
42
46
  * @property {Property | Cartesian2} [imageBasedLightingFactor=new Cartesian2(1.0, 1.0)] A property specifying the contribution from diffuse and specular image-based lighting.
47
+ * @property {PropertyBag | Object<string, *>} [environmentMapOptions] The properties for managing dynamic environment maps on this entity.
43
48
  * @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.
44
49
  * @property {Property | DistanceDisplayCondition} [distanceDisplayCondition] A Property specifying at what distance from the camera that this model will be displayed.
45
50
  * @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.
@@ -101,6 +106,8 @@ function ModelGraphics(options) {
101
106
  this._colorBlendAmountSubscription = undefined;
102
107
  this._imageBasedLightingFactor = undefined;
103
108
  this._imageBasedLightingFactorSubscription = undefined;
109
+ this._environmentMapOptions = undefined;
110
+ this._environmentMapOptionsSubscription = undefined;
104
111
  this._lightColor = undefined;
105
112
  this._lightColorSubscription = undefined;
106
113
  this._distanceDisplayCondition = undefined;
@@ -279,6 +286,17 @@ Object.defineProperties(ModelGraphics.prototype, {
279
286
  "imageBasedLightingFactor",
280
287
  ),
281
288
 
289
+ /**
290
+ * Gets or sets the {@link DynamicEnvironmentMapManager.ConstructorOptions} to apply to this model. This is represented as an {@link PropertyBag}.
291
+ * @memberof ModelGraphics.prototype
292
+ * @type {PropertyBag}
293
+ */
294
+ environmentMapOptions: createPropertyDescriptor(
295
+ "environmentMapOptions",
296
+ undefined,
297
+ createEnvironmentMapPropertyBag,
298
+ ),
299
+
282
300
  /**
283
301
  * A property specifying the {@link Cartesian3} light color when shading the model. When <code>undefined</code> the scene's light color is used instead.
284
302
  * @memberOf ModelGraphics.prototype
@@ -361,6 +379,7 @@ ModelGraphics.prototype.clone = function (result) {
361
379
  result.colorBlendMode = this.colorBlendMode;
362
380
  result.colorBlendAmount = this.colorBlendAmount;
363
381
  result.imageBasedLightingFactor = this.imageBasedLightingFactor;
382
+ result.environmentMapOptions = this.environmentMapOptions;
364
383
  result.lightColor = this.lightColor;
365
384
  result.distanceDisplayCondition = this.distanceDisplayCondition;
366
385
  result.nodeTransformations = this.nodeTransformations;
@@ -430,7 +449,10 @@ ModelGraphics.prototype.merge = function (source) {
430
449
  this.imageBasedLightingFactor,
431
450
  source.imageBasedLightingFactor,
432
451
  );
433
-
452
+ this.environmentMapOptions = defaultValue(
453
+ this.environmentMapOptions,
454
+ source.environmentMapOptions,
455
+ );
434
456
  this.lightColor = defaultValue(this.lightColor, source.lightColor);
435
457
  this.distanceDisplayCondition = defaultValue(
436
458
  this.distanceDisplayCondition,
@@ -35,6 +35,9 @@ const defaultColor = Color.WHITE;
35
35
  const defaultColorBlendMode = ColorBlendMode.HIGHLIGHT;
36
36
  const defaultColorBlendAmount = 0.5;
37
37
  const defaultImageBasedLightingFactor = new Cartesian2(1.0, 1.0);
38
+ const defaultEnvironmentMapOptions = {
39
+ maximumPositionEpsilon: Number.POSITIVE_INFINITY,
40
+ };
38
41
 
39
42
  const modelMatrixScratch = new Matrix4();
40
43
  const nodeMatrixScratch = new Matrix4();
@@ -76,6 +79,7 @@ async function createModelPrimitive(
76
79
  entity,
77
80
  resource,
78
81
  incrementallyLoadTextures,
82
+ environmentMapOptions,
79
83
  ) {
80
84
  const primitives = visualizer._primitives;
81
85
  const modelHash = visualizer._modelHash;
@@ -85,6 +89,7 @@ async function createModelPrimitive(
85
89
  url: resource,
86
90
  incrementallyLoadTextures: incrementallyLoadTextures,
87
91
  scene: visualizer._scene,
92
+ environmentMapOptions: environmentMapOptions,
88
93
  });
89
94
 
90
95
  if (visualizer.isDestroyed() || !defined(modelHash[entity.id])) {
@@ -176,6 +181,9 @@ ModelVisualizer.prototype.update = function (time) {
176
181
  articulationsScratch: {},
177
182
  loadFailed: false,
178
183
  modelUpdated: false,
184
+ environmentMapOptionsScratch: {
185
+ ...defaultEnvironmentMapOptions,
186
+ },
179
187
  };
180
188
  modelHash[entity.id] = modelData;
181
189
 
@@ -185,7 +193,20 @@ ModelVisualizer.prototype.update = function (time) {
185
193
  defaultIncrementallyLoadTextures,
186
194
  );
187
195
 
188
- createModelPrimitive(this, entity, resource, incrementallyLoadTextures);
196
+ const environmentMapOptions = Property.getValueOrDefault(
197
+ modelGraphics._environmentMapOptions,
198
+ time,
199
+ defaultEnvironmentMapOptions,
200
+ modelData.environmentMapOptionsScratch,
201
+ );
202
+
203
+ createModelPrimitive(
204
+ this,
205
+ entity,
206
+ resource,
207
+ incrementallyLoadTextures,
208
+ environmentMapOptions,
209
+ );
189
210
  }
190
211
 
191
212
  const model = modelData.modelPrimitive;
@@ -674,6 +674,30 @@ SampledProperty.prototype.addSamples = function (
674
674
  this._definitionChanged.raiseEvent(this);
675
675
  };
676
676
 
677
+ /**
678
+ * Retrieves the time of the provided sample associated with the index. A negative index accesses the list of samples in reverse order.
679
+ *
680
+ * @param {number} index The index of samples list.
681
+ * @returns {JulianDate | undefined} The JulianDate time of the sample, or undefined if failed.
682
+ */
683
+ SampledProperty.prototype.getSample = function (index) {
684
+ //>>includeStart('debug', pragmas.debug);
685
+ Check.typeOf.number("index", index);
686
+ //>>includeEnd('debug');
687
+
688
+ const times = this._times;
689
+ const len = times.length;
690
+ if (!defined(len)) {
691
+ return undefined;
692
+ }
693
+
694
+ if (index < 0) {
695
+ index += len;
696
+ }
697
+
698
+ return times[index];
699
+ };
700
+
677
701
  /**
678
702
  * Adds samples as a single packed array where each new sample is represented as a date,
679
703
  * followed by the packed representation of the corresponding value and derivatives.
@@ -44,7 +44,7 @@ Object.defineProperties(ContextLimits, {
44
44
  },
45
45
 
46
46
  /**
47
- * The approximate maximum cube mape width and height supported by this WebGL implementation.
47
+ * The approximate maximum cube map width and height supported by this WebGL implementation.
48
48
  * The minimum is 16, but most desktop and laptop implementations will support much larger sizes like 8,192.
49
49
  * @memberof ContextLimits
50
50
  * @type {number}
@@ -27,6 +27,7 @@ import TextureMinificationFilter from "./TextureMinificationFilter.js";
27
27
  * @property {number} [width] The pixel width of the texture. If not supplied, must be available from the source.
28
28
  * @property {number} [height] The pixel height of the texture. If not supplied, must be available from the source.
29
29
  * @property {boolean} [preMultiplyAlpha] If true, the alpha channel will be multiplied into the other channels.
30
+ * @property {string} [id] A unique identifier for the texture. If this is not given, then a GUID will be created.
30
31
  *
31
32
  * @private
32
33
  */
@@ -216,7 +217,7 @@ function Texture(options) {
216
217
  ? PixelFormat.compressedTextureSizeInBytes(pixelFormat, width, height)
217
218
  : PixelFormat.textureSizeInBytes(pixelFormat, pixelDatatype, width, height);
218
219
 
219
- this._id = createGuid();
220
+ this._id = options.id ?? createGuid();
220
221
  this._context = context;
221
222
  this._textureFilterAnisotropic = context._textureFilterAnisotropic;
222
223
  this._textureTarget = gl.TEXTURE_2D;
@@ -343,7 +344,7 @@ function loadBufferSource(texture, source) {
343
344
  gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
344
345
  gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
345
346
 
346
- let arrayBufferView = source.arrayBufferView;
347
+ let { arrayBufferView } = source;
347
348
  if (flipY) {
348
349
  arrayBufferView = PixelFormat.flipY(
349
350
  arrayBufferView,
@@ -386,6 +387,62 @@ function loadBufferSource(texture, source) {
386
387
  }
387
388
  }
388
389
 
390
+ /**
391
+ * Load texel data from a buffer into part of a texture
392
+ *
393
+ * @param {Texture} texture The texture to which texel values will be loaded.
394
+ * @param {TypedArray} arrayBufferView The texel values to be loaded into the texture.
395
+ * @param {number} xOffset The texel x coordinate of the lower left corner of the subregion of the texture to be updated.
396
+ * @param {number} yOffset The texel y coordinate of the lower left corner of the subregion of the texture to be updated.
397
+ * @param {number} width The width of the source data, in pixels.
398
+ * @param {number} width The height of the source data, in pixels.
399
+ *
400
+ * @private
401
+ */
402
+ function loadPartialBufferSource(
403
+ texture,
404
+ arrayBufferView,
405
+ xOffset,
406
+ yOffset,
407
+ width,
408
+ height,
409
+ ) {
410
+ const context = texture._context;
411
+ const gl = context._gl;
412
+
413
+ const { pixelFormat, pixelDatatype } = texture;
414
+
415
+ const unpackAlignment = PixelFormat.alignmentInBytes(
416
+ pixelFormat,
417
+ pixelDatatype,
418
+ width,
419
+ );
420
+ gl.pixelStorei(gl.UNPACK_ALIGNMENT, unpackAlignment);
421
+ gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
422
+ gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
423
+
424
+ if (texture.flipY) {
425
+ arrayBufferView = PixelFormat.flipY(
426
+ arrayBufferView,
427
+ pixelFormat,
428
+ pixelDatatype,
429
+ width,
430
+ height,
431
+ );
432
+ }
433
+ gl.texSubImage2D(
434
+ texture._textureTarget,
435
+ 0,
436
+ xOffset,
437
+ yOffset,
438
+ width,
439
+ height,
440
+ pixelFormat,
441
+ PixelDatatype.toWebGLConstant(pixelDatatype, context),
442
+ arrayBufferView,
443
+ );
444
+ }
445
+
389
446
  /**
390
447
  * Load texel data from a framebuffer into a texture.
391
448
  *
@@ -448,6 +505,35 @@ function loadImageSource(texture, source) {
448
505
  );
449
506
  }
450
507
 
508
+ /**
509
+ * Load texel data from an Image into part of a texture
510
+ *
511
+ * @param {Texture} texture The texture to which texel values will be loaded.
512
+ * @param {ImageData|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} source The source for texel values to be loaded into the texture.
513
+ * @param {number} xOffset The texel x coordinate of the lower left corner of the subregion of the texture to be updated.
514
+ * @param {number} yOffset The texel y coordinate of the lower left corner of the subregion of the texture to be updated.
515
+ *
516
+ * @private
517
+ */
518
+ function loadPartialImageSource(texture, source, xOffset, yOffset) {
519
+ const context = texture._context;
520
+ const gl = context._gl;
521
+
522
+ gl.pixelStorei(gl.UNPACK_ALIGNMENT, 4);
523
+ gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.preMultiplyAlpha);
524
+ gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);
525
+
526
+ gl.texSubImage2D(
527
+ texture._textureTarget,
528
+ 0,
529
+ xOffset,
530
+ yOffset,
531
+ texture.pixelFormat,
532
+ PixelDatatype.toWebGLConstant(texture.pixelDatatype, context),
533
+ source,
534
+ );
535
+ }
536
+
451
537
  /**
452
538
  * Compute a dimension of the image for the next mip level.
453
539
  *
@@ -812,7 +898,6 @@ Texture.prototype.copyFrom = function (options) {
812
898
  gl.bindTexture(target, this._texture);
813
899
 
814
900
  let { width, height } = source;
815
- const arrayBufferView = source.arrayBufferView;
816
901
 
817
902
  // Make sure we are using the element's intrinsic width and height where available
818
903
  if (defined(source.videoWidth) && defined(source.videoHeight)) {
@@ -823,25 +908,6 @@ Texture.prototype.copyFrom = function (options) {
823
908
  height = source.naturalHeight;
824
909
  }
825
910
 
826
- const textureWidth = this._width;
827
- const textureHeight = this._height;
828
- const internalFormat = this._internalFormat;
829
- const pixelFormat = this._pixelFormat;
830
- const pixelDatatype = this._pixelDatatype;
831
-
832
- const preMultiplyAlpha = this._preMultiplyAlpha;
833
- const flipY = this._flipY;
834
-
835
- let unpackAlignment = 4;
836
- if (defined(arrayBufferView)) {
837
- unpackAlignment = PixelFormat.alignmentInBytes(
838
- pixelFormat,
839
- pixelDatatype,
840
- width,
841
- );
842
- }
843
- gl.pixelStorei(gl.UNPACK_ALIGNMENT, unpackAlignment);
844
-
845
911
  if (skipColorSpaceConversion) {
846
912
  gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.NONE);
847
913
  } else {
@@ -853,94 +919,40 @@ Texture.prototype.copyFrom = function (options) {
853
919
 
854
920
  let uploaded = false;
855
921
  if (!this._initialized) {
856
- let pixels;
857
922
  if (
858
923
  xOffset === 0 &&
859
924
  yOffset === 0 &&
860
- width === textureWidth &&
861
- height === textureHeight
925
+ width === this._width &&
926
+ height === this._height
862
927
  ) {
863
928
  // initialize the entire texture
864
- if (defined(arrayBufferView)) {
865
- gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
866
- gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
867
- if (flipY) {
868
- pixels = PixelFormat.flipY(
869
- arrayBufferView,
870
- pixelFormat,
871
- pixelDatatype,
872
- textureWidth,
873
- textureHeight,
874
- );
875
- } else {
876
- pixels = arrayBufferView;
877
- }
929
+ if (defined(source.arrayBufferView)) {
930
+ loadBufferSource(this, source);
878
931
  } else {
879
- // Only valid for DOM-Element uploads
880
- gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, preMultiplyAlpha);
881
- gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipY);
882
- pixels = source;
932
+ loadImageSource(this, source);
883
933
  }
884
934
  uploaded = true;
885
935
  } else {
886
936
  gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
887
937
  gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
888
- // initialize the entire texture to zero
889
- pixels = PixelFormat.createTypedArray(
890
- pixelFormat,
891
- pixelDatatype,
892
- textureWidth,
893
- textureHeight,
894
- );
938
+ loadNull(this);
895
939
  }
896
- gl.texImage2D(
897
- target,
898
- 0,
899
- internalFormat,
900
- textureWidth,
901
- textureHeight,
902
- 0,
903
- pixelFormat,
904
- PixelDatatype.toWebGLConstant(pixelDatatype, context),
905
- pixels,
906
- );
907
940
  this._initialized = true;
908
941
  }
909
942
 
910
943
  if (!uploaded) {
911
- let pixels;
912
- if (defined(arrayBufferView)) {
913
- gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
914
- gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
915
-
916
- if (flipY) {
917
- pixels = PixelFormat.flipY(
918
- arrayBufferView,
919
- pixelFormat,
920
- pixelDatatype,
921
- width,
922
- height,
923
- );
924
- } else {
925
- pixels = arrayBufferView;
926
- }
944
+ if (defined(source.arrayBufferView)) {
945
+ loadPartialBufferSource(
946
+ this,
947
+ source.arrayBufferView,
948
+ xOffset,
949
+ yOffset,
950
+ width,
951
+ height,
952
+ );
927
953
  } else {
928
- // Only valid for DOM-Element uploads
929
- gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, preMultiplyAlpha);
930
- gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipY);
931
- pixels = source;
954
+ loadPartialImageSource(this, source, xOffset, yOffset);
932
955
  }
933
- gl.texSubImage2D(
934
- target,
935
- 0,
936
- xOffset,
937
- yOffset,
938
- width,
939
- height,
940
- pixelFormat,
941
- PixelDatatype.toWebGLConstant(pixelDatatype, context),
942
- pixels,
943
- );
944
956
  }
945
957
 
946
958
  gl.bindTexture(target, null);
@@ -4,7 +4,7 @@ import Resource from "../Core/Resource.js";
4
4
 
5
5
  let defaultTokenCredit;
6
6
  const defaultAccessToken =
7
- "AAPTxy8BH1VEsoebNVZXo8HurEOF051kAEKlhkOhBEc9BmQpcUfxe1Yndhf82d5oKkQJ4_7VPaBQGYSISOMaRew7Sy-eTX1JQ4XwaC8v5aCvV72O6LCPs5Ss1pXXH-0uEw6bSRhTeQYHOmikutC2OMyZt6lu0VfT7FA-jVMO_UsunWNTf2cycP2O4IeDN_UV9G-VNmUu2jRvCHioi8o72ua4238s2219cYLEmcoGRJGVJTA.AT1_PjLvyih0";
7
+ "AAPTxy8BH1VEsoebNVZXo8HurEOF051kAEKlhkOhBEc9BmSFctdVnwhKUPPSRxMpNygUNlP8JmGGUdPJSkOUNGzOjDGJ6_IBw0ZIYb2CxiR6SbKR4hMj3np1HXa_Idxv_txLhu62WcUsFQSTBvq7ktym5DNKxqVmIzBnPljNsM8ff9hCKEXq0LTd8VzkHqjVA7-ig_wg7BqJGg7vUMgG1QseyUAjpmY2OaEv9rA8aeBjRrc.AT1_8nZ92i8c";
8
8
  /**
9
9
  * Default options for accessing the ArcGIS image tile service.
10
10
  *
@@ -105,7 +105,7 @@ import DynamicEnvironmentMapManager from "./DynamicEnvironmentMapManager.js";
105
105
  * @property {object} [pointCloudShading] Options for constructing a {@link PointCloudShading} object to control point attenuation based on geometric error and lighting.
106
106
  * @property {Cartesian3} [lightColor] The light color when shading models. When <code>undefined</code> the scene's light color is used instead.
107
107
  * @property {ImageBasedLighting} [imageBasedLighting] The properties for managing image-based lighting for this tileset.
108
- * @param {DynamicEnvironmentMapManager.ConstructorOptions} [options.environmentMapOptions] The properties for managing dynamic environment maps on this model.
108
+ * @property {DynamicEnvironmentMapManager.ConstructorOptions} [environmentMapOptions] The properties for managing dynamic environment maps on this tileset.
109
109
  * @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.
110
110
  * @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.
111
111
  * @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.