@cesium/engine 18.3.1-ion.1 → 20.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 (192) hide show
  1. package/Build/ThirdParty/Workers/pako_deflate.min.js +3 -3
  2. package/Build/ThirdParty/Workers/pako_inflate.min.js +3 -3
  3. package/Build/ThirdParty/Workers/z-worker-pako.js +80 -89
  4. package/Build/Workers/{chunk-G7F2CKBW.js → chunk-22LUVCO3.js} +2 -2
  5. package/Build/Workers/{chunk-AIBIEA2N.js → chunk-3BO4XBWM.js} +12 -12
  6. package/Build/Workers/{chunk-LPLMZKZS.js → chunk-3SQPZVG4.js} +1 -1
  7. package/Build/Workers/{chunk-KQ7OYXT6.js → chunk-4O5SZ2RE.js} +3 -3
  8. package/Build/Workers/{chunk-EF747DYS.js → chunk-4UIKSIEZ.js} +9 -9
  9. package/Build/Workers/{chunk-LDFRBRJO.js → chunk-5FZEM66Y.js} +12 -12
  10. package/Build/Workers/{chunk-Z7UO3S7L.js → chunk-5G56VVL3.js} +10 -10
  11. package/Build/Workers/{chunk-KUVAFSVU.js → chunk-5GKRDXYJ.js} +12 -12
  12. package/Build/Workers/{chunk-GIRJEZHU.js → chunk-5W4EBNO3.js} +14 -14
  13. package/Build/Workers/{chunk-XMFKOU5X.js → chunk-67RLCIDP.js} +7 -7
  14. package/Build/Workers/{chunk-ACOAKTBU.js → chunk-74VODBWB.js} +4 -4
  15. package/Build/Workers/{chunk-QTFE5TBC.js → chunk-7HOD2LGH.js} +10 -10
  16. package/Build/Workers/{chunk-GOSJZP7N.js → chunk-D25QOWHR.js} +1 -1
  17. package/Build/Workers/{chunk-5UWLMG6V.js → chunk-D63DK275.js} +7 -7
  18. package/Build/Workers/{chunk-4JMMKZ4N.js → chunk-EHOOC4HJ.js} +5 -5
  19. package/Build/Workers/{chunk-PFTYXAVG.js → chunk-ELI5ZYDR.js} +5 -5
  20. package/Build/Workers/{chunk-RQRKALHB.js → chunk-FGF4ETPY.js} +9 -9
  21. package/Build/Workers/{chunk-YPMSP4IH.js → chunk-FKWL63D4.js} +5 -5
  22. package/Build/Workers/{chunk-IC5M3JRR.js → chunk-FLH3ZH2X.js} +4 -4
  23. package/Build/Workers/{chunk-5DF22LFV.js → chunk-HDOFAYEE.js} +16 -16
  24. package/Build/Workers/{chunk-37V6UO2J.js → chunk-HHUHFFYN.js} +5 -5
  25. package/Build/Workers/{chunk-GSLSXQGX.js → chunk-IHUXLSNT.js} +5 -4
  26. package/Build/Workers/{chunk-K4HUWRWA.js → chunk-IJM2HVTV.js} +1 -1
  27. package/Build/Workers/{chunk-AKLRSDAY.js → chunk-IPXMWP5Z.js} +6 -6
  28. package/Build/Workers/{chunk-G6I5XO4E.js → chunk-IWKYS6RV.js} +6 -6
  29. package/Build/Workers/{chunk-RVQ7LHW3.js → chunk-JMX3P7DE.js} +8 -8
  30. package/Build/Workers/{chunk-OQNQNBEM.js → chunk-JQSMAZAT.js} +9 -9
  31. package/Build/Workers/{chunk-GGNZKIG3.js → chunk-JRLT2FQV.js} +8 -8
  32. package/Build/Workers/{chunk-GK5WVMVN.js → chunk-KRXL3KZL.js} +13 -13
  33. package/Build/Workers/{chunk-OVXYMPQ7.js → chunk-KWB7PPVO.js} +2 -2
  34. package/Build/Workers/{chunk-DG4CHTQN.js → chunk-M62PWLGC.js} +16 -16
  35. package/Build/Workers/{chunk-T3UE5LOS.js → chunk-MSLO3MQF.js} +5 -5
  36. package/Build/Workers/{chunk-ZGH3R3CO.js → chunk-MZZK44UI.js} +6 -6
  37. package/Build/Workers/{chunk-3T2QV5NN.js → chunk-NB2NKFJL.js} +6 -6
  38. package/Build/Workers/{chunk-W2EMENZQ.js → chunk-NJYFQE5B.js} +1 -1
  39. package/Build/Workers/{chunk-GG2NLIC6.js → chunk-O2O4FYNI.js} +2 -2
  40. package/Build/Workers/{chunk-6HT3OW6S.js → chunk-PZEPLREA.js} +2 -2
  41. package/Build/Workers/{chunk-MYMBUYST.js → chunk-S2RSJJQI.js} +4 -4
  42. package/Build/Workers/{chunk-QBRCP474.js → chunk-S3UYLP3X.js} +8 -8
  43. package/Build/Workers/{chunk-JVSY3BGV.js → chunk-TH3P77KJ.js} +5 -5
  44. package/Build/Workers/{chunk-4HDG7AFU.js → chunk-UGSQJYGE.js} +6 -6
  45. package/Build/Workers/{chunk-SMVRX64E.js → chunk-UUXOFY6G.js} +12 -12
  46. package/Build/Workers/{chunk-DPG3EG2U.js → chunk-V36BVRDX.js} +11 -11
  47. package/Build/Workers/{chunk-3HRMP3V7.js → chunk-VJ2DNCFT.js} +4 -4
  48. package/Build/Workers/{chunk-DH3XQXDD.js → chunk-VQUVJWBK.js} +4 -4
  49. package/Build/Workers/{chunk-AJANTRVW.js → chunk-VWQWZ7OL.js} +5 -5
  50. package/Build/Workers/{chunk-XPXBRZXF.js → chunk-VXBNLAG4.js} +7 -7
  51. package/Build/Workers/{chunk-GXEQK7P4.js → chunk-W3KNMQT2.js} +6 -6
  52. package/Build/Workers/{chunk-5RUDB5R4.js → chunk-WIGH3CPD.js} +2 -2
  53. package/Build/Workers/{chunk-GMNXNBM4.js → chunk-XVHLXVN3.js} +1 -1
  54. package/Build/Workers/{chunk-KSNUH6WJ.js → chunk-YHB3RNF2.js} +4 -4
  55. package/Build/Workers/{chunk-BTXGNWFF.js → chunk-ZSHDRKLT.js} +4 -4
  56. package/Build/Workers/combineGeometry.js +21 -21
  57. package/Build/Workers/createBoxGeometry.js +15 -15
  58. package/Build/Workers/createBoxOutlineGeometry.js +13 -13
  59. package/Build/Workers/createCircleGeometry.js +23 -23
  60. package/Build/Workers/createCircleOutlineGeometry.js +16 -16
  61. package/Build/Workers/createCoplanarPolygonGeometry.js +30 -30
  62. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +28 -28
  63. package/Build/Workers/createCorridorGeometry.js +26 -26
  64. package/Build/Workers/createCorridorOutlineGeometry.js +25 -25
  65. package/Build/Workers/createCylinderGeometry.js +17 -17
  66. package/Build/Workers/createCylinderOutlineGeometry.js +15 -15
  67. package/Build/Workers/createEllipseGeometry.js +23 -23
  68. package/Build/Workers/createEllipseOutlineGeometry.js +16 -16
  69. package/Build/Workers/createEllipsoidGeometry.js +16 -16
  70. package/Build/Workers/createEllipsoidOutlineGeometry.js +15 -15
  71. package/Build/Workers/createFrustumGeometry.js +15 -15
  72. package/Build/Workers/createFrustumOutlineGeometry.js +15 -15
  73. package/Build/Workers/createGeometry.js +21 -21
  74. package/Build/Workers/createGroundPolylineGeometry.js +19 -19
  75. package/Build/Workers/createPlaneGeometry.js +13 -13
  76. package/Build/Workers/createPlaneOutlineGeometry.js +12 -12
  77. package/Build/Workers/createPolygonGeometry.js +29 -29
  78. package/Build/Workers/createPolygonOutlineGeometry.js +27 -27
  79. package/Build/Workers/createPolylineGeometry.js +22 -22
  80. package/Build/Workers/createPolylineVolumeGeometry.js +28 -28
  81. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +24 -24
  82. package/Build/Workers/createRectangleGeometry.js +24 -24
  83. package/Build/Workers/createRectangleOutlineGeometry.js +17 -17
  84. package/Build/Workers/createSimplePolylineGeometry.js +20 -20
  85. package/Build/Workers/createSphereGeometry.js +16 -16
  86. package/Build/Workers/createSphereOutlineGeometry.js +15 -15
  87. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  88. package/Build/Workers/createVectorTileClampedPolylines.js +12 -12
  89. package/Build/Workers/createVectorTileGeometries.js +21 -21
  90. package/Build/Workers/createVectorTilePoints.js +11 -11
  91. package/Build/Workers/createVectorTilePolygons.js +19 -19
  92. package/Build/Workers/createVectorTilePolylines.js +12 -12
  93. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +19 -19
  94. package/Build/Workers/createVerticesFromHeightmap.js +25 -25
  95. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +16 -16
  96. package/Build/Workers/createWallGeometry.js +21 -21
  97. package/Build/Workers/createWallOutlineGeometry.js +20 -20
  98. package/Build/Workers/decodeDraco.js +10 -10
  99. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  100. package/Build/Workers/decodeI3S.js +9 -9
  101. package/Build/Workers/gaussianSplatSorter.js +4 -4
  102. package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
  103. package/Build/Workers/transcodeKTX2.js +17 -16
  104. package/Build/Workers/transferTypedArrayTest.js +1 -1
  105. package/Build/Workers/upsampleQuantizedTerrainMesh.js +19 -19
  106. package/LICENSE.md +32 -25
  107. package/Source/Core/Ellipsoid.js +9 -0
  108. package/Source/Core/ITwinPlatform.js +8 -1
  109. package/Source/Core/Ion.js +1 -1
  110. package/Source/Core/IonResource.js +14 -8
  111. package/Source/Core/ScreenSpaceEventHandler.js +3 -3
  112. package/Source/Core/addAllToArray.js +40 -0
  113. package/Source/DataSources/StaticGroundGeometryPerMaterialBatch.js +54 -26
  114. package/Source/Renderer/Context.js +8 -4
  115. package/Source/Renderer/Renderbuffer.js +4 -2
  116. package/Source/Renderer/Sampler.js +13 -0
  117. package/Source/Renderer/ShaderBuilder.js +7 -6
  118. package/Source/Renderer/SharedContext.js +186 -0
  119. package/Source/Renderer/Texture.js +4 -5
  120. package/Source/Renderer/Texture3D.js +17 -7
  121. package/Source/Scene/ArcGisMapService.js +1 -1
  122. package/Source/Scene/BillboardCollection.js +1 -1
  123. package/Source/Scene/BingMapsImageryProvider.js +1 -1
  124. package/Source/Scene/Cesium3DTileBatchTable.js +6 -4
  125. package/Source/Scene/Cesium3DTileContentFactory.js +7 -16
  126. package/Source/Scene/Cesium3DTileStyle.js +4 -3
  127. package/Source/Scene/Cesium3DTileset.js +2 -2
  128. package/Source/Scene/ConditionsExpression.js +3 -2
  129. package/Source/Scene/GaussianSplat3DTileContent.js +253 -9
  130. package/Source/Scene/GaussianSplatPrimitive.js +167 -15
  131. package/Source/Scene/GltfLoader.js +23 -4
  132. package/Source/Scene/GltfPipeline/ForEach.js +7 -7
  133. package/Source/Scene/GltfPipeline/addDefaults.js +1 -2
  134. package/Source/Scene/GltfPipeline/addToArray.js +2 -0
  135. package/Source/Scene/GltfPipeline/findAccessorMinMax.js +1 -1
  136. package/Source/Scene/GltfPipeline/getComponentReader.js +16 -16
  137. package/Source/Scene/GltfPipeline/moveTechniqueRenderStates.js +1 -1
  138. package/Source/Scene/GltfPipeline/moveTechniquesToExtension.js +3 -3
  139. package/Source/Scene/GltfPipeline/parseGlb.js +1 -1
  140. package/Source/Scene/GltfPipeline/readAccessorPacked.js +2 -2
  141. package/Source/Scene/GltfPipeline/removeUnusedElements.js +5 -6
  142. package/Source/Scene/GltfPipeline/updateAccessorComponentTypes.js +1 -1
  143. package/Source/Scene/GltfPipeline/updateVersion.js +13 -13
  144. package/Source/Scene/GltfSpzLoader.js +3 -1
  145. package/Source/Scene/GltfVertexBufferLoader.js +56 -2
  146. package/Source/Scene/HeightReference.js +1 -1
  147. package/Source/Scene/ITwinData.js +49 -25
  148. package/Source/Scene/ImageBasedLighting.js +6 -2
  149. package/Source/Scene/ImageryLayer.js +10 -10
  150. package/Source/Scene/MetadataTableProperty.js +2 -1
  151. package/Source/Scene/Model/ClassificationModelDrawCommand.js +7 -6
  152. package/Source/Scene/Model/GeoJsonLoader.js +3 -1
  153. package/Source/Scene/Model/ImageryConfiguration.js +1 -0
  154. package/Source/Scene/Model/ImageryPipelineStage.js +8 -2
  155. package/Source/Scene/Model/InstancingPipelineStage.js +3 -8
  156. package/Source/Scene/Model/MaterialPipelineStage.js +10 -1
  157. package/Source/Scene/Model/Model.js +3 -0
  158. package/Source/Scene/Model/ModelClippingPolygonsPipelineStage.js +8 -2
  159. package/Source/Scene/Model/ModelImagery.js +3 -0
  160. package/Source/Scene/Model/ModelSceneGraph.js +2 -1
  161. package/Source/Scene/Model/ModelUtility.js +1 -0
  162. package/Source/Scene/Model/PntsLoader.js +7 -3
  163. package/Source/Scene/Picking.js +41 -1
  164. package/Source/Scene/PntsParser.js +6 -3
  165. package/Source/Scene/Primitive.js +0 -1
  166. package/Source/Scene/PrimitiveCollection.js +32 -6
  167. package/Source/Scene/PrimitiveLoadPlan.js +1 -37
  168. package/Source/Scene/PropertyTable.js +7 -12
  169. package/Source/Scene/Scene.js +41 -32
  170. package/Source/Scene/ScreenSpaceCameraController.js +2 -0
  171. package/Source/Scene/VertexAttributeSemantic.js +4 -2
  172. package/Source/Scene/WebMapServiceImageryProvider.js +3 -2
  173. package/Source/Scene/WebMapTileServiceImageryProvider.js +0 -22
  174. package/Source/Scene/getMeshPrimitives.js +72 -0
  175. package/Source/Shaders/Builtin/Functions/modelToWindowCoordinates.glsl +2 -1
  176. package/Source/Shaders/Builtin/Functions/modelToWindowCoordinates.js +2 -1
  177. package/Source/Shaders/EllipsoidVS.glsl +4 -4
  178. package/Source/Shaders/EllipsoidVS.js +4 -4
  179. package/Source/Shaders/FXAA3_11.glsl +2 -0
  180. package/Source/Shaders/FXAA3_11.js +2 -0
  181. package/Source/Shaders/GlobeVS.glsl +2 -1
  182. package/Source/Shaders/GlobeVS.js +2 -1
  183. package/Source/Shaders/PrimitiveGaussianSplatFS.glsl +5 -5
  184. package/Source/Shaders/PrimitiveGaussianSplatFS.js +5 -5
  185. package/Source/Shaders/PrimitiveGaussianSplatVS.glsl +102 -5
  186. package/Source/Shaders/PrimitiveGaussianSplatVS.js +102 -5
  187. package/Source/Shaders/SkyAtmosphereVS.glsl +2 -1
  188. package/Source/Shaders/SkyAtmosphereVS.js +2 -1
  189. package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
  190. package/index.d.ts +191 -54
  191. package/index.js +93 -90
  192. package/package.json +4 -4
