@cesium/engine 12.0.1 → 13.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 (152) hide show
  1. package/Build/Workers/{chunk-WMHJAREU.js → chunk-22NU5WU5.js} +2 -2
  2. package/Build/Workers/{chunk-NL73INJS.js → chunk-2IIE2UZ3.js} +2 -2
  3. package/Build/Workers/{chunk-54NYY4U4.js → chunk-2OD54CUD.js} +7 -7
  4. package/Build/Workers/{chunk-NELAPOO6.js → chunk-2TSF7N76.js} +2 -2
  5. package/Build/Workers/{chunk-KKMH4BKN.js → chunk-3VHIUS7I.js} +6 -6
  6. package/Build/Workers/{chunk-U7SH6OK7.js → chunk-3ZMTG4X5.js} +4 -4
  7. package/Build/Workers/{chunk-ENARO52I.js → chunk-4HS475MU.js} +14 -14
  8. package/Build/Workers/{chunk-7CKQ7PVJ.js → chunk-4IM6WQEI.js} +6 -6
  9. package/Build/Workers/{chunk-3Y4UGAYI.js → chunk-6HWW6KNV.js} +6 -6
  10. package/Build/Workers/{chunk-VO4SXJXT.js → chunk-6ZOS2ACR.js} +7 -7
  11. package/Build/Workers/{chunk-7D6T2WYT.js → chunk-BFNZUP2C.js} +7 -41
  12. package/Build/Workers/{chunk-Q7IIOKAT.js → chunk-BLTSMJIP.js} +1 -1
  13. package/Build/Workers/{chunk-VXVQITFC.js → chunk-BZMHXDKV.js} +13 -13
  14. package/Build/Workers/{chunk-DR56WFYZ.js → chunk-CQDSGG3R.js} +7 -7
  15. package/Build/Workers/{chunk-DJ7K7EYK.js → chunk-CUMDCSMT.js} +11 -11
  16. package/Build/Workers/{chunk-2F42VIW6.js → chunk-D3VPMNUR.js} +13 -13
  17. package/Build/Workers/{chunk-76KRKKEF.js → chunk-DIAH2ZTB.js} +9 -9
  18. package/Build/Workers/{chunk-X6YBZOOA.js → chunk-EXDSJZ7J.js} +4 -4
  19. package/Build/Workers/{chunk-EMCXAVSG.js → chunk-FANORJU6.js} +2 -2
  20. package/Build/Workers/{chunk-GBPW65E3.js → chunk-FLPIQK2R.js} +6 -6
  21. package/Build/Workers/{chunk-ZPTNVB3S.js → chunk-GBXJIWAZ.js} +34 -8
  22. package/Build/Workers/{chunk-BH5M522L.js → chunk-GJZQSAES.js} +7 -7
  23. package/Build/Workers/{chunk-LBNGHEJY.js → chunk-GNG3V432.js} +4 -4
  24. package/Build/Workers/{chunk-2IJZVFHY.js → chunk-H4Y7ADFL.js} +5 -5
  25. package/Build/Workers/{chunk-ETXXXGMP.js → chunk-H7BML7HH.js} +6 -6
  26. package/Build/Workers/{chunk-PISTPJXS.js → chunk-HMMPNR4Z.js} +12 -12
  27. package/Build/Workers/{chunk-XDJ7V4NZ.js → chunk-JISDBAYP.js} +5 -5
  28. package/Build/Workers/{chunk-VHGI7D3P.js → chunk-KCCTLUKK.js} +10 -10
  29. package/Build/Workers/{chunk-2XOUWNPN.js → chunk-KKVKSTWC.js} +5 -5
  30. package/Build/Workers/{chunk-PNA47CR7.js → chunk-KRCUHV7P.js} +1 -1
  31. package/Build/Workers/{chunk-KJ65M35B.js → chunk-MMILY4S7.js} +11 -11
  32. package/Build/Workers/{chunk-22FZ334F.js → chunk-MSKD73KW.js} +10 -10
  33. package/Build/Workers/{chunk-PH3T7LNP.js → chunk-NVFEDMX4.js} +15 -15
  34. package/Build/Workers/{chunk-MV7YO647.js → chunk-OUIF26MQ.js} +6 -6
  35. package/Build/Workers/{chunk-IAX6MIST.js → chunk-OZZD3VY4.js} +17 -17
  36. package/Build/Workers/{chunk-647NL6VU.js → chunk-PD2MCNV7.js} +2 -2
  37. package/Build/Workers/{chunk-PJHRB4YJ.js → chunk-PMNQULFU.js} +7 -7
  38. package/Build/Workers/{chunk-YT5PQMSP.js → chunk-Q4MTXEB7.js} +6 -6
  39. package/Build/Workers/{chunk-JAKTB6CE.js → chunk-RC5N5SJL.js} +7 -7
  40. package/Build/Workers/{chunk-LVHHB5T6.js → chunk-RGZWZ4PP.js} +4 -4
  41. package/Build/Workers/{chunk-IVCFTVYW.js → chunk-RIQGQMS4.js} +4 -4
  42. package/Build/Workers/{chunk-GRQQHWMD.js → chunk-RR4M3ZGF.js} +7 -7
  43. package/Build/Workers/{chunk-K7QC3WDT.js → chunk-S4SCKDK4.js} +1 -1
  44. package/Build/Workers/{chunk-AGYO4ZSF.js → chunk-T5H7YWC7.js} +17 -17
  45. package/Build/Workers/{chunk-GSJ6LWIS.js → chunk-W2DVQETH.js} +10 -10
  46. package/Build/Workers/{chunk-JPNFQRN7.js → chunk-W2E67GLE.js} +13 -13
  47. package/Build/Workers/{chunk-ZCCI55EY.js → chunk-WXJY6NDI.js} +13 -13
  48. package/Build/Workers/{chunk-AER5CLXD.js → chunk-XQP37R5E.js} +5 -5
  49. package/Build/Workers/{chunk-7EBHNJTG.js → chunk-YBDL7YPF.js} +1 -1
  50. package/Build/Workers/{chunk-IJWXYSFC.js → chunk-YDEZMDB7.js} +2 -2
  51. package/Build/Workers/{chunk-H3RMGG7L.js → chunk-Z7OYBX6P.js} +5 -5
  52. package/Build/Workers/{chunk-COHL4R3G.js → chunk-ZIWULRRD.js} +1 -1
  53. package/Build/Workers/combineGeometry.js +22 -22
  54. package/Build/Workers/createBoxGeometry.js +16 -16
  55. package/Build/Workers/createBoxOutlineGeometry.js +14 -14
  56. package/Build/Workers/createCircleGeometry.js +24 -24
  57. package/Build/Workers/createCircleOutlineGeometry.js +17 -17
  58. package/Build/Workers/createCoplanarPolygonGeometry.js +31 -31
  59. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +29 -29
  60. package/Build/Workers/createCorridorGeometry.js +27 -27
  61. package/Build/Workers/createCorridorOutlineGeometry.js +26 -26
  62. package/Build/Workers/createCylinderGeometry.js +18 -18
  63. package/Build/Workers/createCylinderOutlineGeometry.js +16 -16
  64. package/Build/Workers/createEllipseGeometry.js +24 -24
  65. package/Build/Workers/createEllipseOutlineGeometry.js +17 -17
  66. package/Build/Workers/createEllipsoidGeometry.js +17 -17
  67. package/Build/Workers/createEllipsoidOutlineGeometry.js +16 -16
  68. package/Build/Workers/createFrustumGeometry.js +16 -16
  69. package/Build/Workers/createFrustumOutlineGeometry.js +16 -16
  70. package/Build/Workers/createGeometry.js +22 -22
  71. package/Build/Workers/createGroundPolylineGeometry.js +20 -20
  72. package/Build/Workers/createPlaneGeometry.js +14 -14
  73. package/Build/Workers/createPlaneOutlineGeometry.js +13 -13
  74. package/Build/Workers/createPolygonGeometry.js +30 -30
  75. package/Build/Workers/createPolygonOutlineGeometry.js +28 -28
  76. package/Build/Workers/createPolylineGeometry.js +23 -23
  77. package/Build/Workers/createPolylineVolumeGeometry.js +31 -32
  78. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +25 -25
  79. package/Build/Workers/createRectangleGeometry.js +25 -25
  80. package/Build/Workers/createRectangleOutlineGeometry.js +18 -18
  81. package/Build/Workers/createSimplePolylineGeometry.js +21 -21
  82. package/Build/Workers/createSphereGeometry.js +17 -17
  83. package/Build/Workers/createSphereOutlineGeometry.js +16 -16
  84. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  85. package/Build/Workers/createVectorTileClampedPolylines.js +13 -13
  86. package/Build/Workers/createVectorTileGeometries.js +22 -22
  87. package/Build/Workers/createVectorTilePoints.js +12 -12
  88. package/Build/Workers/createVectorTilePolygons.js +20 -20
  89. package/Build/Workers/createVectorTilePolylines.js +13 -13
  90. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +20 -20
  91. package/Build/Workers/createVerticesFromHeightmap.js +20 -20
  92. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +17 -17
  93. package/Build/Workers/createWallGeometry.js +22 -22
  94. package/Build/Workers/createWallOutlineGeometry.js +21 -21
  95. package/Build/Workers/decodeDraco.js +11 -11
  96. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  97. package/Build/Workers/decodeI3S.js +10 -10
  98. package/Build/Workers/transcodeKTX2.js +7 -7
  99. package/Build/Workers/transferTypedArrayTest.js +1 -1
  100. package/Build/Workers/upsampleQuantizedTerrainMesh.js +20 -20
  101. package/Source/Core/BingMapsGeocoderService.js +2 -0
  102. package/Source/Core/GoogleGeocoderService.js +110 -0
  103. package/Source/Core/ITwinPlatform.js +359 -0
  104. package/Source/Core/Ion.js +1 -1
  105. package/Source/Core/IonGeocodeProviderType.js +33 -0
  106. package/Source/Core/IonGeocoderService.js +72 -0
  107. package/Source/Core/Rectangle.js +0 -20
  108. package/Source/Core/TrackingReferenceFrame.js +45 -0
  109. package/Source/DataSources/Entity.js +15 -1
  110. package/Source/DataSources/EntityView.js +55 -4
  111. package/Source/DataSources/SampledProperty.js +24 -0
  112. package/Source/Renderer/ContextLimits.js +1 -1
  113. package/Source/Renderer/Texture.js +104 -92
  114. package/Source/Scene/ArcGisMapService.js +1 -1
  115. package/Source/Scene/Cesium3DTilesetStatistics.js +109 -42
  116. package/Source/Scene/DerivedCommand.js +109 -16
  117. package/Source/Scene/DynamicEnvironmentMapManager.js +87 -7
  118. package/Source/Scene/GltfTextureLoader.js +16 -1
  119. package/Source/Scene/ITwinData.js +138 -0
  120. package/Source/Scene/Label.js +17 -3
  121. package/Source/Scene/MetadataClassProperty.js +26 -0
  122. package/Source/Scene/MetadataPicking.js +108 -17
  123. package/Source/Scene/MetadataType.js +20 -0
  124. package/Source/Scene/Model/Extensions/Gpm/GltfMeshPrimitiveGpmLoader.js +6 -11
  125. package/Source/Scene/Model/Model3DTileContent.js +23 -1
  126. package/Source/Scene/Model/ModelStatistics.js +33 -5
  127. package/Source/Scene/Model/PointCloudStylingPipelineStage.js +2 -1
  128. package/Source/Scene/PickedMetadataInfo.js +21 -3
  129. package/Source/Scene/Picking.js +7 -1
  130. package/Source/Scene/PostProcessStage.js +14 -17
  131. package/Source/Scene/PostProcessStageCollection.js +4 -16
  132. package/Source/Scene/PostProcessStageLibrary.js +13 -51
  133. package/Source/Scene/PropertyAttributeProperty.js +15 -3
  134. package/Source/Scene/PropertyTextureProperty.js +12 -0
  135. package/Source/Scene/Scene.js +17 -2
  136. package/Source/Scene/SkyBox.js +23 -4
  137. package/Source/Scene/UrlTemplateImageryProvider.js +5 -5
  138. package/Source/Scene/createGooglePhotorealistic3DTileset.js +55 -16
  139. package/Source/Scene/getMetadataProperty.js +48 -0
  140. package/Source/Shaders/Builtin/Functions/reverseLogDepth.glsl +1 -1
  141. package/Source/Shaders/Builtin/Functions/reverseLogDepth.js +1 -1
  142. package/Source/Shaders/ConvolveSpecularMapFS.glsl +1 -1
  143. package/Source/Shaders/ConvolveSpecularMapFS.js +1 -1
  144. package/Source/Shaders/Model/ModelFS.glsl +7 -0
  145. package/Source/Shaders/Model/ModelFS.js +7 -0
  146. package/Source/Shaders/Model/ModelVS.glsl +9 -1
  147. package/Source/Shaders/Model/ModelVS.js +9 -1
  148. package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.glsl +66 -37
  149. package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.js +66 -37
  150. package/index.d.ts +270 -39
  151. package/index.js +59 -53
  152. package/package.json +1 -1
