@cesium/engine 18.3.1-ion.1 → 19.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 (170) hide show
  1. package/Build/ThirdParty/Workers/z-worker-pako.js +77 -93
  2. package/Build/Workers/{chunk-OQNQNBEM.js → chunk-23FRF5ZP.js} +9 -9
  3. package/Build/Workers/{chunk-3T2QV5NN.js → chunk-25USKS4R.js} +6 -6
  4. package/Build/Workers/{chunk-AIBIEA2N.js → chunk-34DFERFC.js} +12 -12
  5. package/Build/Workers/{chunk-EF747DYS.js → chunk-37IYBZDZ.js} +9 -9
  6. package/Build/Workers/{chunk-T3UE5LOS.js → chunk-4NRFVAG2.js} +5 -5
  7. package/Build/Workers/{chunk-GIRJEZHU.js → chunk-4QWLEG4L.js} +14 -14
  8. package/Build/Workers/{chunk-GGNZKIG3.js → chunk-5VPO47LB.js} +8 -8
  9. package/Build/Workers/{chunk-GOSJZP7N.js → chunk-5YCDPN3O.js} +1 -1
  10. package/Build/Workers/{chunk-KSNUH6WJ.js → chunk-6T2PQKYP.js} +4 -4
  11. package/Build/Workers/{chunk-AJANTRVW.js → chunk-AABNX23Q.js} +5 -5
  12. package/Build/Workers/{chunk-JVSY3BGV.js → chunk-AZPKFL5X.js} +5 -5
  13. package/Build/Workers/{chunk-MYMBUYST.js → chunk-C36VNKTH.js} +4 -4
  14. package/Build/Workers/{chunk-QBRCP474.js → chunk-DAHXCIOX.js} +8 -8
  15. package/Build/Workers/{chunk-AKLRSDAY.js → chunk-DNCRKMCI.js} +6 -6
  16. package/Build/Workers/{chunk-5RUDB5R4.js → chunk-DPFAUGBE.js} +2 -2
  17. package/Build/Workers/{chunk-LPLMZKZS.js → chunk-DXYAD4ED.js} +1 -1
  18. package/Build/Workers/{chunk-GSLSXQGX.js → chunk-E6NMEKSS.js} +4 -4
  19. package/Build/Workers/{chunk-DG4CHTQN.js → chunk-ECWQXDZY.js} +16 -16
  20. package/Build/Workers/{chunk-Z7UO3S7L.js → chunk-ESDVZ4QL.js} +10 -10
  21. package/Build/Workers/{chunk-G7F2CKBW.js → chunk-ETCPCGKC.js} +2 -2
  22. package/Build/Workers/{chunk-W2EMENZQ.js → chunk-EV4PBU7O.js} +1 -1
  23. package/Build/Workers/{chunk-BTXGNWFF.js → chunk-FQNSMOZT.js} +4 -4
  24. package/Build/Workers/{chunk-4HDG7AFU.js → chunk-GO3IRH6U.js} +6 -6
  25. package/Build/Workers/{chunk-ACOAKTBU.js → chunk-GVO3YIU2.js} +4 -4
  26. package/Build/Workers/{chunk-RQRKALHB.js → chunk-HHHBRTSW.js} +9 -9
  27. package/Build/Workers/{chunk-5DF22LFV.js → chunk-HJ6KFRM7.js} +16 -16
  28. package/Build/Workers/{chunk-SMVRX64E.js → chunk-IE2BEHLE.js} +12 -12
  29. package/Build/Workers/{chunk-GK5WVMVN.js → chunk-JZVUMRYA.js} +13 -13
  30. package/Build/Workers/{chunk-XPXBRZXF.js → chunk-K5VGMGFM.js} +7 -7
  31. package/Build/Workers/{chunk-K4HUWRWA.js → chunk-KTDHOEXR.js} +1 -1
  32. package/Build/Workers/{chunk-PFTYXAVG.js → chunk-MBDKO456.js} +5 -5
  33. package/Build/Workers/{chunk-IC5M3JRR.js → chunk-MUL374P3.js} +2 -2
  34. package/Build/Workers/{chunk-GMNXNBM4.js → chunk-NKM2EV46.js} +1 -1
  35. package/Build/Workers/{chunk-5UWLMG6V.js → chunk-NMAT4IJ6.js} +7 -7
  36. package/Build/Workers/{chunk-YPMSP4IH.js → chunk-PAH73ETP.js} +5 -5
  37. package/Build/Workers/{chunk-OVXYMPQ7.js → chunk-Q2QXUN33.js} +2 -2
  38. package/Build/Workers/{chunk-DH3XQXDD.js → chunk-RIQM3XY5.js} +4 -4
  39. package/Build/Workers/{chunk-G6I5XO4E.js → chunk-RZJA77TX.js} +6 -6
  40. package/Build/Workers/{chunk-6HT3OW6S.js → chunk-SO2Z6H6F.js} +2 -2
  41. package/Build/Workers/{chunk-GG2NLIC6.js → chunk-SOYVF5RC.js} +2 -2
  42. package/Build/Workers/{chunk-37V6UO2J.js → chunk-SVGHDIZG.js} +5 -5
  43. package/Build/Workers/{chunk-KUVAFSVU.js → chunk-SXMHGVZ7.js} +12 -12
  44. package/Build/Workers/{chunk-3HRMP3V7.js → chunk-T7C73J6H.js} +4 -4
  45. package/Build/Workers/{chunk-LDFRBRJO.js → chunk-UPU755HO.js} +12 -12
  46. package/Build/Workers/{chunk-DPG3EG2U.js → chunk-VCCR35R6.js} +11 -11
  47. package/Build/Workers/{chunk-ZGH3R3CO.js → chunk-W32QSECR.js} +6 -6
  48. package/Build/Workers/{chunk-RVQ7LHW3.js → chunk-WUMTX3FI.js} +6 -6
  49. package/Build/Workers/{chunk-4JMMKZ4N.js → chunk-XUYCCEG6.js} +5 -5
  50. package/Build/Workers/{chunk-KQ7OYXT6.js → chunk-Y3PM6G2V.js} +3 -3
  51. package/Build/Workers/{chunk-QTFE5TBC.js → chunk-Y6LLFNXN.js} +10 -10
  52. package/Build/Workers/{chunk-GXEQK7P4.js → chunk-YPNIIVIF.js} +6 -6
  53. package/Build/Workers/{chunk-XMFKOU5X.js → chunk-ZNEIUXBK.js} +7 -7
  54. package/Build/Workers/combineGeometry.js +21 -21
  55. package/Build/Workers/createBoxGeometry.js +15 -15
  56. package/Build/Workers/createBoxOutlineGeometry.js +13 -13
  57. package/Build/Workers/createCircleGeometry.js +23 -23
  58. package/Build/Workers/createCircleOutlineGeometry.js +16 -16
  59. package/Build/Workers/createCoplanarPolygonGeometry.js +30 -30
  60. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +28 -28
  61. package/Build/Workers/createCorridorGeometry.js +26 -26
  62. package/Build/Workers/createCorridorOutlineGeometry.js +25 -25
  63. package/Build/Workers/createCylinderGeometry.js +17 -17
  64. package/Build/Workers/createCylinderOutlineGeometry.js +15 -15
  65. package/Build/Workers/createEllipseGeometry.js +23 -23
  66. package/Build/Workers/createEllipseOutlineGeometry.js +16 -16
  67. package/Build/Workers/createEllipsoidGeometry.js +16 -16
  68. package/Build/Workers/createEllipsoidOutlineGeometry.js +15 -15
  69. package/Build/Workers/createFrustumGeometry.js +15 -15
  70. package/Build/Workers/createFrustumOutlineGeometry.js +15 -15
  71. package/Build/Workers/createGeometry.js +21 -21
  72. package/Build/Workers/createGroundPolylineGeometry.js +19 -19
  73. package/Build/Workers/createPlaneGeometry.js +13 -13
  74. package/Build/Workers/createPlaneOutlineGeometry.js +12 -12
  75. package/Build/Workers/createPolygonGeometry.js +29 -29
  76. package/Build/Workers/createPolygonOutlineGeometry.js +27 -27
  77. package/Build/Workers/createPolylineGeometry.js +22 -22
  78. package/Build/Workers/createPolylineVolumeGeometry.js +28 -28
  79. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +24 -24
  80. package/Build/Workers/createRectangleGeometry.js +24 -24
  81. package/Build/Workers/createRectangleOutlineGeometry.js +17 -17
  82. package/Build/Workers/createSimplePolylineGeometry.js +20 -20
  83. package/Build/Workers/createSphereGeometry.js +16 -16
  84. package/Build/Workers/createSphereOutlineGeometry.js +15 -15
  85. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  86. package/Build/Workers/createVectorTileClampedPolylines.js +12 -12
  87. package/Build/Workers/createVectorTileGeometries.js +21 -21
  88. package/Build/Workers/createVectorTilePoints.js +11 -11
  89. package/Build/Workers/createVectorTilePolygons.js +19 -19
  90. package/Build/Workers/createVectorTilePolylines.js +12 -12
  91. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +19 -19
  92. package/Build/Workers/createVerticesFromHeightmap.js +19 -19
  93. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +16 -16
  94. package/Build/Workers/createWallGeometry.js +21 -21
  95. package/Build/Workers/createWallOutlineGeometry.js +20 -20
  96. package/Build/Workers/decodeDraco.js +10 -10
  97. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  98. package/Build/Workers/decodeI3S.js +9 -9
  99. package/Build/Workers/gaussianSplatSorter.js +4 -4
  100. package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
  101. package/Build/Workers/transcodeKTX2.js +6 -6
  102. package/Build/Workers/transferTypedArrayTest.js +1 -1
  103. package/Build/Workers/upsampleQuantizedTerrainMesh.js +19 -19
  104. package/LICENSE.md +32 -25
  105. package/Source/Core/ITwinPlatform.js +8 -1
  106. package/Source/Core/Ion.js +1 -1
  107. package/Source/Core/ScreenSpaceEventHandler.js +3 -3
  108. package/Source/Core/addAllToArray.js +40 -0
  109. package/Source/DataSources/StaticGroundGeometryPerMaterialBatch.js +54 -26
  110. package/Source/Renderer/Context.js +8 -4
  111. package/Source/Renderer/Renderbuffer.js +4 -2
  112. package/Source/Renderer/Sampler.js +13 -0
  113. package/Source/Renderer/ShaderBuilder.js +7 -6
  114. package/Source/Renderer/SharedContext.js +186 -0
  115. package/Source/Renderer/Texture.js +4 -5
  116. package/Source/Renderer/Texture3D.js +17 -7
  117. package/Source/Scene/ArcGisMapService.js +1 -1
  118. package/Source/Scene/BillboardCollection.js +1 -1
  119. package/Source/Scene/Cesium3DTileBatchTable.js +6 -4
  120. package/Source/Scene/Cesium3DTileStyle.js +4 -3
  121. package/Source/Scene/Cesium3DTileset.js +1 -1
  122. package/Source/Scene/ConditionsExpression.js +3 -2
  123. package/Source/Scene/GltfLoader.js +3 -2
  124. package/Source/Scene/GltfPipeline/ForEach.js +7 -7
  125. package/Source/Scene/GltfPipeline/addDefaults.js +1 -2
  126. package/Source/Scene/GltfPipeline/addToArray.js +2 -0
  127. package/Source/Scene/GltfPipeline/findAccessorMinMax.js +1 -1
  128. package/Source/Scene/GltfPipeline/getComponentReader.js +16 -16
  129. package/Source/Scene/GltfPipeline/moveTechniqueRenderStates.js +1 -1
  130. package/Source/Scene/GltfPipeline/moveTechniquesToExtension.js +3 -3
  131. package/Source/Scene/GltfPipeline/parseGlb.js +1 -1
  132. package/Source/Scene/GltfPipeline/readAccessorPacked.js +2 -2
  133. package/Source/Scene/GltfPipeline/removeUnusedElements.js +5 -6
  134. package/Source/Scene/GltfPipeline/updateAccessorComponentTypes.js +1 -1
  135. package/Source/Scene/GltfPipeline/updateVersion.js +13 -13
  136. package/Source/Scene/GltfSpzLoader.js +3 -1
  137. package/Source/Scene/HeightReference.js +1 -1
  138. package/Source/Scene/ITwinData.js +97 -34
  139. package/Source/Scene/ImageBasedLighting.js +6 -2
  140. package/Source/Scene/ImageryLayer.js +10 -10
  141. package/Source/Scene/MetadataTableProperty.js +2 -1
  142. package/Source/Scene/Model/ClassificationModelDrawCommand.js +7 -6
  143. package/Source/Scene/Model/GeoJsonLoader.js +3 -1
  144. package/Source/Scene/Model/ImageryConfiguration.js +1 -0
  145. package/Source/Scene/Model/ImageryPipelineStage.js +8 -2
  146. package/Source/Scene/Model/InstancingPipelineStage.js +3 -8
  147. package/Source/Scene/Model/MaterialPipelineStage.js +10 -1
  148. package/Source/Scene/Model/ModelImagery.js +3 -0
  149. package/Source/Scene/Model/ModelSceneGraph.js +2 -1
  150. package/Source/Scene/Picking.js +41 -1
  151. package/Source/Scene/Primitive.js +0 -1
  152. package/Source/Scene/PrimitiveCollection.js +32 -6
  153. package/Source/Scene/PrimitiveLoadPlan.js +0 -36
  154. package/Source/Scene/PropertyTable.js +7 -12
  155. package/Source/Scene/Scene.js +41 -32
  156. package/Source/Scene/ScreenSpaceCameraController.js +2 -0
  157. package/Source/Shaders/Builtin/Functions/modelToWindowCoordinates.glsl +2 -1
  158. package/Source/Shaders/Builtin/Functions/modelToWindowCoordinates.js +2 -1
  159. package/Source/Shaders/EllipsoidVS.glsl +4 -4
  160. package/Source/Shaders/EllipsoidVS.js +4 -4
  161. package/Source/Shaders/FXAA3_11.glsl +2 -0
  162. package/Source/Shaders/FXAA3_11.js +2 -0
  163. package/Source/Shaders/GlobeVS.glsl +2 -1
  164. package/Source/Shaders/GlobeVS.js +2 -1
  165. package/Source/Shaders/SkyAtmosphereVS.glsl +2 -1
  166. package/Source/Shaders/SkyAtmosphereVS.js +2 -1
  167. package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
  168. package/index.d.ts +82 -53
  169. package/index.js +219 -217
  170. package/package.json +3 -3
