@cesium/engine 23.0.1 → 24.0.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 (226) hide show
  1. package/Build/Workers/{chunk-G6MJ3ZW3.js → chunk-2N4KDHS3.js} +10 -10
  2. package/Build/Workers/{chunk-C6HHBKT5.js → chunk-44EMEGKW.js} +5 -5
  3. package/Build/Workers/{chunk-TNXOPEIG.js → chunk-4TIG36AW.js} +12 -12
  4. package/Build/Workers/{chunk-PQTSXJBJ.js → chunk-5A2SW66E.js} +16 -16
  5. package/Build/Workers/{chunk-TXYQNXNW.js → chunk-5GXYJQ2K.js} +3 -3
  6. package/Build/Workers/{chunk-O67UP5YO.js → chunk-63SIWPLS.js} +13 -13
  7. package/Build/Workers/{chunk-CVAAIRNP.js → chunk-6MPGQEHA.js} +2 -2
  8. package/Build/Workers/{chunk-LHFC4R7Z.js → chunk-6RMS4S72.js} +6 -6
  9. package/Build/Workers/{chunk-77DJBHMI.js → chunk-6WLHJFD3.js} +7 -7
  10. package/Build/Workers/{chunk-HXEPZWJN.js → chunk-72VYSVEW.js} +9 -9
  11. package/Build/Workers/{chunk-VPWYHFQA.js → chunk-7MDYBRYJ.js} +4 -4
  12. package/Build/Workers/{chunk-XPMXRJDD.js → chunk-7O5XJTVE.js} +5 -5
  13. package/Build/Workers/{chunk-UEWYSOFD.js → chunk-7QRFIKWQ.js} +2 -2
  14. package/Build/Workers/{chunk-3UQ2YMPP.js → chunk-7TYLCBGK.js} +8 -8
  15. package/Build/Workers/{chunk-GLCPE2BJ.js → chunk-7X322WP2.js} +13 -13
  16. package/Build/Workers/{chunk-2OBWHTIC.js → chunk-A47HVBC5.js} +7 -7
  17. package/Build/Workers/{chunk-CID5SY7L.js → chunk-AF3MU2RL.js} +5 -5
  18. package/Build/Workers/{chunk-BTP3634E.js → chunk-AJLTU6PF.js} +1 -1
  19. package/Build/Workers/{chunk-YSJRB2UZ.js → chunk-AMIHNSST.js} +2 -2
  20. package/Build/Workers/{chunk-QPXGGVHC.js → chunk-B6SCUUFP.js} +10 -10
  21. package/Build/Workers/{chunk-QNABVTTP.js → chunk-BJD6QGXZ.js} +12 -12
  22. package/Build/Workers/{chunk-RZX6LOG6.js → chunk-C6P4IG5P.js} +6 -6
  23. package/Build/Workers/{chunk-4JJQRZYL.js → chunk-D4EJ2NXG.js} +17 -17
  24. package/Build/Workers/{chunk-K7UTK4OM.js → chunk-DHKPFLSJ.js} +1 -1
  25. package/Build/Workers/{chunk-S53HSRT6.js → chunk-DVB56LG7.js} +6 -6
  26. package/Build/Workers/{chunk-PBECJOWF.js → chunk-EDXL4W76.js} +2 -2
  27. package/Build/Workers/{chunk-ALTCIHRH.js → chunk-EV3VGO6Y.js} +17 -17
  28. package/Build/Workers/{chunk-UOQB7XQI.js → chunk-GOQBUCXH.js} +10 -10
  29. package/Build/Workers/{chunk-TMCTZ5E3.js → chunk-GQUNK2XC.js} +14 -14
  30. package/Build/Workers/{chunk-PAFMAR7A.js → chunk-HKUES6UG.js} +12 -12
  31. package/Build/Workers/{chunk-6U5QMZU3.js → chunk-HRHRYFHS.js} +9 -9
  32. package/Build/Workers/{chunk-PUO7BYDY.js → chunk-HXJMS2ZI.js} +1 -1
  33. package/Build/Workers/{chunk-FXSRA5UG.js → chunk-ILMFADZA.js} +4 -4
  34. package/Build/Workers/{chunk-U4SWB6TI.js → chunk-ISY4EZCA.js} +4 -4
  35. package/Build/Workers/{chunk-PGZ3B6CB.js → chunk-J6AW5YHS.js} +14 -14
  36. package/Build/Workers/{chunk-VX774SWE.js → chunk-JCI63T3K.js} +6 -6
  37. package/Build/Workers/{chunk-54O3AGOA.js → chunk-KLPGTXS3.js} +6 -6
  38. package/Build/Workers/{chunk-CNLXMOPM.js → chunk-LIB2H534.js} +10 -10
  39. package/Build/Workers/{chunk-H3TVRJLY.js → chunk-LXMCPFFS.js} +4 -4
  40. package/Build/Workers/{chunk-DNMASBMH.js → chunk-MKM27KGV.js} +2 -2
  41. package/Build/Workers/{chunk-66OWUDO7.js → chunk-N65BAKSH.js} +8 -8
  42. package/Build/Workers/{chunk-ZEMJQKHD.js → chunk-NKT5K3K3.js} +11 -11
  43. package/Build/Workers/{chunk-EIC3VAOZ.js → chunk-NPF7SSHZ.js} +7 -7
  44. package/Build/Workers/{chunk-YDR5LX5Z.js → chunk-PVV64VFW.js} +1 -1
  45. package/Build/Workers/{chunk-FKU77FNM.js → chunk-Q3C6VQH6.js} +4 -4
  46. package/Build/Workers/{chunk-CYOPNGPX.js → chunk-RQNJD3O4.js} +12 -12
  47. package/Build/Workers/{chunk-IJ3SUMK3.js → chunk-UIGVOKKI.js} +1 -1
  48. package/Build/Workers/{chunk-TFPG3ZKW.js → chunk-UQU4RXLT.js} +27 -19
  49. package/Build/Workers/{chunk-N6HRZLS6.js → chunk-VLDEUTOP.js} +2 -2
  50. package/Build/Workers/{chunk-MNSNOONX.js → chunk-VMVOUQ5J.js} +7 -7
  51. package/Build/Workers/{chunk-OZYB3AOR.js → chunk-XJRBB253.js} +11 -11
  52. package/Build/Workers/{chunk-B2VA6IEL.js → chunk-XY6HMDGI.js} +5 -5
  53. package/Build/Workers/{chunk-2M7DKGLW.js → chunk-Y7HNNPNK.js} +10 -10
  54. package/Build/Workers/{chunk-CJ7ZDY77.js → chunk-YAOZMOFL.js} +5 -5
  55. package/Build/Workers/{chunk-FCJQO4NC.js → chunk-YJZGW74L.js} +8 -8
  56. package/Build/Workers/{chunk-JUKGMJX7.js → chunk-YQFTYQMZ.js} +1 -1
  57. package/Build/Workers/{chunk-HNDE73JK.js → chunk-ZBZRTRJB.js} +10 -10
  58. package/Build/Workers/combineGeometry.js +24 -24
  59. package/Build/Workers/createBoxGeometry.js +18 -18
  60. package/Build/Workers/createBoxOutlineGeometry.js +16 -16
  61. package/Build/Workers/createCircleGeometry.js +26 -26
  62. package/Build/Workers/createCircleOutlineGeometry.js +19 -19
  63. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
  64. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
  65. package/Build/Workers/createCorridorGeometry.js +29 -29
  66. package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
  67. package/Build/Workers/createCylinderGeometry.js +20 -20
  68. package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
  69. package/Build/Workers/createEllipseGeometry.js +26 -26
  70. package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
  71. package/Build/Workers/createEllipsoidGeometry.js +19 -19
  72. package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
  73. package/Build/Workers/createFrustumGeometry.js +18 -18
  74. package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
  75. package/Build/Workers/createGeometry.js +24 -24
  76. package/Build/Workers/createGroundPolylineGeometry.js +22 -22
  77. package/Build/Workers/createPlaneGeometry.js +16 -16
  78. package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
  79. package/Build/Workers/createPolygonGeometry.js +32 -32
  80. package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
  81. package/Build/Workers/createPolylineGeometry.js +25 -25
  82. package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
  83. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
  84. package/Build/Workers/createRectangleGeometry.js +27 -27
  85. package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
  86. package/Build/Workers/createSimplePolylineGeometry.js +23 -23
  87. package/Build/Workers/createSphereGeometry.js +19 -19
  88. package/Build/Workers/createSphereOutlineGeometry.js +18 -18
  89. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  90. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  91. package/Build/Workers/createVectorTileGeometries.js +24 -24
  92. package/Build/Workers/createVectorTilePoints.js +13 -13
  93. package/Build/Workers/createVectorTilePolygons.js +22 -22
  94. package/Build/Workers/createVectorTilePolylines.js +14 -14
  95. package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
  96. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
  97. package/Build/Workers/createVerticesFromHeightmap.js +22 -22
  98. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
  99. package/Build/Workers/createWallGeometry.js +25 -25
  100. package/Build/Workers/createWallOutlineGeometry.js +24 -24
  101. package/Build/Workers/decodeDraco.js +10 -10
  102. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  103. package/Build/Workers/decodeI3S.js +12 -12
  104. package/Build/Workers/gaussianSplatSorter.js +4 -4
  105. package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
  106. package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
  107. package/Build/Workers/transcodeKTX2.js +6 -6
  108. package/Build/Workers/transferTypedArrayTest.js +1 -1
  109. package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
  110. package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
  111. package/Source/Core/BoundingSphere.js +1 -1
  112. package/Source/Core/Cartesian2.js +7 -5
  113. package/Source/Core/Cartesian3.js +8 -6
  114. package/Source/Core/Cartesian4.js +8 -6
  115. package/Source/Core/Color.js +5 -3
  116. package/Source/Core/DeveloperError.js +2 -1
  117. package/Source/Core/ITwinPlatform.js +1 -0
  118. package/Source/Core/Ion.js +1 -1
  119. package/Source/Core/S2Cell.js +2 -2
  120. package/Source/Core/TerrainMesh.js +10 -1
  121. package/Source/Core/TerrainPicker.js +1 -0
  122. package/Source/Core/WallGeometry.js +1 -1
  123. package/Source/Core/WallOutlineGeometry.js +1 -1
  124. package/Source/Core/assert.js +27 -0
  125. package/Source/Core/globalTypes.js +4 -0
  126. package/Source/DataSources/CzmlDataSource.js +9 -0
  127. package/Source/DataSources/PathGraphics.js +13 -0
  128. package/Source/DataSources/PathVisualizer.js +330 -18
  129. package/Source/DataSources/StaticGeometryColorBatch.js +7 -2
  130. package/Source/DataSources/StaticGeometryPerMaterialBatch.js +7 -2
  131. package/Source/DataSources/StaticGroundGeometryPerMaterialBatch.js +3 -1
  132. package/Source/DataSources/StaticGroundPolylinePerMaterialBatch.js +3 -1
  133. package/Source/Renderer/Context.js +1 -1
  134. package/Source/Renderer/RenderState.js +2 -2
  135. package/Source/Renderer/VertexArray.js +80 -0
  136. package/Source/Scene/ArcGisMapService.js +1 -1
  137. package/Source/Scene/BillboardCollection.js +65 -364
  138. package/Source/Scene/BufferPoint.js +148 -0
  139. package/Source/Scene/BufferPointCollection.js +135 -0
  140. package/Source/Scene/BufferPointMaterial.js +95 -0
  141. package/Source/Scene/BufferPolygon.js +516 -0
  142. package/Source/Scene/BufferPolygonCollection.js +368 -0
  143. package/Source/Scene/BufferPolygonMaterial.js +41 -0
  144. package/Source/Scene/BufferPolyline.js +185 -0
  145. package/Source/Scene/BufferPolylineCollection.js +136 -0
  146. package/Source/Scene/BufferPolylineMaterial.js +93 -0
  147. package/Source/Scene/BufferPrimitive.js +347 -0
  148. package/Source/Scene/BufferPrimitiveCollection.js +702 -0
  149. package/Source/Scene/BufferPrimitiveMaterial.js +140 -0
  150. package/Source/Scene/Cesium3DTileContent.js +5 -1
  151. package/Source/Scene/Cesium3DTileContentFactory.js +9 -0
  152. package/Source/Scene/Cesium3DTileStyle.js +22 -0
  153. package/Source/Scene/Cesium3DTileset.js +1 -0
  154. package/Source/Scene/ClippingPolygonCollection.js +270 -101
  155. package/Source/Scene/CubeMapPanorama.js +4 -4
  156. package/Source/Scene/GaussianSplat3DTileContent.js +40 -46
  157. package/Source/Scene/GaussianSplatPrimitive.js +413 -70
  158. package/Source/Scene/GetFeatureInfoFormat.js +3 -3
  159. package/Source/Scene/GltfLoader.js +215 -34
  160. package/Source/Scene/GltfSpzLoader.js +109 -0
  161. package/Source/Scene/ITwinData.js +1 -0
  162. package/Source/Scene/Label.js +32 -0
  163. package/Source/Scene/LabelCollection.js +14 -13
  164. package/Source/Scene/Material.js +2 -0
  165. package/Source/Scene/Megatexture.js +1 -0
  166. package/Source/Scene/MetadataClassProperty.js +24 -10
  167. package/Source/Scene/MetadataComponentType.js +115 -23
  168. package/Source/Scene/Model/CustomShaderPipelineStage.js +3 -1
  169. package/Source/Scene/Model/EdgeVisibilityPipelineStage.js +761 -263
  170. package/Source/Scene/Model/MaterialPipelineStage.js +147 -0
  171. package/Source/Scene/Model/MetadataPipelineStage.js +3 -3
  172. package/Source/Scene/Model/ModelDrawCommand.js +6 -0
  173. package/Source/Scene/Model/ModelReader.js +1 -1
  174. package/Source/Scene/Model/ModelUtility.js +3 -1
  175. package/Source/Scene/Model/createVectorTileBuffersFromModelComponents.js +330 -0
  176. package/Source/Scene/ModelComponents.js +1632 -1542
  177. package/Source/Scene/PickedMetadataInfo.js +1 -0
  178. package/Source/Scene/ScreenSpaceCameraController.js +13 -0
  179. package/Source/Scene/SkyBox.js +17 -8
  180. package/Source/Scene/TileBoundingRegion.js +1 -1
  181. package/Source/Scene/TileBoundingS2Cell.js +1 -1
  182. package/Source/Scene/TileBoundingSphere.js +1 -1
  183. package/Source/Scene/TweenCollection.js +7 -0
  184. package/Source/Scene/VectorGltf3DTileContent.js +382 -0
  185. package/Source/Scene/VertexAttributeSemantic.js +14 -0
  186. package/Source/Scene/WebMapServiceImageryProvider.js +2 -2
  187. package/Source/Scene/WebMapTileServiceImageryProvider.js +366 -131
  188. package/Source/Scene/parseStructuralMetadata.js +97 -37
  189. package/Source/Scene/renderBufferPointCollection.js +334 -0
  190. package/Source/Scene/renderBufferPolygonCollection.js +386 -0
  191. package/Source/Scene/renderBufferPolylineCollection.js +529 -0
  192. package/Source/Shaders/BillboardCollectionFS.glsl +2 -77
  193. package/Source/Shaders/BillboardCollectionFS.js +2 -77
  194. package/Source/Shaders/BillboardCollectionVS.glsl +2 -60
  195. package/Source/Shaders/BillboardCollectionVS.js +2 -60
  196. package/Source/Shaders/BufferPointMaterialFS.glsl +27 -0
  197. package/Source/Shaders/BufferPointMaterialFS.js +29 -0
  198. package/Source/Shaders/BufferPointMaterialVS.glsl +48 -0
  199. package/Source/Shaders/BufferPointMaterialVS.js +50 -0
  200. package/Source/Shaders/BufferPolygonMaterialFS.glsl +13 -0
  201. package/Source/Shaders/BufferPolygonMaterialFS.js +15 -0
  202. package/Source/Shaders/BufferPolygonMaterialVS.glsl +30 -0
  203. package/Source/Shaders/BufferPolygonMaterialVS.js +32 -0
  204. package/Source/Shaders/BufferPolylineMaterialFS.glsl +13 -0
  205. package/Source/Shaders/BufferPolylineMaterialFS.js +15 -0
  206. package/Source/Shaders/BufferPolylineMaterialVS.glsl +49 -0
  207. package/Source/Shaders/BufferPolylineMaterialVS.js +51 -0
  208. package/Source/Shaders/Model/EdgeVisibilityStageFS.glsl +34 -48
  209. package/Source/Shaders/Model/EdgeVisibilityStageFS.js +34 -49
  210. package/Source/Shaders/Model/EdgeVisibilityStageVS.glsl +98 -0
  211. package/Source/Shaders/Model/EdgeVisibilityStageVS.js +100 -0
  212. package/Source/Shaders/Model/ModelFS.glsl +15 -0
  213. package/Source/Shaders/Model/ModelFS.js +15 -0
  214. package/Source/Shaders/Model/ModelVS.glsl +8 -0
  215. package/Source/Shaders/Model/ModelVS.js +8 -0
  216. package/Source/Shaders/PolygonSignedDistanceFS.glsl +64 -33
  217. package/Source/Shaders/PolygonSignedDistanceFS.js +64 -33
  218. package/Source/Shaders/PrimitiveGaussianSplatVS.glsl +9 -2
  219. package/Source/Shaders/PrimitiveGaussianSplatVS.js +9 -2
  220. package/Source/Shaders/Voxels/VoxelFS.glsl +1 -1
  221. package/Source/Shaders/Voxels/VoxelFS.js +1 -1
  222. package/Source/Workers/decodeDraco.js +3 -0
  223. package/Source/Workers/decodeI3S.js +5 -2
  224. package/index.d.ts +1007 -111
  225. package/index.js +394 -369
  226. package/package.json +2 -2