@@ -6,6 +6,7 @@ import Matrix2 from "../Core/Matrix2.js";
6
6
  import Matrix3 from "../Core/Matrix3.js";
7
7
  import Matrix4 from "../Core/Matrix4.js";
8
8
  import RuntimeError from "../Core/RuntimeError.js";
9
+ import MetadataClassProperty from "./MetadataClassProperty.js";
9
10
  import MetadataComponentType from "./MetadataComponentType.js";
10
11
  import MetadataType from "./MetadataType.js";
11
12
 
@@ -29,6 +30,10 @@ const MetadataPicking = {};
29
30
  * @param {DataView} dataView The data view
30
31
  * @param {number} index The index (byte offset)
31
32
  * @returns {number|bigint|undefined} The value
33
+ * @throws RuntimeError If the given component type is not a valid
34
+ * `MetadataComponentType`
35
+ * @throws RangeError If reading the data from the given data view would
36
+ * cause an out-of-bounds access
32
37
  *
33
38
  * @private
34
39
  */
@@ -43,21 +48,21 @@ MetadataPicking.decodeRawMetadataValue = function (
43
48
  case MetadataComponentType.UINT8:
44
49
  return dataView.getUint8(index);
45
50
  case MetadataComponentType.INT16:
46
- return dataView.getInt16(index);
51
+ return dataView.getInt16(index, true);
47
52
  case MetadataComponentType.UINT16:
48
- return dataView.getUint16(index);
53
+ return dataView.getUint16(index, true);
49
54
  case MetadataComponentType.INT32:
50
- return dataView.getInt32(index);
55
+ return dataView.getInt32(index, true);
51
56
  case MetadataComponentType.UINT32:
52
- return dataView.getUint32(index);
57
+ return dataView.getUint32(index, true);
53
58
  case MetadataComponentType.INT64:
54
- return dataView.getBigInt64(index);
59
+ return dataView.getBigInt64(index, true);
55
60
  case MetadataComponentType.UINT64:
56
- return dataView.getBigUint64(index);
61
+ return dataView.getBigUint64(index, true);
57
62
  case MetadataComponentType.FLOAT32:
58
- return dataView.getFloat32(index);
63
+ return dataView.getFloat32(index, true);
59
64
  case MetadataComponentType.FLOAT64:
60
- return dataView.getFloat64(index);
65
+ return dataView.getFloat64(index, true);
61
66
  }