@@ -7,6 +7,7 @@ import Check from "../Core/Check.js";
7
7
  import KmlDataSource from "../DataSources/KmlDataSource.js";
8
8
  import GeoJsonDataSource from "../DataSources/GeoJsonDataSource.js";
9
9
  import DeveloperError from "../Core/DeveloperError.js";
10
+ import deprecationWarning from "../Core/deprecationWarning.js";
10
11
 
11
12
  /**
12
13
  * Methods for loading iTwin platform data into CesiumJS
@@ -25,23 +26,40 @@ const ITwinData = {};
25
26
  * We recommend waiting 10-20 seconds and trying to load the tileset again.
26
27
  * If all exports are Invalid this will throw an error.
27
28
  *
29
+ * See the {@link https://developer.bentley.com/apis/mesh-export/overview/|iTwin Platform Mesh Export API documentation} for more information on request parameters
30
+ *
28
31
  * @example
29
- * const tileset = await Cesium.ITwinData.createTilesetFromIModelId(iModelId);
32
+ * const tileset = await Cesium.ITwinData.createTilesetFromIModelId({ iModelId });
30
33
  * if (Cesium.defined(tileset)) {
31
34
  * viewer.scene.primitives.add(tileset);
32
35
  * }
33
36
  *
34
37
  * @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
35
38
  *
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}.
39
+ * @param {Object} options
40
+ * @param {string} options.iModelId The id of the iModel to load
41
+ * @param {Cesium3DTileset.ConstructorOptions} [options.tilesetOptions] Object containing options to pass to the internally created {@link Cesium3DTileset}.
42
+ * @param {string} [options.changesetId] The id of the changeset to load, if not provided the latest changesets will be used
38
43
  * @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
44
  *
40
45
  * @throws {RuntimeError} If all exports for the given iModel are Invalid
41
46
  * @throws {RuntimeError} If the iTwin API request is not successful
42
47
  */