@@ -25,23 +25,31 @@ const ITwinData = {};
25
25
  * We recommend waiting 10-20 seconds and trying to load the tileset again.
26
26
  * If all exports are Invalid this will throw an error.
27
27
  *
28
+ * See the {@link https://developer.bentley.com/apis/mesh-export/overview/|iTwin Platform Mesh Export API documentation} for more information on request parameters
29
+ *
28
30
  * @example
29
- * const tileset = await Cesium.ITwinData.createTilesetFromIModelId(iModelId);
31
+ * const tileset = await Cesium.ITwinData.createTilesetFromIModelId({ iModelId });
30
32
  * if (Cesium.defined(tileset)) {
31
33
  * viewer.scene.primitives.add(tileset);
32
34
  * }
33
35
  *
34
36
  * @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
35
37
  *
36
- * @param {string} iModelId The id of the iModel to load
37
- * @param {Cesium3DTileset.ConstructorOptions} [options] Object containing options to pass to the internally created {@link Cesium3DTileset}.
38
+ * @param {Object} options
39
+ * @param {string} options.iModelId The id of the iModel to load
40
+ * @param {Cesium3DTileset.ConstructorOptions} [options.tilesetOptions] Object containing options to pass to the internally created {@link Cesium3DTileset}.
41
+ * @param {string} [options.changesetId] The id of the changeset to load, if not provided the latest changesets will be used
38
42
  * @returns {Promise<Cesium3DTileset | undefined>} A promise that will resolve to the created 3D tileset or <code>undefined</code> if there is no completed export for the given iModel id
39
43
  *
40
44
  * @throws {RuntimeError} If all exports for the given iModel are Invalid
41
45
  * @throws {RuntimeError} If the iTwin API request is not successful
42
46
  */
43
- ITwinData.createTilesetFromIModelId = async function (iModelId, options) {
44
- const { exports } = await ITwinPlatform.getExports(iModelId);
47
+ ITwinData.createTilesetFromIModelId = async function ({
48
+ iModelId,
49
+ changesetId,
50
+ tilesetOptions,
51
+ }) {
52
+ const { exports } = await ITwinPlatform.getExports(iModelId, changesetId);
45
53
 
46
54
  if (
47
55
  exports.length > 0 &&
@@ -72,7 +80,7 @@ ITwinData.createTilesetFromIModelId = async function (iModelId, options) {
72
80
  url: tilesetUrl,
73
81
  });
74
82
 
75
- return Cesium3DTileset.fromUrl(resource, options);
83
+ return Cesium3DTileset.fromUrl(resource, tilesetOptions);
76
84
  };
77
85
 
78
86
  /**
@@ -82,22 +90,29 @@ ITwinData.createTilesetFromIModelId = async function (iModelId, options) {
82
90
  * If the <code>type</code> or <code>rootDocument</code> are not provided this function
83
91
  * will first request the full metadata for the specified reality data to fill these values.
84
92
  *
93
+ * The <code>maximumScreenSpaceError</code> of the resulting tileset will default to 4,
94
+ * unless it is explicitly overridden with the given tileset options.
95
+ *
85
96
  * @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
86
97
  *
87
- * @param {string} iTwinId The id of the iTwin to load data from
88
- * @param {string} realityDataId The id of the reality data to load
89
- * @param {ITwinPlatform.RealityDataType} [type] The type of this reality data
90
- * @param {string} [rootDocument] The path of the root document for this reality data
98
+ * @param {Object} options
99
+ * @param {string} options.iTwinId The id of the iTwin to load data from
100
+ * @param {string} options.realityDataId The id of the reality data to load
101
+ * @param {ITwinPlatform.RealityDataType} [options.type] The type of this reality data
102
+ * @param {string} [options.rootDocument] The path of the root document for this reality data
103
+ * @param {Cesium3DTileset.ConstructorOptions} [options.tilesetOptions] Object containing
104
+ * options to pass to the internally created {@link Cesium3DTileset}.
91
105
  * @returns {Promise<Cesium3DTileset>}
92
106
  *
93
107
  * @throws {RuntimeError} if the type of reality data is not supported by this function
94
108
  */
95
- ITwinData.createTilesetForRealityDataId = async function (
109
+ ITwinData.createTilesetForRealityDataId = async function ({
96
110
  iTwinId,
97
111
  realityDataId,
98
112
  type,
99
113
  rootDocument,
100
- ) {
114
+ tilesetOptions,
115
+ }) {
101
116
  //>>includeStart('debug', pragmas.debug);
102
117
  Check.typeOf.string("iTwinId", iTwinId);
103
118
  Check.typeOf.string("realityDataId", realityDataId);
@@ -135,9 +150,16 @@ ITwinData.createTilesetForRealityDataId = async function (
135
150
  rootDocument,
136
151
  );
137
152
 
138
- return Cesium3DTileset.fromUrl(tilesetAccessUrl, {
153
+ // The maximum screen space error was defined to default to 4 for
154
+ // reality data tilesets, because they did not show the expected
155
+ // amount of detail with the default value of 16. Values that are
156
+ // given in the tilesetOptions should still override that default.
157
+ const internalTilesetOptions = {
139
158
  maximumScreenSpaceError: 4,
140
- });
159
+ ...tilesetOptions,
160
+ };
161
+
162
+ return Cesium3DTileset.fromUrl(tilesetAccessUrl, internalTilesetOptions);
141
163
  };
142
164
 
143
165
  /**
@@ -147,20 +169,21 @@ ITwinData.createTilesetForRealityDataId = async function (
147
169
  * If the <code>type</code> or <code>rootDocument</code> are not provided this function
148
170
  * will first request the full metadata for the specified reality data to fill these values.
149
171
  *
150
- * @param {string} iTwinId The id of the iTwin to load data from
151
- * @param {string} realityDataId The id of the reality data to load
152
- * @param {ITwinPlatform.RealityDataType} [type] The type of this reality data
153
- * @param {string} [rootDocument] The path of the root document for this reality data
172
+ * @param {Object} options
173
+ * @param {string} options.iTwinId The id of the iTwin to load data from
174
+ * @param {string} options.realityDataId The id of the reality data to load
175
+ * @param {ITwinPlatform.RealityDataType} [options.type] The type of this reality data
176
+ * @param {string} [options.rootDocument] The path of the root document for this reality data
154
177
  * @returns {Promise<GeoJsonDataSource | KmlDataSource>}
155
178
  *
156
179
  * @throws {RuntimeError} if the type of reality data is not supported by this function
157
180
  */
158
- ITwinData.createDataSourceForRealityDataId = async function (
181
+ ITwinData.createDataSourceForRealityDataId = async function ({
159
182
  iTwinId,
160
183
  realityDataId,
161
184
  type,
162
185
  rootDocument,
163
- ) {
186
+ }) {
164
187
  //>>includeStart('debug', pragmas.debug);
165
188
  Check.typeOf.string("iTwinId", iTwinId);
166
189
  Check.typeOf.string("realityDataId", realityDataId);
@@ -209,16 +232,17 @@ ITwinData.createDataSourceForRealityDataId = async function (
209
232
  /**
210
233
  * Load data from the Geospatial Features API as GeoJSON.
211
234
  *
212
- * @param {string} iTwinId The id of the iTwin to load data from
213
- * @param {string} collectionId The id of the data collection to load
214
- * @param {number} [limit=10000] number of items per page, must be between 1 and 10,000 inclusive
235
+ * @param {Object} options
236
+ * @param {string} options.iTwinId The id of the iTwin to load data from
237
+ * @param {string} options.collectionId The id of the data collection to load
238
+ * @param {number} [options.limit=10000] number of items per page, must be between 1 and 10,000 inclusive
215
239
  * @returns {Promise<GeoJsonDataSource>}
216
240
  */
217
- ITwinData.loadGeospatialFeatures = async function (
241
+ ITwinData.loadGeospatialFeatures = async function ({
218
242
  iTwinId,
219
243
  collectionId,
220
244
  limit,
221
- ) {
245
+ }) {
222
246
  //>>includeStart('debug', pragmas.debug);
223
247
  Check.typeOf.string("iTwinId", iTwinId);
224
248
  Check.typeOf.string("collectionId", collectionId);
@@ -86,6 +86,7 @@ function ImageBasedLighting(options) {
86
86
 
87
87
  // Store the previous frame number to prevent redundant update calls
88
88
  this._previousFrameNumber = undefined;
89
+ this._previousFrameContext = undefined;
89
90
 
90
91
  // Keeps track of the last values for use during update logic
91
92
  this._previousImageBasedLightingFactor = Cartesian2.clone(
@@ -325,12 +326,15 @@ function createSpecularEnvironmentCubeMap(imageBasedLighting, context) {
325
326
  }
326
327
 
327
328
  ImageBasedLighting.prototype.update = function (frameState) {
328
- if (frameState.frameNumber === this._previousFrameNumber) {
329
+ if (
330
+ frameState.frameNumber === this._previousFrameNumber &&
331
+ frameState.context === this._previousFrameContext
332
+ ) {
329
333
  return;
330
334
  }
331
335
 
332
336
  this._previousFrameNumber = frameState.frameNumber;
333
- const context = frameState.context;
337
+ const context = (this._previousFrameContext = frameState.context);
334
338
 
335
339
  frameState.brdfLutGenerator.update(frameState);
336
340
  this._shouldRegenerateShaders = false;
@@ -388,8 +388,8 @@ Object.defineProperties(ImageryLayer.prototype, {
388
388
  * Gets an event that is raised when the imagery provider encounters an asynchronous error. By subscribing
389
389
  * to the event, you will be notified of the error and can potentially recover from it. Event listeners
390
390
  * are passed an instance of the thrown error.
391
- * @memberof Imagery.prototype
392
- * @type {Event<Imagery.ErrorEventCallback>}
391
+ * @memberof ImageryLayer.prototype
392
+ * @type {Event<ImageryLayer.ErrorEventCallback>}
393
393
  * @readonly
394
394
  */
395
395
  errorEvent: {
@@ -518,7 +518,7 @@ ImageryLayer.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD = 0.004;
518
518
  * viewer.imageryLayers.add(imageryLayer);
519
519
  *
520
520
  * imageryLayer.readyEvent.addEventListener(provider => {
521
- * imageryLayer.provider.errorEvent.addEventListener(error => {
521
+ * imageryLayer.imageryProvider.errorEvent.addEventListener(error => {
522
522
  * alert(`Encountered an error while loading imagery tiles! ${error}`);
523
523
  * });
524
524
  * });
@@ -527,9 +527,9 @@ ImageryLayer.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD = 0.004;
527
527
  * alert(`Encountered an error while creating an imagery layer! ${error}`);
528
528
  * });
529
529
  *
530
- * @see ImageryLayer.errorEvent
531
- * @see ImageryLayer.readyEvent
532
- * @see ImageryLayer.provider
530
+ * @see ImageryLayer#errorEvent
531
+ * @see ImageryLayer#readyEvent
532
+ * @see ImageryLayer#imageryProvider
533
533
  * @see ImageryLayer.fromWorldImagery
534
534
  */
535
535
  ImageryLayer.fromProviderAsync = function (imageryProviderPromise, options) {
@@ -576,7 +576,7 @@ ImageryLayer.fromProviderAsync = function (imageryProviderPromise, options) {
576
576
  * viewer.imageryLayers.add(imageryLayer);
577
577
  *
578
578
  * imageryLayer.readyEvent.addEventListener(provider => {
579
- * imageryLayer.provider.errorEvent.addEventListener(error => {
579
+ * imageryLayer.imageryProvider.errorEvent.addEventListener(error => {
580
580
  * alert(`Encountered an error while loading imagery tiles! ${error}`);
581
581
  * });
582
582
  * });
@@ -585,9 +585,9 @@ ImageryLayer.fromProviderAsync = function (imageryProviderPromise, options) {
585
585
  * alert(`Encountered an error while creating an imagery layer! ${error}`);
586
586
  * });
587
587
  *
588
- * @see ImageryLayer.errorEvent
589
- * @see ImageryLayer.readyEvent
590
- * @see ImageryLayer.provider
588
+ * @see ImageryLayer#errorEvent
589
+ * @see ImageryLayer#readyEvent
590
+ * @see ImageryLayer#imageryProvider
591
591
  */
592
592
  ImageryLayer.fromWorldImagery = function (options) {
593
593
  options = options ?? Frozen.EMPTY_OBJECT;
@@ -10,6 +10,7 @@ import oneTimeWarning from "../Core/oneTimeWarning.js";
10
10
  import MetadataComponentType from "./MetadataComponentType.js";
11
11
  import MetadataClassProperty from "./MetadataClassProperty.js";
12
12
  import MetadataType from "./MetadataType.js";
13
+ import addAllToArray from "../Core/addAllToArray.js";
13
14
 
14
15
  /**
15
16
  * A binary property in a {@MetadataTable}
@@ -374,7 +375,7 @@ function flatten(values) {
374
375
  for (let i = 0; i < values.length; i++) {
375
376
  const value = values[i];
376
377
  if (Array.isArray(value)) {
377
- result.push.apply(result, value);
378
+ addAllToArray(result, value);
378
379
  } else {
379
380
  result.push(value);
380
381
  }
@@ -1,3 +1,4 @@
1
+ import addAllToArray from "../../Core/addAllToArray.js";
1
2
  import BoundingSphere from "../../Core/BoundingSphere.js";
2
3
  import Check from "../../Core/Check.js";
3
4
  import Frozen from "../../Core/Frozen.js";
@@ -482,16 +483,16 @@ ClassificationModelDrawCommand.prototype.pushCommands = function (
482
483
  const passes = frameState.passes;
483
484
  if (passes.render) {
484
485
  if (this._useDebugWireframe) {
485
- result.push.apply(result, this._commandListDebugWireframe);
486
+ addAllToArray(result, this._commandListDebugWireframe);
486
487
  return;
487
488
  }
488
489
 
489
490
  if (this._classifiesTerrain) {
490
- result.push.apply(result, this._commandListTerrain);
491
+ addAllToArray(result, this._commandListTerrain);
491
492
  }
492
493
 
493
494
  if (this._classifies3DTiles) {
494
- result.push.apply(result, this._commandList3DTiles);
495
+ addAllToArray(result, this._commandList3DTiles);
495
496
  }
496
497
 
497
498
  const useIgnoreShowCommands =
@@ -513,17 +514,17 @@ ClassificationModelDrawCommand.prototype.pushCommands = function (
513
514
  );
514
515
  }
515
516
 
516
- result.push.apply(result, this._commandListIgnoreShow);
517
+ addAllToArray(result, this._commandListIgnoreShow);
517
518
  }
518
519
  }
519
520
 
520
521
  if (passes.pick) {
521
522
  if (this._classifiesTerrain) {
522
- result.push.apply(result, this._commandListTerrainPicking);
523
+ addAllToArray(result, this._commandListTerrainPicking);
523
524
  }
524
525
 
525
526
  if (this._classifies3DTiles) {
526
- result.push.apply(result, this._commandList3DTilesPicking);
527
+ addAllToArray(result, this._commandList3DTilesPicking);
527
528
  }
528
529
  }
529
530
 
@@ -19,6 +19,7 @@ import StructuralMetadata from "../StructuralMetadata.js";
19
19
  import VertexAttributeSemantic from "../VertexAttributeSemantic.js";
20
20
  import Buffer from "../../Renderer/Buffer.js";
21
21
  import BufferUsage from "../../Renderer/BufferUsage.js";
22
+ import addAllToArray from "../../Core/addAllToArray.js";
22
23
 
23
24
  /**
24
25
  * Loads a GeoJson model as part of the <code>MAXAR_content_geojson</code> extension with the following constraints:
@@ -166,7 +167,8 @@ function parseMultiPolygon(coordinates) {
166
167
  const polygonsLength = coordinates.length;
167
168
  const lines = [];
168
169
  for (let i = 0; i < polygonsLength; i++) {
169
- Array.prototype.push.apply(lines, parsePolygon(coordinates[i]));
170
+ const polygon = parsePolygon(coordinates[i]);
171
+ addAllToArray(lines, polygon);
170
172
  }
171
173
  return lines;
172
174
  }
@@ -12,6 +12,7 @@
12
12
  */
13
13
  class ImageryConfiguration {
14
14
  constructor(imageryLayer) {
15
+ this.show = imageryLayer.show;
15
16
  this.alpha = imageryLayer.alpha;
16
17
  this.brightness = imageryLayer.brightness;
17
18
  this.contrast = imageryLayer.contrast;
@@ -109,7 +109,9 @@ class ImageryPipelineStage {
109
109
  );
110
110
 
111
111
  // This can happen when none of the imagery textures could
112
- // be obtained, because they had all been INVALID/FAILED.
112
+ // be obtained, because they had all been INVALID/FAILED,
113
+ // or when none of the imagery layers is actually visible
114
+ // according to `show==true`
113
115
  // Bail out in this case
114
116
  if (imageryInputs.length === 0) {
115
117
  return;
@@ -758,7 +760,8 @@ class ImageryPipelineStage {
758
760
  * pipeline stage for draping the given imagery layers over the primitive
759
761
  * that is described by the given model primitive imagery.
760
762
  *
761
- * This will obtain the <code>ImageryCoverage</code> objects that are provided by
763
+ * For each imagery layer that is currently visible (as of `show==true`), this
764
+ * will obtain the <code>ImageryCoverage</code> objects that are provided by
762
765
  * the given model primitive imagery (and that describe the imagery tiles
763
766
  * that are covered by the primitive), and create one <code>ImageryInput</code> for
764
767
  * each of them.
@@ -791,6 +794,9 @@ class ImageryPipelineStage {
791
794
 
792
795
  for (let i = 0; i < imageryLayers.length; i++) {
793
796
  const imageryLayer = imageryLayers.get(i);
797
+ if (!imageryLayer.show) {
798
+ continue;
799
+ }
794
800
  const imageryTexCoordAttributeSetIndex =
795
801
  imageryTexCoordAttributeSetIndices[i];
796
802
  const mappedPositions =
@@ -1,3 +1,4 @@
1
+ import addAllToArray from "../../Core/addAllToArray.js";
1
2
  import AttributeCompression from "../../Core/AttributeCompression.js";
2
3
  import Cartesian3 from "../../Core/Cartesian3.js";
3
4
  import clone from "../../Core/clone.js";
@@ -210,10 +211,7 @@ InstancingPipelineStage.process = function (renderResources, node, frameState) {
210
211
  renderResources.uniformMap = combine(uniformMap, renderResources.uniformMap);
211
212
 
212
213
  renderResources.instanceCount = count;
213
- renderResources.attributes.push.apply(
214
- renderResources.attributes,
215
- instancingVertexAttributes,
216
- );
214
+ addAllToArray(renderResources.attributes, instancingVertexAttributes);
217
215
  };
218
216
 
219
217
  const projectedTransformScratch = new Matrix4();
@@ -988,10 +986,7 @@ function processMatrixAttributes(
988
986
  shaderBuilder.addAttribute("vec4", `a_instancing${attributeString}Row1`);
989
987
  shaderBuilder.addAttribute("vec4", `a_instancing${attributeString}Row2`);
990
988
 
991
- instancingVertexAttributes.push.apply(
992
- instancingVertexAttributes,
993
- matrixAttributes,
994
- );
989
+ addAllToArray(instancingVertexAttributes, matrixAttributes);
995
990
  }
996
991
 
997
992
  function processVec3Attribute(
@@ -139,9 +139,18 @@ MaterialPipelineStage.process = function (
139
139
  VertexAttributeSemantic.NORMAL,
140
140
  );
141
141
 
142
+ // Disable PointCloud normals if the user explicitly turned them off.
143
+ const disablePointCloudNormals =
144
+ defined(model.pointCloudShading) && !model.pointCloudShading.normalShading;
145
+
142
146
  // Classification models will be rendered as unlit.
143
147
  const lightingOptions = renderResources.lightingOptions;
144
- if (material.unlit || !hasNormals || hasClassification) {
148
+ if (
149
+ material.unlit ||
150
+ !hasNormals ||
151
+ hasClassification ||
152
+ disablePointCloudNormals
153
+ ) {
145
154
  lightingOptions.lightingModel = LightingModel.UNLIT;
146
155
  } else {
147
156
  lightingOptions.lightingModel = LightingModel.PBR;
@@ -72,6 +72,9 @@ import ModelImagery from "./ModelImagery.js";
72
72
  * {@link https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Vendor/EXT_mesh_gpu_instancing|EXT_mesh_gpu_instancing}
73
73
  * </li>
74
74
  * <li>
75
+ * {@link https://github.com/KhronosGroup/glTF/pull/2514|EXT_mesh_primitive_restart}
76
+ * </li>
77
+ * <li>
75
78
  * {@link https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Vendor/EXT_meshopt_compression|EXT_meshopt_compression}
76
79
  * </li>
77
80
  * <li>
@@ -79,10 +79,16 @@ ModelClippingPolygonsPipelineStage.process = function (
79
79
 
80
80
  const uniformMap = {
81
81
  model_clippingDistance: function () {
82
- return clippingPolygons.clippingTexture;
82
+ return (
83
+ // The later should never happen during a render pass, see https://github.com/CesiumGS/cesium/issues/12725
84
+ clippingPolygons.clippingTexture ?? frameState.context.defaultTexture
85
+ );
83
86
  },
84
87
  model_clippingExtents: function () {
85
- return clippingPolygons.extentsTexture;
88
+ return (
89
+ // The later should never happen during a render pass, see https://github.com/CesiumGS/cesium/issues/12725
90
+ clippingPolygons.extentsTexture ?? frameState.context.defaultTexture
91
+ );
86
92
  },
87
93
  };
88
94
 
@@ -335,6 +335,9 @@ class ModelImagery {
335
335
  const imageryLayer = imageryLayers.get(i);
336
336
  const imageryConfiguration = imageryConfigurations[i];
337
337
 
338
+ if (imageryLayer.show !== imageryConfiguration.show) {
339
+ return true;
340
+ }
338
341
  if (imageryLayer.alpha !== imageryConfiguration.alpha) {
339
342
  return true;
340
343
  }
@@ -26,6 +26,7 @@ import ModelType from "./ModelType.js";
26
26
  import NodeRenderResources from "./NodeRenderResources.js";
27
27
  import PrimitiveRenderResources from "./PrimitiveRenderResources.js";
28
28
  import ModelDrawCommands from "./ModelDrawCommands.js";
29
+ import addAllToArray from "../../Core/addAllToArray.js";
29
30
 
30
31
  /**
31
32
  * An in memory representation of the scene graph for a {@link Model}
@@ -1018,7 +1019,7 @@ ModelSceneGraph.prototype.pushDrawCommands = function (frameState) {
1018
1019
  pushDrawCommandOptions,
1019
1020
  );
1020
1021
 
1021
- frameState.commandList.push.apply(frameState.commandList, silhouetteCommands);
1022
+ addAllToArray(frameState.commandList, silhouetteCommands);
1022
1023
  };
1023
1024
 
1024
1025
  // Callback is defined here to avoid allocating a closure in the render loop
@@ -369,6 +369,7 @@ ModelUtility.supportedExtensions = {
369
369
  KHR_texture_basisu: true,
370
370
  KHR_texture_transform: true,
371
371
  KHR_gaussian_splatting: true,
372
+ KHR_gaussian_splatting_compression_spz_2: true,
372
373
  KHR_spz_gaussian_splats_compression: true,
373
374
  WEB3D_quantized_attributes: true,
374
375
  };
@@ -549,17 +549,21 @@ function makeAttributes(loader, parsedContent, context) {
549
549
  function makeStructuralMetadata(parsedContent, customAttributeOutput) {
550
550
  const batchLength = parsedContent.batchLength;
551
551
  const pointsLength = parsedContent.pointsLength;
552
+ const batchTableJson = parsedContent.batchTableJson;
552
553
  const batchTableBinary = parsedContent.batchTableBinary;
553
554
 
554
555
  // If there are batch IDs, parse as a property table. Otherwise, parse
555
556
  // as property attributes.
556
557
  const parseAsPropertyAttributes = !defined(parsedContent.batchIds);
557
-
558
- if (defined(batchTableBinary) || parsedContent.hasDracoBatchTable) {
558
+ if (
559
+ defined(batchTableBinary) ||
560
+ defined(batchTableJson) ||
561
+ parsedContent.hasDracoBatchTable
562
+ ) {
559
563
  const count = batchLength ?? pointsLength;
560
564
  return parseBatchTable({
561
565
  count: count,
562
- batchTable: parsedContent.batchTableJson,
566
+ batchTable: batchTableJson,
563
567
  binaryBody: batchTableBinary,
564
568
  parseAsPropertyAttributes: parseAsPropertyAttributes,
565
569
  customAttributeOutput: customAttributeOutput,
@@ -272,7 +272,7 @@ function computePickingDrawingBufferRectangle(
272
272
  * @param {Cartesian2} windowPosition Window coordinates to perform picking on.
273
273
  * @param {number} [width=3] Width of the pick rectangle.
274
274
  * @param {number} [height=3] Height of the pick rectangle.
275
- * @returns {object} Object containing the picked primitive.
275
+ * @returns {object | undefined} Object containing the picked primitive.
276
276
  */
277
277
  Picking.prototype.pick = function (scene, windowPosition, width, height) {
278
278
  //>>includeStart('debug', pragmas.debug);
@@ -923,6 +923,16 @@ function getTilesets(primitives, objectsToExclude, tilesets) {
923
923
  }
924
924
  }
925
925
 
926
+ /**
927
+ * @private
928
+ * @param {Picking} picking
929
+ * @param {Scene} scene
930
+ * @param {Ray} ray
931
+ * @param {Object[] | undefined} objectsToExclude
932
+ * @param {number | undefined} width
933
+ * @param {Function} callback
934
+ * @returns {Promise<Cartesian3 | undefined>}
935
+ */
926
936
  function launchMostDetailedRayPick(
927
937
  picking,
928
938
  scene,
@@ -1266,6 +1276,12 @@ const scratchSurfaceNormal = new Cartesian3();
1266
1276
  const scratchSurfaceRay = new Ray();
1267
1277
  const scratchCartographic = new Cartographic();
1268
1278
 
1279
+ /**
1280
+ * @private
1281
+ * @param {Scene} scene
1282
+ * @param {Cartographic} cartographic
1283
+ * @returns {Ray}
1284
+ */
1269
1285
  function getRayForSampleHeight(scene, cartographic) {
1270
1286
  const ellipsoid = scene.ellipsoid;
1271
1287
  const height = ApproximateTerrainHeights._defaultMaxTerrainHeight;
@@ -1287,6 +1303,12 @@ function getRayForSampleHeight(scene, cartographic) {
1287
1303
  return ray;
1288
1304
  }
1289
1305
 
1306
+ /**
1307
+ * @private
1308
+ * @param {Scene} scene
1309
+ * @param {Cartesian3} cartesian
1310
+ * @returns {Ray}
1311
+ */
1290
1312
  function getRayForClampToHeight(scene, cartesian) {
1291
1313
  const ellipsoid = scene.ellipsoid;
1292
1314
  const cartographic = Cartographic.fromCartesian(
@@ -1338,6 +1360,16 @@ function sampleHeightMostDetailed(
1338
1360
  );
1339
1361
  }
1340
1362
 
1363
+ /**
1364
+ * @private
1365
+ * @param {Picking} picking
1366
+ * @param {Scene} scene
1367
+ * @param {Cartesian3} cartesian
1368
+ * @param {Object[]} [objectsToExclude]
1369
+ * @param {number} [width]
1370
+ * @param {Cartesian3} [result]
1371
+ * @returns {Promise<Cartesian3 | undefined>}
1372
+ */
1341
1373
  function clampToHeightMostDetailed(
1342
1374
  picking,
1343
1375
  scene,
@@ -1483,6 +1515,14 @@ Picking.prototype.sampleHeightMostDetailed = function (
1483
1515
  );
1484
1516
  };
1485
1517
 
1518
+ /**
1519
+ * @private
1520
+ * @param {Scene} scene
1521
+ * @param {Cartesian3[]} cartesians
1522
+ * @param {Object[]} [objectsToExclude]
1523
+ * @param {number} [width]
1524
+ * @returns {Promise<Array<Cartesian3 | undefined>>}
1525
+ */
1486
1526
  Picking.prototype.clampToHeightMostDetailed = function (
1487
1527
  scene,
1488
1528
  cartesians,
@@ -90,6 +90,9 @@ PntsParser.parse = function (arrayBuffer, byteOffset) {
90
90
  byteOffset,
91
91
  batchTableJsonByteLength,
92
92
  );
93
+ if (Object.keys(batchTableJson).length === 0) {
94
+ batchTableJson = undefined;
95
+ }
93
96
  byteOffset += batchTableJsonByteLength;
94
97
 
95
98
  if (batchTableBinaryByteLength > 0) {
@@ -99,6 +102,8 @@ PntsParser.parse = function (arrayBuffer, byteOffset) {
99
102
  byteOffset,
100
103
  batchTableBinaryByteLength,
101
104
  );
105
+ // Copy the batchTableBinary section and let the underlying ArrayBuffer be freed
106
+ batchTableBinary = new Uint8Array(batchTableBinary);
102
107
  byteOffset += batchTableBinaryByteLength;
103
108
  }
104
109
  }
@@ -175,9 +180,7 @@ PntsParser.parse = function (arrayBuffer, byteOffset) {
175
180
  parsedContent.batchLength = batchLength;
176
181
  }
177
182
 
178
- if (defined(batchTableBinary)) {
179
- // Copy the batchTableBinary section and let the underlying ArrayBuffer be freed
180
- batchTableBinary = new Uint8Array(batchTableBinary);
183
+ if (defined(batchTableJson) || defined(batchTableBinary)) {
181
184
  parsedContent.batchTableJson = batchTableJson;
182
185
  parsedContent.batchTableBinary = batchTableBinary;
183
186
  }
@@ -1966,7 +1966,6 @@ Primitive._updateBoundingVolumes = function (
1966
1966
  primitive._boundingSphereCV[i],
1967
1967
  primitive._boundingSphere2D[i],
1968
1968
  );
1969
- primitive._boundingSphere2D[i].center.x = 0.0;
1970
1969
  primitive._boundingSphereMorph[i] = BoundingSphere.union(
1971
1970
  primitive._boundingSphereWC[i],
1972
1971
  primitive._boundingSphereCV[i],