@@ -8,6 +8,7 @@
8
8
  * proper metadata values in `Picking.pickMetadata`, using the structural
9
9
  * information about the metadata that is stored here.
10
10
  *
11
+ * @constructor
11
12
  * @private
12
13
  */
13
14
  function PickedMetadataInfo(
@@ -2360,6 +2360,19 @@ function zoom3D(controller, startPosition, movement) {
2360
2360
  let distance;
2361
2361
  if (defined(intersection)) {
2362
2362
  distance = Cartesian3.distance(ray.origin, intersection);
2363
+ }
2364
+
2365
+ // In tracking/lookAt mode (_globe is undefined), pickPosition can hit terrain
2366
+ // behind the intended target. Ignore farther picks to prevent zoom snap.
2367
+ if (!defined(controller._globe) && defined(distance)) {
2368
+ const targetDistance = camera.getMagnitude();
2369
+ if (targetDistance < distance) {
2370
+ intersection = undefined;
2371
+ distance = undefined;
2372
+ }
2373
+ }
2374
+
2375
+ if (defined(distance)) {
2363
2376
  preIntersectionDistance = distance;
2364
2377
  }
2365
2378
 
@@ -35,14 +35,7 @@ import destroyObject from "../Core/destroyObject.js";
35
35
  */
36
36
  function SkyBox(options) {
37
37
  this._sources = options.sources;
38
-
39
- /**
40
- * Determines if the sky box will be shown.
41
- *
42
- * @type {boolean}
43
- * @default true
44
- */
45
- this.show = options.show ?? true;
38
+ this._show = options.show ?? true;
46
39
  this._panorama = new CubeMapPanorama({
47
40
  sources: this._sources,
48
41
  show: this._show,
@@ -64,6 +57,22 @@ Object.defineProperties(SkyBox.prototype, {
64
57
  this._panorama.sources = value;
65
58
  },
66
59
  },
60
+
61
+ /**
62
+ * Determines if the sky box will be shown.
63
+ *
64
+ * @type {boolean}
65
+ * @default true
66
+ */
67
+
68
+ show: {
69
+ get: function () {
70
+ return this._panorama.show;
71
+ },
72
+ set: function (value) {
73
+ this._panorama.show = value;
74
+ },
75
+ },
67
76
  });
68
77
 
69
78
  /**
@@ -462,7 +462,7 @@ TileBoundingRegion.prototype.createDebugVolume = function (color) {
462
462
  Check.defined("color", color);
463
463
  //>>includeEnd('debug');
464
464
 
465
- const modelMatrix = new Matrix4.clone(Matrix4.IDENTITY);
465
+ const modelMatrix = Matrix4.clone(Matrix4.IDENTITY);
466
466
  const geometry = new RectangleOutlineGeometry({
467
467
  rectangle: this.rectangle,
468
468
  height: this.minimumHeight,
@@ -627,7 +627,7 @@ TileBoundingS2Cell.prototype.createDebugVolume = function (color) {
627
627
  Check.defined("color", color);
628
628
  //>>includeEnd('debug');
629
629
 
630
- const modelMatrix = new Matrix4.clone(Matrix4.IDENTITY);
630
+ const modelMatrix = Matrix4.clone(Matrix4.IDENTITY);
631
631
  const topPlanePolygon = new CoplanarPolygonOutlineGeometry({
632
632
  polygonHierarchy: {
633
633
  positions: this._planeVertices[0],
@@ -144,7 +144,7 @@ TileBoundingSphere.prototype.createDebugVolume = function (color) {
144
144
  });
145
145
  const modelMatrix = Matrix4.fromTranslation(
146
146
  this.center,
147
- new Matrix4.clone(Matrix4.IDENTITY),
147
+ Matrix4.clone(Matrix4.IDENTITY),
148
148
  );
149
149
  const instance = new GeometryInstance({
150
150
  geometry: geometry,
@@ -562,6 +562,13 @@ TweenCollection.prototype.update = function (time) {
562
562
  } else if (tweenjs.update(time)) {
563
563
  i++;
564
564
  } else {
565
+ // there's a chance that the update callback has side effects that clear the list of tweens and/or adds new tweens
566
+ // if it's the case that the update callback 1) clears all tweens held in the scene, then 2) adds new tweens
567
+ // the splice operation below will not be operating on the original tween, but one of the unprocessed tweens added
568
+ // from the update callback
569
+ if (tweens[i]?.needsStart) {
570
+ continue;
571
+ }
565
572
  tweenjs.stop();
566
573
  tweens.splice(i, 1);
567
574
  }
@@ -0,0 +1,382 @@
1
+ // @ts-check
2
+
3
+ import BufferPoint from "./BufferPoint.js";
4
+ import BufferPointCollection from "./BufferPointCollection.js";
5
+ import BufferPointMaterial from "./BufferPointMaterial.js";
6
+ import BufferPolygon from "./BufferPolygon.js";
7
+ import BufferPolygonCollection from "./BufferPolygonCollection.js";
8
+ import BufferPolygonMaterial from "./BufferPolygonMaterial.js";
9
+ import BufferPolyline from "./BufferPolyline.js";
10
+ import BufferPolylineCollection from "./BufferPolylineCollection.js";
11
+ import BufferPolylineMaterial from "./BufferPolylineMaterial.js";
12
+ import Cesium3DTileStyle from "./Cesium3DTileStyle.js";
13
+ import Color from "../Core/Color.js";
14
+ import Matrix4 from "../Core/Matrix4.js";
15
+ import Model from "./Model/Model.js";
16
+ import ModelUtility from "./Model/ModelUtility.js";
17
+ import Pass from "../Renderer/Pass.js";
18
+ import createVectorTileBuffersFromModelComponents from "./Model/createVectorTileBuffersFromModelComponents.js";
19
+ import defined from "../Core/defined.js";
20
+ import destroyObject from "../Core/destroyObject.js";
21
+
22
+ /** @import BufferPrimitive from "./BufferPrimitive.js"; */
23
+ /** @import BufferPrimitiveCollection from "./BufferPrimitiveCollection.js"; */
24
+ /** @import Cartesian3 from "../Core/Cartesian3.js"; */
25
+ /** @import Cesium3DContentGroup from "./Cesium3DContentGroup.js"; */
26
+ /** @import Cesium3DTile from "./Cesium3DTile.js"; */
27
+ /** @import Cesium3DTileBatchTable from "./Cesium3DTileBatchTable.js"; */
28
+ /** @import Cesium3DTileFeature from "./Cesium3DTileFeature.js"; */
29
+ /** @import Cesium3DTileset from "./Cesium3DTileset.js"; */
30
+ /** @import FrameState from "./FrameState.js"; */
31
+ /** @import ImplicitMetadataView from "./ImplicitMetadataView.js"; */
32
+ /** @import Ray from "../Core/Ray.js"; */
33
+ /** @import Resource from "../Core/Resource.js"; */
34
+
35
+ /** @ignore */
36
+ const point = new BufferPoint();
37
+ /** @ignore */
38
+ const polyline = new BufferPolyline();
39
+ /** @ignore */
40
+ const polygon = new BufferPolygon();
41
+
42
+ /** @ignore */
43
+ const pointMaterial = new BufferPointMaterial();
44
+ /** @ignore */
45
+ const polylineMaterial = new BufferPolylineMaterial();
46
+ /** @ignore */
47
+ const polygonMaterial = new BufferPolygonMaterial();
48
+
49
+ /** @ignore */
50
+ const scratchTileModelMatrix = new Matrix4();
51
+
52
+ /**
53
+ * Vector glTF tile content. This path decodes glTF primitives into vector
54
+ * buffers, then renders with dedicated vector primitives.
55
+ *
56
+ * @ignore
57
+ */
58
+ class VectorGltf3DTileContent {
59
+ /**
60
+ * @param {Cesium3DTileset} tileset
61
+ * @param {Cesium3DTile} tile
62
+ * @param {Resource} resource
63
+ */
64
+ constructor(tileset, tile, resource) {
65
+ /** @type {Cesium3DTileset} */
66
+ this._tileset = tileset;
67
+ /** @type {Cesium3DTile} */
68
+ this._tile = tile;
69
+ /** @type {Resource} */
70
+ this._resource = resource;
71
+
72
+ /** @type {Model} */
73
+ this._decodeModel = undefined;
74
+
75
+ /** @type {Array<BufferPrimitiveCollection<BufferPrimitive>>} */
76
+ this._collections = [];
77
+
78
+ /** @type {Array<Matrix4>} */
79
+ this._collectionLocalMatrices = [];
80
+
81
+ /** @type {ImplicitMetadataView} */
82
+ this._metadata = undefined;
83
+ /** @type {Cesium3DContentGroup} */
84
+ this._group = undefined;
85
+
86
+ /** @type {boolean} */
87
+ this.featurePropertiesDirty = false;
88
+
89
+ /** @type {boolean} */
90
+ this._ready = false;
91
+
92
+ /** @type {Matrix4} */
93
+ this._modelMatrix = Matrix4.clone(Matrix4.IDENTITY);
94
+ }
95
+
96
+ get featuresLength() {
97
+ return this._collections.reduce((totalCount, collection) => {
98
+ return totalCount + collection.primitiveCount;
99
+ }, 0);
100
+ }
101
+
102
+ get pointsLength() {
103
+ return this._collections
104
+ .filter((collection) => collection instanceof BufferPointCollection)
105
+ .reduce((totalPoints, collection) => {
106
+ return totalPoints + collection.primitiveCount;
107
+ }, 0);
108
+ }
109
+
110
+ get trianglesLength() {
111
+ return this._collections
112
+ .filter((collection) => collection instanceof BufferPolygonCollection)
113
+ .reduce((totalPoints, collection) => {
114
+ return totalPoints + collection.triangleCount;
115
+ }, 0);
116
+ }
117
+
118
+ get geometryByteLength() {
119
+ return this._collections.reduce((totalByteLength, collection) => {
120
+ return totalByteLength + collection.byteLength;
121
+ }, 0);
122
+ }
123
+
124
+ get texturesByteLength() {
125
+ return 0;
126
+ }
127
+
128
+ get batchTableByteLength() {
129
+ return 0;
130
+ }
131
+
132
+ /** @returns {undefined} */
133
+ get innerContents() {
134
+ return undefined;
135
+ }
136
+
137
+ get ready() {
138
+ return this._ready;
139
+ }
140
+
141
+ get tileset() {
142
+ return this._tileset;
143
+ }
144
+
145
+ get tile() {
146
+ return this._tile;
147
+ }
148
+
149
+ get url() {
150
+ return this._resource.getUrlComponent(true);
151
+ }
152
+
153
+ /** @type {Cesium3DTileBatchTable} */
154
+ get batchTable() {
155
+ return undefined;
156
+ }
157
+
158
+ /** @type {ImplicitMetadataView} */
159
+ get metadata() {
160
+ return this._metadata;
161
+ }
162
+
163
+ set metadata(value) {
164
+ this._metadata = value;
165
+ }
166
+
167
+ /** @type {Cesium3DContentGroup} */
168
+ get group() {
169
+ return this._group;
170
+ }
171
+
172
+ set group(value) {
173
+ this._group = value;
174
+ }
175
+
176
+ /**
177
+ * @param {number} _featureId
178
+ * @returns {Cesium3DTileFeature}
179
+ */
180
+ getFeature(_featureId) {
181
+ return undefined;
182
+ }
183
+
184
+ /**
185
+ * @param {number} _featureId
186
+ * @param {string} _name
187
+ * @returns {boolean}
188
+ */
189
+ hasProperty(_featureId, _name) {
190
+ return false;
191
+ }
192
+
193
+ /**
194
+ * @param {boolean} enabled
195
+ * @param {Color} color
196
+ */
197
+ applyDebugSettings(enabled, color) {
198
+ color = enabled ? color : Color.WHITE;
199
+ this.applyStyle(new Cesium3DTileStyle({ color }));
200
+ }
201
+
202
+ /**
203
+ * @param {*} style
204
+ */
205
+ applyStyle(style) {
206
+ const show = style.show?.evaluate(null) ?? true;
207
+ const color = style.color?.evaluate(null, new Color());
208
+
209
+ const isPointCollection = /** @param {unknown} c */ (c) =>
210
+ c instanceof BufferPointCollection;
211
+ const isPolylineCollection = /** @param {unknown} c */ (c) =>
212
+ c instanceof BufferPolylineCollection;
213
+ const isPolygonCollection = /** @param {unknown} c */ (c) =>
214
+ c instanceof BufferPolygonCollection;
215
+
216
+ Color.clone(color, pointMaterial.color);
217
+ pointMaterial.size = style.pointSize?.evaluate(null);
218
+ pointMaterial.outlineWidth = style.pointOutlineWidth?.evaluate(null);
219
+ style.pointOutlineColor?.evaluate(null, pointMaterial.outlineColor);
220
+ for (const collection of this._collections.filter(isPointCollection)) {
221
+ for (let i = 0, il = collection.primitiveCount; i < il; i++) {
222
+ collection.get(i, point);
223
+ point.show = show;
224
+ point.setMaterial(pointMaterial);
225
+ }
226
+ }
227
+
228
+ Color.clone(color, polylineMaterial.color);
229
+ polylineMaterial.width = style.lineWidth?.evaluate(null) ?? 1;
230
+ for (const collection of this._collections.filter(isPolylineCollection)) {
231
+ for (let i = 0, il = collection.primitiveCount; i < il; i++) {
232
+ collection.get(i, polyline);
233
+ polyline.show = show;
234
+ polyline.setMaterial(polylineMaterial);
235
+ }
236
+ }
237
+
238
+ Color.clone(color, polygonMaterial.color);
239
+ for (const collection of this._collections.filter(isPolygonCollection)) {
240
+ for (let i = 0, il = collection.primitiveCount; i < il; i++) {
241
+ collection.get(i, polygon);
242
+ polygon.show = show;
243
+ polygon.setMaterial(polygonMaterial);
244
+ }
245
+ }
246
+ }
247
+
248
+ /**
249
+ * @param {Cesium3DTileset} _tileset
250
+ * @param {FrameState} frameState
251
+ */
252
+ update(_tileset, frameState) {
253
+ if (defined(this._decodeModel) && !this._ready) {
254
+ const model = this._decodeModel;
255
+ model.modelMatrix = this._tile.computedTransform;
256
+ model.update(frameState);
257
+
258
+ // @ts-expect-error Requires Model conversion to ES6 class.
259
+ if (model.ready) {
260
+ initializeVectorPrimitives(this);
261
+ if (this._decodeModel) {
262
+ this._decodeModel.destroy();
263
+ this._decodeModel = undefined;
264
+ }
265
+ this._ready = true;
266
+ }
267
+ }
268
+
269
+ Matrix4.multiplyTransformation(
270
+ this._tile.computedTransform,
271
+ this._modelMatrix,
272
+ scratchTileModelMatrix,
273
+ );
274
+
275
+ for (let i = 0; i < this._collections.length; i++) {
276
+ Matrix4.multiplyTransformation(
277
+ scratchTileModelMatrix,
278
+ this._collectionLocalMatrices[i],
279
+ this._collections[i].modelMatrix,
280
+ );
281
+ this._collections[i].update(frameState);
282
+ }
283
+ }
284
+
285
+ /**
286
+ * @param {Ray} _ray
287
+ * @param {FrameState} _frameState
288
+ * @param {Cartesian3|undefined} _result
289
+ * @returns {Cartesian3|undefined}
290
+ */
291
+ pick(_ray, _frameState, _result) {
292
+ return undefined;
293
+ }
294
+
295
+ isDestroyed() {
296
+ return false;
297
+ }
298
+
299
+ destroy() {
300
+ this._decodeModel?.destroy();
301
+ this._decodeModel = undefined;
302
+ this._collections.forEach((collection) => collection.destroy());
303
+ this._collections.length = 0;
304
+ return destroyObject(this);
305
+ }
306
+
307
+ /**
308
+ * @param {Cesium3DTileset} tileset
309
+ * @param {Cesium3DTile} tile
310
+ * @param {Resource} resource
311
+ * @param {unknown} gltf
312
+ * @returns {Promise<VectorGltf3DTileContent>}
313
+ */
314
+ static async fromGltf(tileset, tile, resource, gltf) {
315
+ const content = new VectorGltf3DTileContent(tileset, tile, resource);
316
+ const modelOptions = makeDecodeModelOptions(tileset, tile, content, gltf);
317
+ const decodeModel = await Model.fromGltfAsync(modelOptions);
318
+ // @ts-expect-error Requires Model conversion to ES6 class.
319
+ decodeModel.show = false;
320
+ content._decodeModel = decodeModel;
321
+ return content;
322
+ }
323
+ }
324
+
325
+ /**
326
+ * @param {Cesium3DTileset} tileset
327
+ * @param {Cesium3DTile} tile
328
+ * @param {VectorGltf3DTileContent} content
329
+ * @param {unknown} gltf
330
+ * @returns {*}
331
+ * @ignore
332
+ */
333
+ function makeDecodeModelOptions(tileset, tile, content, gltf) {
334
+ return {
335
+ gltf: gltf,
336
+ basePath: content._resource,
337
+ cull: false,
338
+ releaseGltfJson: true,
339
+ opaquePass: Pass.CESIUM_3D_TILE,
340
+ modelMatrix: tile.computedTransform,
341
+ upAxis: tileset._modelUpAxis,
342
+ forwardAxis: tileset._modelForwardAxis,
343
+ incrementallyLoadTextures: false,
344
+ content: content,
345
+ // @ts-expect-error Requires Cesium3DTileset conversion to ES6 class.
346
+ featureIdLabel: tileset.featureIdLabel,
347
+ // @ts-expect-error Requires Cesium3DTileset conversion to ES6 class.
348
+ instanceFeatureIdLabel: tileset.instanceFeatureIdLabel,
349
+ projectTo2D: tileset._projectTo2D,
350
+ enablePick: tileset._enablePick,
351
+ enableDebugWireframe: tileset._enableDebugWireframe,
352
+ enableShowOutline: false,
353
+ };
354
+ }
355
+
356
+ /**
357
+ * @param {VectorGltf3DTileContent} content
358
+ * @ignore
359
+ */
360
+ function initializeVectorPrimitives(content) {
361
+ // @ts-expect-error Requires Model conversion to ES6 class.
362
+ const components = content._decodeModel.sceneGraph.components;
363
+
364
+ const axisCorrection = ModelUtility.getAxisCorrectionMatrix(
365
+ components.upAxis,
366
+ components.forwardAxis,
367
+ new Matrix4(),
368
+ );
369
+
370
+ Matrix4.multiplyTransformation(
371
+ components.transform,
372
+ axisCorrection,
373
+ content._modelMatrix,
374
+ );
375
+
376
+ const result = createVectorTileBuffersFromModelComponents(this, components);
377
+
378
+ content._collections = result.collections;
379
+ content._collectionLocalMatrices = result.collectionLocalMatrices;
380
+ }
381
+
382
+ export default VectorGltf3DTileContent;
@@ -87,6 +87,13 @@ const VertexAttributeSemantic = {
87
87
  * @constant
88
88
  */
89
89
  ROTATION: "KHR_gaussian_splatting:ROTATION",
90
+ /**
91
+ * Per-vertex cumulative distance for line patterning.
92
+ *
93
+ * @type {string}
94
+ * @constant
95
+ */
96
+ CUMULATIVE_DISTANCE: "BENTLEY_materials_line_style:CUMULATIVE_DISTANCE",
90
97
  };
91
98
 
92
99
  function semanticToVariableName(semantic) {
@@ -111,6 +118,8 @@ function semanticToVariableName(semantic) {
111
118
  return "scale";
112
119
  case VertexAttributeSemantic.ROTATION:
113
120
  return "rotation";
121
+ case VertexAttributeSemantic.CUMULATIVE_DISTANCE:
122
+ return "cumulativeDistance";
114
123
  //>>includeStart('debug', pragmas.debug);
115
124
  default:
116
125
  throw new DeveloperError("semantic is not a valid value.");
@@ -136,6 +145,7 @@ VertexAttributeSemantic.hasSetIndex = function (semantic) {
136
145
  case VertexAttributeSemantic.POSITION:
137
146
  case VertexAttributeSemantic.NORMAL:
138
147
  case VertexAttributeSemantic.TANGENT:
148
+ case VertexAttributeSemantic.CUMULATIVE_DISTANCE:
139
149
  return false;
140
150
  case VertexAttributeSemantic.TEXCOORD:
141
151
  case VertexAttributeSemantic.COLOR:
@@ -198,6 +208,8 @@ VertexAttributeSemantic.fromGltfSemantic = function (gltfSemantic) {
198
208
  case "KHR_gaussian_splatting:ROTATION":
199
209
  case "_ROTATION":
200
210
  return VertexAttributeSemantic.ROTATION;
211
+ case "BENTLEY_materials_line_style:CUMULATIVE_DISTANCE":
212
+ return VertexAttributeSemantic.CUMULATIVE_DISTANCE;
201
213
  }
202
214
 
203
215
  return undefined;
@@ -271,6 +283,8 @@ VertexAttributeSemantic.getGlslType = function (semantic) {
271
283
  return "vec3";
272
284
  case VertexAttributeSemantic.ROTATION:
273
285
  return "vec4";
286
+ case VertexAttributeSemantic.CUMULATIVE_DISTANCE:
287
+ return "float";
274
288
  case VertexAttributeSemantic.OPACITY:
275
289
  return "float";
276
290
  //>>includeStart('debug', pragmas.debug);
@@ -39,13 +39,14 @@ const excludesReverseAxis = [
39
39
  * @property {Resource|string} url The URL of the WMS service. The URL supports the same keywords as the {@link UrlTemplateImageryProvider}.
40
40
  * @property {string} layers The layers to include, separated by commas.
41
41
  * @property {object} [parameters=WebMapServiceImageryProvider.DefaultParameters] Additional parameters to pass to the WMS server in the GetMap URL.
42
- * @property {object} [getFeatureInfoParameters=WebMapServiceImageryProvider.GetFeatureInfoDefaultParameters] Additional parameters to pass to the WMS server in the GetFeatureInfo URL.
43
42
  * @property {boolean} [enablePickFeatures=true] If true, {@link WebMapServiceImageryProvider#pickFeatures} will invoke
44
43
  * the GetFeatureInfo operation on the WMS server and return the features included in the response. If false,
45
44
  * {@link WebMapServiceImageryProvider#pickFeatures} will immediately return undefined (indicating no pickable features)
46
45
  * without communicating with the server. Set this property to false if you know your WMS server does not support
47
46
  * GetFeatureInfo or if you don't want this provider's features to be pickable. Note that this can be dynamically
48
47
  * overridden by modifying the WebMapServiceImageryProvider#enablePickFeatures property.
48
+ * @property {object} [getFeatureInfoParameters=WebMapServiceImageryProvider.GetFeatureInfoDefaultParameters] Additional parameters to pass to the WMS server in the GetFeatureInfo URL.
49
+ * @property {Resource|string} [getFeatureInfoUrl] The getFeatureInfo URL of the WMS service. If the property is not defined then we use the property value of url.
49
50
  * @property {GetFeatureInfoFormat[]} [getFeatureInfoFormats=WebMapServiceImageryProvider.DefaultGetFeatureInfoFormats] The formats
50
51
  * in which to try WMS GetFeatureInfo requests.
51
52
  * @property {Rectangle} [rectangle=Rectangle.MAX_VALUE] The rectangle of the layer.
@@ -68,7 +69,6 @@ const excludesReverseAxis = [
68
69
  * an array, each element in the array is a subdomain.
69
70
  * @property {Clock} [clock] A Clock instance that is used when determining the value for the time dimension. Required when `times` is specified.
70
71
  * @property {TimeIntervalCollection} [times] TimeIntervalCollection with its data property being an object containing time dynamic dimension and their values.
71
- * @property {Resource|string} [getFeatureInfoUrl] The getFeatureInfo URL of the WMS service. If the property is not defined then we use the property value of url.
72
72
  */
73
73
 
74
74
  /**