43
- ITwinData.createTilesetFromIModelId = async function (iModelId, options) {
44
- const { exports } = await ITwinPlatform.getExports(iModelId);
48
+ ITwinData.createTilesetFromIModelId = async function (options) {
49
+ let internalOptions = options;
50
+
51
+ if (typeof options === "string") {
52
+ // the old signature was (iModelId: string, options?: Cesium3DTileset.ConstructorOptions)
53
+ // grab the later arguments directly instead of in the params only for this special case
54
+ internalOptions = { iModelId: options, tilesetOptions: arguments[1] };
55
+ deprecationWarning(
56
+ "ITwinData.createTilesetFromIModelId",
57
+ "The arguments signature for ITwinData functions has changed in 1.132 in favor of a single options object. Please update your code. This fallback will be removed in 1.133",
58
+ );
59
+ }
60
+
61
+ const { iModelId, changesetId, tilesetOptions } = internalOptions;
62
+ const { exports } = await ITwinPlatform.getExports(iModelId, changesetId);
45
63
 
46
64
  if (
47
65
  exports.length > 0 &&
@@ -72,7 +90,7 @@ ITwinData.createTilesetFromIModelId = async function (iModelId, options) {
72
90
  url: tilesetUrl,
73
91
  });
74
92
 
75
- return Cesium3DTileset.fromUrl(resource, options);
93
+ return Cesium3DTileset.fromUrl(resource, tilesetOptions);
76
94
  };
77
95
 
78
96
  /**
@@ -84,20 +102,35 @@ ITwinData.createTilesetFromIModelId = async function (iModelId, options) {
84
102
  *
85
103
  * @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
86
104
  *
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
105
+ * @param {Object} options
106
+ * @param {string} options.iTwinId The id of the iTwin to load data from
107
+ * @param {string} options.realityDataId The id of the reality data to load
108
+ * @param {ITwinPlatform.RealityDataType} [options.type] The type of this reality data
109
+ * @param {string} [options.rootDocument] The path of the root document for this reality data
91
110
  * @returns {Promise<Cesium3DTileset>}
92
111
  *
93
112
  * @throws {RuntimeError} if the type of reality data is not supported by this function
94
113
  */
95
- ITwinData.createTilesetForRealityDataId = async function (
96
- iTwinId,
97
- realityDataId,
98
- type,
99
- rootDocument,
100
- ) {
114
+ ITwinData.createTilesetForRealityDataId = async function (options) {
115
+ let internalOptions = options;
116
+
117
+ if (typeof options === "string") {
118
+ // the old signature was (iTwinId: string, realityDataId: string, type: RealityDataType, rootDocument: string)
119
+ // grab the later arguments directly instead of in the params only for this special case
120
+ internalOptions = {
121
+ iTwinId: options,
122
+ realityDataId: arguments[1],
123
+ type: arguments[2],
124
+ rootDocument: arguments[3],
125
+ };
126
+ deprecationWarning(
127
+ "ITwinData.createTilesetFromIModelId",
128
+ "The arguments signature for ITwinData functions has changed in 1.132 in favor of a single options object. Please update your code. This fallback will be removed in 1.133",
129
+ );
130
+ }
131
+ const { iTwinId, realityDataId } = internalOptions;
132
+ let { type, rootDocument } = internalOptions;
133
+
101
134
  //>>includeStart('debug', pragmas.debug);
102
135
  Check.typeOf.string("iTwinId", iTwinId);
103
136
  Check.typeOf.string("realityDataId", realityDataId);
@@ -147,20 +180,35 @@ ITwinData.createTilesetForRealityDataId = async function (
147
180
  * If the <code>type</code> or <code>rootDocument</code> are not provided this function
148
181
  * will first request the full metadata for the specified reality data to fill these values.
149
182
  *
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
183
+ * @param {Object} options
184
+ * @param {string} options.iTwinId The id of the iTwin to load data from
185
+ * @param {string} options.realityDataId The id of the reality data to load
186
+ * @param {ITwinPlatform.RealityDataType} [options.type] The type of this reality data
187
+ * @param {string} [options.rootDocument] The path of the root document for this reality data
154
188
  * @returns {Promise<GeoJsonDataSource | KmlDataSource>}
155
189
  *
156
190
  * @throws {RuntimeError} if the type of reality data is not supported by this function
157
191
  */
158
- ITwinData.createDataSourceForRealityDataId = async function (
159
- iTwinId,
160
- realityDataId,
161
- type,
162
- rootDocument,
163
- ) {
192
+ ITwinData.createDataSourceForRealityDataId = async function (options) {
193
+ let internalOptions = options;
194
+
195
+ if (typeof options === "string") {
196
+ // the old signature was (iTwinId: string, realityDataId: string, type: RealityDataType, rootDocument: string)
197
+ // grab the later arguments directly instead of in the params only for this special case
198
+ internalOptions = {
199
+ iTwinId: options,
200
+ realityDataId: arguments[1],
201
+ type: arguments[2],
202
+ rootDocument: arguments[3],
203
+ };
204
+ deprecationWarning(
205
+ "ITwinData.createTilesetFromIModelId",
206
+ "The arguments signature for ITwinData functions has changed in 1.132 in favor of a single options object. Please update your code. This fallback will be removed in 1.133",
207
+ );
208
+ }
209
+ const { iTwinId, realityDataId } = internalOptions;
210
+ let { type, rootDocument } = internalOptions;
211
+
164
212
  //>>includeStart('debug', pragmas.debug);
165
213
  Check.typeOf.string("iTwinId", iTwinId);
166
214
  Check.typeOf.string("realityDataId", realityDataId);
@@ -209,16 +257,31 @@ ITwinData.createDataSourceForRealityDataId = async function (
209
257
  /**
210
258
  * Load data from the Geospatial Features API as GeoJSON.
211
259
  *
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
260
+ * @param {Object} options
261
+ * @param {string} options.iTwinId The id of the iTwin to load data from
262
+ * @param {string} options.collectionId The id of the data collection to load
263
+ * @param {number} [options.limit=10000] number of items per page, must be between 1 and 10,000 inclusive
215
264
  * @returns {Promise<GeoJsonDataSource>}
216
265
  */
217
- ITwinData.loadGeospatialFeatures = async function (
218
- iTwinId,
219
- collectionId,
220
- limit,
221
- ) {
266
+ ITwinData.loadGeospatialFeatures = async function (options) {
267
+ let internalOptions = options;
268
+
269
+ if (typeof options === "string") {
270
+ // the old signature was (iTwinId: string, collectionId: string, limit: number)
271
+ // grab the later arguments directly instead of in the params only for this special case
272
+ internalOptions = {
273
+ iTwinId: options,
274
+ collectionId: arguments[1],
275
+ limit: arguments[2],
276
+ };
277
+ deprecationWarning(
278
+ "ITwinData.createTilesetFromIModelId",
279
+ "The arguments signature for ITwinData functions has changed in 1.132 in favor of a single options object. Please update your code. This fallback will be removed in 1.133",
280
+ );
281
+ }
282
+
283
+ const { iTwinId, collectionId, limit } = internalOptions;
284
+
222
285
  //>>includeStart('debug', pragmas.debug);
223
286
  Check.typeOf.string("iTwinId", iTwinId);
224
287
  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;
@@ -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
@@ -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,
@@ -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],
@@ -16,6 +16,9 @@ import Event from "../Core/Event.js";
16
16
  * @param {object} [options] Object with the following properties:
17
17
  * @param {boolean} [options.show=true] Determines if the primitives in the collection will be shown.
18
18
  * @param {boolean} [options.destroyPrimitives=true] Determines if primitives in the collection are destroyed when they are removed.
19
+ * @privateParam {boolean} [options.countReferences=false] Specifies whether adding and removing primitives from this collection alters their reference counts. If so, adding a
20
+ * primitive to this collection increments its reference count. Removing the primitive decrements its reference count and - if the count reaches zero **and** destroyPrimitives is true - destroys the primitive.
21
+ * This permits primitives to be shared between multiple collections.
19
22
  *
20
23
  * @example
21
24
  * const billboards = new Cesium.BillboardCollection();
@@ -71,6 +74,8 @@ function PrimitiveCollection(options) {
71
74
  * labels = labels.destroy(); // explicitly destroy
72
75
  */
73
76
  this.destroyPrimitives = options.destroyPrimitives ?? true;
77
+
78
+ this._countReferences = options.countReferences ?? false;
74
79
  }
75
80
 
76
81
  Object.defineProperties(PrimitiveCollection.prototype, {
@@ -160,6 +165,14 @@ PrimitiveCollection.prototype.add = function (primitive, index) {
160
165
  this._primitives.splice(index, 0, primitive);
161
166
  }
162
167
 
168
+ if (this._countReferences) {
169
+ if (!defined(external._referenceCount)) {
170
+ external._referenceCount = 1;
171
+ } else {
172
+ ++external._referenceCount;
173
+ }
174
+ }
175
+
163
176
  this._primitiveAdded.raiseEvent(primitive);
164
177
 
165
178
  return primitive;
@@ -188,8 +201,14 @@ PrimitiveCollection.prototype.remove = function (primitive) {
188
201
  this._primitives.splice(index, 1);
189
202
 
190
203
  delete primitive._external._composites[this._guid];
204
+ if (this._countReferences) {
205
+ primitive._external._referenceCount--;
206
+ }
191
207
 
192
- if (this.destroyPrimitives) {
208
+ if (
209
+ this.destroyPrimitives &&
210
+ (!this._countReferences || primitive._external._referenceCount <= 0)
211
+ ) {
193
212
  primitive.destroy();
194
213
  }
195
214
 
@@ -204,7 +223,7 @@ PrimitiveCollection.prototype.remove = function (primitive) {
204
223
  };
205
224
 
206
225
  /**
207
- * Removes and destroys a primitive, regardless of destroyPrimitives setting.
226
+ * Removes and destroys a primitive, regardless of destroyPrimitives or countReferences setting.
208
227
  * @private
209
228
  */
210
229
  PrimitiveCollection.prototype.removeAndDestroy = function (primitive) {
@@ -226,13 +245,20 @@ PrimitiveCollection.prototype.removeAll = function () {
226
245
  const primitives = this._primitives;
227
246
  const length = primitives.length;
228
247
  for (let i = 0; i < length; ++i) {
229
- delete primitives[i]._external._composites[this._guid];
248
+ const primitive = primitives[i];
249
+ delete primitive._external._composites[this._guid];
250
+ if (this._countReferences) {
251
+ primitive._external._referenceCount--;
252
+ }
230
253
 
231
- if (this.destroyPrimitives) {
232
- primitives[i].destroy();
254
+ if (
255
+ this.destroyPrimitives &&
256
+ (!this._countReferences || primitive._external._referenceCount <= 0)
257
+ ) {
258
+ primitive.destroy();
233
259
  }
234
260
 
235
- this._primitiveRemoved.raiseEvent(primitives[i]);
261
+ this._primitiveRemoved.raiseEvent(primitive);
236
262
  }
237
263
  this._primitives = [];
238
264
  };