62
67
  throw new RuntimeError(`Invalid component type: ${componentType}`);
63
68
  };
@@ -77,6 +82,10 @@ MetadataPicking.decodeRawMetadataValue = function (
77
82
  * @param {number} dataViewOffset The byte offset within the data view from
78
83
  * which the component should be read
79
84
  * @returns {number|bigint|undefined} The metadata value component
85
+ * @throws RuntimeError If the component of the given property is not
86
+ * a valid `MetadataComponentType`
87
+ * @throws RangeError If reading the data from the given data view would
88
+ * cause an out-of-bounds access
80
89
  */
81
90
  MetadataPicking.decodeRawMetadataValueComponent = function (
82
91
  classProperty,
@@ -114,6 +123,11 @@ MetadataPicking.decodeRawMetadataValueComponent = function (
114
123
  * @param {number} elementIndex The index of the element. This is the index
115
124
  * inside the array for array-typed properties, and 0 for non-array types.
116
125
  * @returns {number|number[]|bigint|bigint[]|undefined} The decoded metadata value element
126
+ * @throws RuntimeError If the component of the given property is not
127
+ * a valid `MetadataComponentType`
128
+ * @throws RangeError If reading the data from the given data view would
129
+ * cause an out-of-bounds access
130
+ *
117
131
  */
118
132
  MetadataPicking.decodeRawMetadataValueElement = function (
119
133
  classProperty,
@@ -183,6 +197,7 @@ MetadataPicking.decodeRawMetadataValueElement = function (
183
197
  * @param {MetadataClassProperty} classProperty The `MetadataClassProperty`
184
198
  * @param {Uint8Array} rawPixelValues The raw values
185
199
  * @returns {number|bigint|number[]|bigint[]|undefined} The value
200
+ * @throws RuntimeError If the class property has an invalid component type
186
201
  *
187
202
  * @private
188
203
  */
@@ -229,7 +244,8 @@ MetadataPicking.decodeRawMetadataValues = function (
229
244
  *
230
245
  * @param {string} type The `ClassProperty` type
231
246
  * @param {number|bigint|number[]|bigint[]|undefined} value The input value
232
- * @returns {any} The object representation
247
+ * @returns {undefined|number|bigint|string|boolean|Cartesian2|Cartesian3|Cartesian4|Matrix2|Matrix3|Matrix4} The object representation
248
+ * @throws RuntimeError If the type is not a valid `MetadataType`
233
249
  */
234
250
  MetadataPicking.convertToObjectType = function (type, value) {
235
251
  if (!defined(value)) {
@@ -250,7 +266,7 @@ MetadataPicking.convertToObjectType = function (type, value) {
250
266
  case MetadataType.VEC3:
251
267
  return Cartesian3.unpack(numbers, 0, new Cartesian3());
252
268
  case MetadataType.VEC4:
253
- return Cartesian4.unpack(numbers, 0, new Cartesian3());
269
+ return Cartesian4.unpack(numbers, 0, new Cartesian4());
254
270
  case MetadataType.MAT2:
255
271
  return Matrix2.unpack(numbers, 0, new Matrix2());
256
272
  case MetadataType.MAT3:
@@ -259,29 +275,104 @@ MetadataPicking.convertToObjectType = function (type, value) {
259
275
  return Matrix4.unpack(numbers, 0, new Matrix4());
260
276
  }
261
277
  // Should never happen:
262
- return value;
278
+ throw new RuntimeError(`Invalid metadata object type: ${type}`);
279
+ };
280
+
281
+ /**
282
+ * Converts the given type into a raw value or array representation.
283
+ *
284
+ * For `VECn/MATn` types, the given value is converted into an array.
285
+ * For other types, the value is returned directly
286
+ *
287
+ * @param {string} type The `ClassProperty` type
288
+ * @param {undefined|number|bigint|string|boolean|Cartesian2|Cartesian3|Cartesian4|Matrix2|Matrix3|Matrix4} value The input value
289
+ * @returns {undefined|number|bigint|string|boolean|number[]} The array representation
290
+ * @throws RuntimeError If the type is not a valid `MetadataType`
291
+ */
292
+ MetadataPicking.convertFromObjectType = function (type, value) {
293
+ if (!defined(value)) {
294
+ return value;
295
+ }
296
+ if (
297
+ type === MetadataType.SCALAR ||
298
+ type === MetadataType.STRING ||
299
+ type === MetadataType.BOOLEAN ||
300
+ type === MetadataType.ENUM
301
+ ) {
302
+ return value;
303
+ }
304
+ switch (type) {
305
+ case MetadataType.VEC2:
306
+ return Cartesian2.pack(value, Array(2));
307
+ case MetadataType.VEC3:
308
+ return Cartesian3.pack(value, Array(3));
309
+ case MetadataType.VEC4:
310
+ return Cartesian4.pack(value, Array(4));
311
+ case MetadataType.MAT2:
312
+ return Matrix2.pack(value, Array(4));
313
+ case MetadataType.MAT3:
314
+ return Matrix3.pack(value, Array(9));
315
+ case MetadataType.MAT4:
316
+ return Matrix4.pack(value, Array(16));
317
+ }
318
+ // Should never happen:
319
+ throw new RuntimeError(`Invalid metadata object type: ${type}`);
263
320
  };
264
321
 
265
322
  /**
266
323
  * Decode the given raw values into a metadata property value.
267
324
  *
268
- * This just converts the result of `decodeRawMetadataValues`
269
- * from array-based types into object types like `CartesianN`.
325
+ * This applies the value transform (offset/scale) to the result
326
+ * of `decodeRawMetadataValues`, and converts this from array-based
327
+ * types into object types like `CartesianN`.
270
328
  *
271
329
  * @param {MetadataClassProperty} classProperty The `MetadataClassProperty`
330
+ * @param {object} metadataProperty The
331
+ * `PropertyTextureProperty` or `PropertyAttributeProperty`
272
332
  * @param {Uint8Array} rawPixelValues The raw values
273
- * @returns {any} The value
333
+ * @returns {MetadataValue} The value
334
+ * @throws RuntimeError If the class property has an invalid type
335
+ * or component type
336
+ * @throws RangeError If the given pixel values do not have sufficient
337
+ * size to contain the expected value type
274
338
  *
275
339
  * @private
276
340
  */
277
341
  MetadataPicking.decodeMetadataValues = function (
278
342
  classProperty,
343
+ metadataProperty,
279
344
  rawPixelValues,
280
345
  ) {
281
- const arrayBasedResult = MetadataPicking.decodeRawMetadataValues(
346
+ let arrayBasedResult = MetadataPicking.decodeRawMetadataValues(
282
347
  classProperty,
283
348
  rawPixelValues,
284
349
  );
350
+
351
+ if (metadataProperty.hasValueTransform) {
352
+ // In the MetadataClassProperty, these offset/scale are always in
353
+ // their array-based form (e.g. a number[3] for `VEC3`). But for
354
+ // the PropertyTextureProperty and PropertyAttributeProperty,
355
+ // the type of the offset/scale is defined to be
356
+ // number|Cartesian2|Cartesian3|Cartesian4|Matrix2|Matrix3|Matrix4
357
+ // So these types are converted into their array-based form here, before
358
+ // applying them with `MetadataClassProperty.valueTransformInPlace`
359
+
360
+ const offset = MetadataPicking.convertFromObjectType(
361
+ classProperty.type,
362
+ metadataProperty.offset,
363
+ );
364
+ const scale = MetadataPicking.convertFromObjectType(
365
+ classProperty.type,
366
+ metadataProperty.scale,
367
+ );
368
+ arrayBasedResult = MetadataClassProperty.valueTransformInPlace(
369
+ arrayBasedResult,
370
+ offset,
371
+ scale,
372
+ MetadataComponentType.applyValueTransform,
373
+ );
374
+ }
375
+
285
376
  if (classProperty.isArray) {
286
377
  const arrayLength = classProperty.arrayLength;
287
378
  const result = Array(arrayLength);
@@ -295,11 +386,11 @@ MetadataPicking.decodeMetadataValues = function (
295
386
  }
296
387
  return result;
297
388
  }
298
- const result = MetadataPicking.convertToObjectType(
389
+ const objectResult = MetadataPicking.convertToObjectType(
299
390
  classProperty.type,
300
391
  arrayBasedResult,
301
392
  );
302
- return result;
393
+ return objectResult;
303
394
  };
304
395
 
305
396
  export default Object.freeze(MetadataPicking);
@@ -7,6 +7,26 @@ import Matrix2 from "../Core/Matrix2.js";
7
7
  import Matrix3 from "../Core/Matrix3.js";
8
8
  import Matrix4 from "../Core/Matrix4.js";
9
9
 
10
+ /**
11
+ * An instance of a metadata value.<br>
12
+ * <br>
13
+ * This can be one of the following types:
14
+ * <ul>
15
+ * <li><code>number</code> for type <code>SCALAR</code> and numeric component types except for <code>INT64</code> or <code>UINT64</code></li>
16
+ * <li><code>bigint</code> for type <code>SCALAR</code> and component type <code>INT64</code> or <code>UINT64</code></li>
17
+ * <li><code>string</code> for type <code>STRING</code> or <code>ENUM</code></li>
18
+ * <li><code>boolean</code> for type <code>BOOLEAN</code></li>
19
+ * <li><code>Cartesian2</code> for type <code>VEC2</code></li>
20
+ * <li><code>Cartesian3</code> for type <code>VEC3</code></li>
21
+ * <li><code>Cartesian4</code> for type <code>VEC4</code></li>
22
+ * <li><code>Matrix2</code> for type <code>MAT2</code></li>
23
+ * <li><code>Matrix3</code> for type <code>MAT3</code></li>
24
+ * <li><code>Matrix4</code> for type <code>MAT4</code></li>
25
+ * <li>Arrays of these types when the metadata value is an array</li>
26
+ * </ul>
27
+ * @typedef {(number|bigint|string|boolean|Cartesian2|Cartesian3|Cartesian4|Matrix2|Matrix3|Matrix4|number[]|bigint[]|string[]|boolean[]|Cartesian2[]|Cartesian3[]|Cartesian4[]|Matrix2[]|Matrix3[]|Matrix4[])} MetadataValue
28
+ */
29
+
10
30
  /**
11
31
  * An enum of metadata types. These metadata types are containers containing
12
32
  * one or more components of type {@link MetadataComponentType}
@@ -234,7 +234,7 @@ GltfMeshPrimitiveGpmLoader.ppeTexturesMetadataSchemaCache = new Map();
234
234
  * Create the JSON description of a metadata class that treats
235
235
  * the given PPE texture as a property texture property.
236
236
  *
237
- * @param {any} ppeTexture - The PPE texture
237
+ * @param {PpeTexture} ppeTexture - The PPE texture
238
238
  * @param {number} index - The index of the texture in the extension
239
239
  * @returns The class JSON
240
240
  */
@@ -268,9 +268,9 @@ GltfMeshPrimitiveGpmLoader._createPpeTextureClassJson = function (
268
268
  // property values when they are `normalized`, the values will be
269
269
  // declared as `normalized` here.
270
270
  // The normalization factor will later have to be cancelled out,
271
- // when integrating the `scale` into the actual property texture
272
- // property. In the property texture property, the `scale` has to
273
- // be multiplied by 255.
271
+ // with the `scale` being multiplied by 255.
272
+ const offset = ppeTexture.offset ?? 0.0;
273
+ const scale = (ppeTexture.scale ?? 1.0) * 255.0;
274
274
  const classJson = {
275
275
  name: `PPE texture class ${index}`,
276
276
  properties: {
@@ -279,6 +279,8 @@ GltfMeshPrimitiveGpmLoader._createPpeTextureClassJson = function (
279
279
  type: "SCALAR",
280
280
  componentType: "UINT8",
281
281
  normalized: true,
282
+ offset: offset,
283
+ scale: scale,
282
284
  min: traits.min,
283
285
  max: traits.max,
284
286
  },
@@ -406,19 +408,12 @@ GltfMeshPrimitiveGpmLoader._convertToStructuralMetadata = function (
406
408
  const ppePropertyName = traits.source;
407
409
  const metadataClass = ppeTexturesMetadataSchema.classes[classId];
408
410
 
409
- // The class property has been declared as `normalized`, so
410
- // that `offset` and `scale` can be applied. The normalization
411
- // factor has to be cancelled out here, by multiplying the
412
- // `scale` with 255.
413
- const scale = (ppeTexture.scale ?? 1.0) * 255.0;
414
411
  const ppeTextureAsPropertyTexture = {
415
412
  class: classId,
416
413
  properties: {
417
414
  [ppePropertyName]: {
418
415
  index: ppeTexture.index,
419
416
  texCoord: ppeTexture.texCoord,
420
- offset: ppeTexture.offset,
421
- scale: scale,
422
417
  },
423
418
  },
424
419
  };
@@ -152,12 +152,34 @@ Object.defineProperties(Model3DTileContent.prototype, {
152
152
  },
153
153
  });
154
154
 
155
+ /**
156
+ * Returns an array containing the `texture.id` values for all textures
157
+ * that are part of this content.
158
+ *
159
+ * @returns {string[]} The texture IDs
160
+ */
161
+ Model3DTileContent.prototype.getTextureIds = function () {
162
+ return this._model.statistics.getTextureIds();
163
+ };
164
+
165
+ /**
166
+ * Returns the length, in bytes, of the texture data for the texture with
167
+ * the given ID that is part of this content, or `undefined` if this
168
+ * content does not contain the texture with the given ID.
169
+ *
170
+ * @param {string} textureId The texture ID
171
+ * @returns {number|undefined} The texture byte length
172
+ */
173
+ Model3DTileContent.prototype.getTextureByteLengthById = function (textureId) {
174
+ return this._model.statistics.getTextureByteLengthById(textureId);
175
+ };
176
+
155
177
  /**
156
178
  * Returns the object that was created for the given extension.
157
179
  *
158
180
  * The given name may be the name of a glTF extension, like `"EXT_example_extension"`.
159
181
  * If the specified extension was present in the root of the underlying glTF asset,
160
- * and a loder for the specified extension has processed the extension data, then
182
+ * and a loader for the specified extension has processed the extension data, then
161
183
  * this will return the model representation of the extension.
162
184
  *
163
185
  * @param {string} extensionName The name of the extension
@@ -61,7 +61,15 @@ function ModelStatistics() {
61
61
  // Sets of buffers and textures that have already been counted.
62
62
  // This is to prevent double-counting cached assets.
63
63
  this._bufferIdSet = {};
64
- this._textureIdSet = {};
64
+
65
+ /**
66
+ * The mapping from `texture.id` strings to the byte length of the
67
+ * respective texture
68
+ *
69
+ * @type {object}
70
+ * @private
71
+ */
72
+ this._textureIdByteLengths = {};
65
73
 
66
74
  // Associated array of batch textures that have already been counted.
67
75
  // This allows for quick look-up to check if a texture has been counted,
@@ -111,7 +119,7 @@ ModelStatistics.prototype.clear = function () {
111
119
  this.propertyTablesByteLength = 0;
112
120
 
113
121
  this._bufferIdSet = {};
114
- this._textureIdSet = {};
122
+ this._textureIdByteLengths = {};
115
123
  this._batchTextureIdMap.removeAll();
116
124
  };
117
125
 
@@ -160,12 +168,32 @@ ModelStatistics.prototype.addTexture = function (texture) {
160
168
  Check.typeOf.object("texture", texture);
161
169
  //>>includeEnd('debug');
162
170
 
163
- if (!this._textureIdSet.hasOwnProperty(texture._id)) {
171
+ if (!this._textureIdByteLengths.hasOwnProperty(texture._id)) {
164
172
  this.texturesByteLength += texture.sizeInBytes;
173
+ this._textureIdByteLengths[texture._id] = texture.sizeInBytes;
165
174
  }
175
+ };
166
176
 
167
- // Simulate set insertion.
168
- this._textureIdSet[texture._id] = true;
177
+ /**
178
+ * Returns an array containing the `texture.id` values for all textures
179
+ * that are part of the model.
180
+ *
181
+ * @returns {string[]} The texture IDs
182
+ */
183
+ ModelStatistics.prototype.getTextureIds = function () {
184
+ return Object.keys(this._textureIdByteLengths);
185
+ };
186
+
187
+ /**
188
+ * Returns the length, in bytes, of the texture data for the texture with
189
+ * the given ID that is part of the model, or `undefined` if the model
190
+ * does not contain the texture with the given ID.
191
+ *
192
+ * @param {string} textureId The texture ID
193
+ * @returns {number|undefined} The texture byte length
194
+ */
195
+ ModelStatistics.prototype.getTextureByteLengthById = function (textureId) {
196
+ return this._textureIdByteLengths[textureId];
169
197
  };
170
198
 
171
199
  /**
@@ -333,9 +333,10 @@ function addShaderFunctionsAndDefines(shaderBuilder, shaderFunctionInfo) {
333
333
  shaderBuilder.addDefine(
334
334
  "HAS_POINT_CLOUD_SHOW_STYLE",
335
335
  undefined,
336
- ShaderDestination.VERTEX,
336
+ ShaderDestination.BOTH,
337
337
  );
338
338
  shaderBuilder.addVertexLines(showStyleFunction);
339
+ shaderBuilder.addVarying("float", "v_pointCloudShow");
339
340
  }
340
341
 
341
342
  const pointSizeStyleFunction = shaderFunctionInfo.pointSizeStyleFunction;
@@ -6,11 +6,17 @@
6
6
  * the metadata values of an object into the picking frame buffer. The
7
7
  * raw values are read from that buffer, and are then translated back into
8
8
  * proper metadata values in `Picking.pickMetadata`, using the structural
9
- * information about the metadata `classProperty` that is stored here.
9
+ * information about the metadata that is stored here.
10
10
  *
11
11
  * @private
12
12
  */
13
- function PickedMetadataInfo(schemaId, className, propertyName, classProperty) {
13
+ function PickedMetadataInfo(
14
+ schemaId,
15
+ className,
16
+ propertyName,
17
+ classProperty,
18
+ metadataProperty,
19
+ ) {
14
20
  /**
15
21
  * The optional ID of the metadata schema
16
22
  *
@@ -29,11 +35,23 @@ function PickedMetadataInfo(schemaId, className, propertyName, classProperty) {
29
35
  * @type {string}
30
36
  */
31
37
  this.propertyName = propertyName;
38
+
32
39
  /**
33
- * The optional ID of the metadata schema
40
+ * The the `MetadataClassProperty` that is described by this
41
+ * structure, as obtained from the `MetadataSchema`
34
42
  *
35
43
  * @type {MetadataClassProperty}
36
44
  */
37
45
  this.classProperty = classProperty;
46
+
47
+ /**
48
+ * The `PropertyTextureProperty` or `PropertyAttributeProperty` that
49
+ * is described by this structure, as obtained from the property texture
50
+ * or property attribute of the `StructuralMetadata` that matches the
51
+ * class name and property name.
52
+ *
53
+ * @type {object}
54
+ */
55
+ this.metadataProperty = metadataProperty;
38
56
  }
39
57
  export default PickedMetadataInfo;
@@ -426,9 +426,14 @@ Picking.prototype.pickVoxelCoordinate = function (
426
426
  * - For `VEC3`, the return type will be a `Cartesian3`
427
427
  * - For `VEC4`, the return type will be a `Cartesian4`
428
428
  *
429
+ * Future implementations may additionally return `string`- or
430
+ * `boolean` types, and `MATn` values as `MatrixN` objects,
431
+ * and arrays of the respective types.
432
+ *
429
433
  * @param {Cartesian2} windowPosition Window coordinates to perform picking on.
430
434
  * @param {PickedMetadataInfo} pickedMetadataInfo Information about the picked metadata.
431
- * @returns {any} The metadata values
435
+ * @returns {MetadataValue|undefined} The metadata value, or `undefined`
436
+ * when no matching metadata value could be picked at the given position
432
437
  *
433
438
  * @private
434
439
  */
@@ -517,6 +522,7 @@ Picking.prototype.pickMetadata = function (
517
522
 
518
523
  const metadataValue = MetadataPicking.decodeMetadataValues(
519
524
  pickedMetadataInfo.classProperty,
525
+ pickedMetadataInfo.metadataProperty,
520
526
  rawMetadataPixel,
521
527
  );
522
528
 
@@ -94,9 +94,16 @@ import PostProcessStageSampleMode from "./PostProcessStageSampleMode.js";
94
94
  function PostProcessStage(options) {
95
95
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
96
96
  const {
97
+ name = createGuid(),
97
98
  fragmentShader,
99
+ uniforms,
98
100
  textureScale = 1.0,
101
+ forcePowerOfTwo = false,
102
+ sampleMode = PostProcessStageSampleMode.NEAREST,
99
103
  pixelFormat = PixelFormat.RGBA,
104
+ pixelDatatype = PixelDatatype.UNSIGNED_BYTE,
105
+ clearColor = Color.BLACK,
106
+ scissorRectangle,
100
107
  } = options;
101
108
 
102
109
  //>>includeStart('debug', pragmas.debug);
@@ -113,19 +120,13 @@ function PostProcessStage(options) {
113
120
  //>>includeEnd('debug');
114
121
 
115
122
  this._fragmentShader = fragmentShader;
116
- this._uniforms = options.uniforms;
123
+ this._uniforms = uniforms;
117
124
  this._textureScale = textureScale;
118
- this._forcePowerOfTwo = defaultValue(options.forcePowerOfTwo, false);
119
- this._sampleMode = defaultValue(
120
- options.sampleMode,
121
- PostProcessStageSampleMode.NEAREST,
122
- );
125
+ this._forcePowerOfTwo = forcePowerOfTwo;
126
+ this._sampleMode = sampleMode;
123
127
  this._pixelFormat = pixelFormat;
124
- this._pixelDatatype = defaultValue(
125
- options.pixelDatatype,
126
- PixelDatatype.UNSIGNED_BYTE,
127
- );
128
- this._clearColor = defaultValue(options.clearColor, Color.BLACK);
128
+ this._pixelDatatype = pixelDatatype;
129
+ this._clearColor = clearColor;
129
130
 
130
131
  this._uniformMap = undefined;
131
132
  this._command = undefined;
@@ -143,18 +144,14 @@ function PostProcessStage(options) {
143
144
  const passState = new PassState();
144
145
  passState.scissorTest = {
145
146
  enabled: true,
146
- rectangle: defined(options.scissorRectangle)
147
- ? BoundingRectangle.clone(options.scissorRectangle)
147
+ rectangle: defined(scissorRectangle)
148
+ ? BoundingRectangle.clone(scissorRectangle)
148
149
  : new BoundingRectangle(),
149
150
  };
150
151
  this._passState = passState;
151
152
 
152
153
  this._ready = false;
153
154
 
154
- let name = options.name;
155
- if (!defined(name)) {
156
- name = createGuid();
157
- }
158
155
  this._name = name;
159
156
 
160
157
  this._logDepthChanged = undefined;
@@ -155,32 +155,20 @@ Object.defineProperties(PostProcessStageCollection.prototype, {
155
155
  * surface receives light and regardless of the light's position.
156
156
  * </p>
157
157
  * <p>
158
- * The uniforms have the following properties: <code>intensity</code>, <code>bias</code>, <code>lengthCap</code>,
159
- * <code>stepSize</code>, <code>frustumLength</code>, <code>ambientOcclusionOnly</code>,
160
- * <code>delta</code>, <code>sigma</code>, and <code>blurStepSize</code>.
161
- * </p>
158
+ * The uniforms have the following properties:
162
159
  * <ul>
163
160
  * <li><code>intensity</code> is a scalar value used to lighten or darken the shadows exponentially. Higher values make the shadows darker. The default value is <code>3.0</code>.</li>
164
- *
165
161
  * <li><code>bias</code> is a scalar value representing an angle in radians. If the dot product between the normal of the sample and the vector to the camera is less than this value,
166
162
  * sampling stops in the current direction. This is used to remove shadows from near planar edges. The default value is <code>0.1</code>.</li>
167
- *
168
163
  * <li><code>lengthCap</code> is a scalar value representing a length in meters. If the distance from the current sample to first sample is greater than this value,
169
164
  * sampling stops in the current direction. The default value is <code>0.26</code>.</li>
170
- *
171
- * <li><code>stepSize</code> is a scalar value indicating the distance to the next texel sample in the current direction. The default value is <code>1.95</code>.</li>
172
- *
173
- * <li><code>frustumLength</code> is a scalar value in meters. If the current fragment has a distance from the camera greater than this value, ambient occlusion is not computed for the fragment.
174
- * The default value is <code>1000.0</code>.</li>
175
- *
165
+ * <li><code>directionCount</code> is the number of directions along which the ray marching will search for occluders. The default value is <code>8</code>.</li>
166
+ * <li><code>stepCount</code> is the number of steps the ray marching will take along each direction. The default value is <code>32</code>.</li>
167
+ * <li><code>randomTexture</code> is a texture where the red channel is a random value in [0.0, 1.0]. The default value is <code>undefined</code>. This texture needs to be set.</li>
176
168
  * <li><code>ambientOcclusionOnly</code> is a boolean value. When <code>true</code>, only the shadows generated are written to the output. When <code>false</code>, the input texture is modulated
177
169
  * with the ambient occlusion. This is a useful debug option for seeing the effects of changing the uniform values. The default value is <code>false</code>.</li>
178
170
  * </ul>
179
171
  * <p>
180
- * <code>delta</code>, <code>sigma</code>, and <code>blurStepSize</code> are the same properties as {@link PostProcessStageLibrary#createBlurStage}.
181
- * The blur is applied to the shadows generated from the image to make them smoother.
182
- * </p>
183
- * <p>
184
172
  * When enabled, this stage will execute before all others.
185
173
  * </p>
186
174
  *