@cesium/engine 12.0.0 → 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-2RHMHHJH.js → chunk-22NU5WU5.js} +2 -2
  2. package/Build/Workers/{chunk-3OM5QZSI.js → chunk-2IIE2UZ3.js} +2 -2
  3. package/Build/Workers/{chunk-WQCX7U65.js → chunk-2OD54CUD.js} +7 -7
  4. package/Build/Workers/{chunk-IT6AWHFV.js → chunk-2TSF7N76.js} +2 -2
  5. package/Build/Workers/{chunk-AL7BHP36.js → chunk-3VHIUS7I.js} +6 -6
  6. package/Build/Workers/{chunk-MSY2AAW2.js → chunk-3ZMTG4X5.js} +4 -4
  7. package/Build/Workers/{chunk-GZG526CC.js → chunk-4HS475MU.js} +14 -14
  8. package/Build/Workers/{chunk-4IQPX22D.js → chunk-4IM6WQEI.js} +6 -6
  9. package/Build/Workers/{chunk-7DSVCRFD.js → chunk-6HWW6KNV.js} +6 -6
  10. package/Build/Workers/{chunk-GUW6BS72.js → chunk-6ZOS2ACR.js} +7 -7
  11. package/Build/Workers/{chunk-7OISMGQF.js → chunk-BFNZUP2C.js} +7 -41
  12. package/Build/Workers/{chunk-WW5RTJ72.js → chunk-BLTSMJIP.js} +1 -1
  13. package/Build/Workers/{chunk-ES6Q5HWK.js → chunk-BZMHXDKV.js} +13 -13
  14. package/Build/Workers/{chunk-5YKJKOFE.js → chunk-CQDSGG3R.js} +7 -7
  15. package/Build/Workers/{chunk-ZZNBFQL5.js → chunk-CUMDCSMT.js} +11 -11
  16. package/Build/Workers/{chunk-BQNTN4CC.js → chunk-D3VPMNUR.js} +13 -13
  17. package/Build/Workers/{chunk-4ESQ3DN2.js → chunk-DIAH2ZTB.js} +9 -9
  18. package/Build/Workers/{chunk-VQZNBD3T.js → chunk-EXDSJZ7J.js} +4 -4
  19. package/Build/Workers/{chunk-T6FZFMTF.js → chunk-FANORJU6.js} +2 -2
  20. package/Build/Workers/{chunk-US3L7FXC.js → chunk-FLPIQK2R.js} +6 -6
  21. package/Build/Workers/{chunk-J64XIF5C.js → chunk-GBXJIWAZ.js} +34 -8
  22. package/Build/Workers/{chunk-TQK4D4AR.js → chunk-GJZQSAES.js} +7 -7
  23. package/Build/Workers/{chunk-X67KKHI7.js → chunk-GNG3V432.js} +4 -4
  24. package/Build/Workers/{chunk-B4AZL6Q4.js → chunk-H4Y7ADFL.js} +5 -5
  25. package/Build/Workers/{chunk-SXJ37VUC.js → chunk-H7BML7HH.js} +6 -6
  26. package/Build/Workers/{chunk-5FSKL7US.js → chunk-HMMPNR4Z.js} +12 -12
  27. package/Build/Workers/{chunk-ARTM66DL.js → chunk-JISDBAYP.js} +5 -5
  28. package/Build/Workers/{chunk-6DYMJ57Z.js → chunk-KCCTLUKK.js} +10 -10
  29. package/Build/Workers/{chunk-X7VRF25X.js → chunk-KKVKSTWC.js} +5 -5
  30. package/Build/Workers/{chunk-JGGZ3H4W.js → chunk-KRCUHV7P.js} +1 -1
  31. package/Build/Workers/{chunk-AOCENJVH.js → chunk-MMILY4S7.js} +11 -11
  32. package/Build/Workers/{chunk-GYHHNFW5.js → chunk-MSKD73KW.js} +10 -10
  33. package/Build/Workers/{chunk-C4IAULHW.js → chunk-NVFEDMX4.js} +15 -15
  34. package/Build/Workers/{chunk-YANQEHO5.js → chunk-OUIF26MQ.js} +6 -6
  35. package/Build/Workers/{chunk-GKBICLGC.js → chunk-OZZD3VY4.js} +17 -17
  36. package/Build/Workers/{chunk-56LALJCU.js → chunk-PD2MCNV7.js} +2 -2
  37. package/Build/Workers/{chunk-62YGXNGC.js → chunk-PMNQULFU.js} +7 -7
  38. package/Build/Workers/{chunk-3OHDXGFC.js → chunk-Q4MTXEB7.js} +6 -6
  39. package/Build/Workers/{chunk-4XPGN5Y7.js → chunk-RC5N5SJL.js} +7 -7
  40. package/Build/Workers/{chunk-IL6SMMDD.js → chunk-RGZWZ4PP.js} +4 -4
  41. package/Build/Workers/{chunk-GMGUR5GM.js → chunk-RIQGQMS4.js} +4 -4
  42. package/Build/Workers/{chunk-VUCVRDLD.js → chunk-RR4M3ZGF.js} +7 -7
  43. package/Build/Workers/{chunk-3UJV3W4Y.js → chunk-S4SCKDK4.js} +1 -1
  44. package/Build/Workers/{chunk-VGT4ONMC.js → chunk-T5H7YWC7.js} +17 -17
  45. package/Build/Workers/{chunk-QXBRZZQS.js → chunk-W2DVQETH.js} +10 -10
  46. package/Build/Workers/{chunk-HYUTWUXN.js → chunk-W2E67GLE.js} +13 -13
  47. package/Build/Workers/{chunk-3X2LXRHU.js → chunk-WXJY6NDI.js} +13 -13
  48. package/Build/Workers/{chunk-W2Q2F7JS.js → chunk-XQP37R5E.js} +5 -5
  49. package/Build/Workers/{chunk-VJVTWBXB.js → chunk-YBDL7YPF.js} +1 -1
  50. package/Build/Workers/{chunk-HILBDZUP.js → chunk-YDEZMDB7.js} +2 -2
  51. package/Build/Workers/{chunk-JRULXFCC.js → chunk-Z7OYBX6P.js} +5 -5
  52. package/Build/Workers/{chunk-2B5H7KIN.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 +130 -8
  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 +286 -40
  151. package/index.js +59 -53
  152. package/package.json +1 -1
@@ -476,27 +476,19 @@ PostProcessStageLibrary.createBloomStage = function () {
476
476
  * surface receives light and regardless of the light's position.
477
477
  * </p>
478
478
  * <p>
479
- * The uniforms have the following properties: <code>intensity</code>, <code>bias</code>, <code>lengthCap</code>,
480
- * <code>stepSize</code>, <code>frustumLength</code>, <code>randomTexture</code>, <code>ambientOcclusionOnly</code>,
481
- * <code>delta</code>, <code>sigma</code>, and <code>blurStepSize</code>.
482
- * </p>
479
+ * The uniforms have the following properties:
483
480
  * <ul>
484
481
  * <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>
485
482
  * <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,
486
483
  * 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>
487
484
  * <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,
488
485
  * sampling stops in the current direction. The default value is <code>0.26</code>.</li>
489
- * <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>
490
- * <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.
491
- * The default value is <code>1000.0</code>.</li>
486
+ * <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>
487
+ * <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>
492
488
  * <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>
493
489
  * <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
494
490
  * 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>
495
491
  * </ul>
496
- * <p>
497
- * <code>delta</code>, <code>sigma</code>, and <code>blurStepSize</code> are the same properties as {@link PostProcessStageLibrary#createBlurStage}.
498
- * The blur is applied to the shadows generated from the image to make them smoother.
499
- * </p>
500
492
  * @return {PostProcessStageComposite} A post-process stage that applies an ambient occlusion effect.
501
493
  *
502
494
  * @private
@@ -509,24 +501,18 @@ PostProcessStageLibrary.createAmbientOcclusionStage = function () {
509
501
  intensity: 3.0,
510
502
  bias: 0.1,
511
503
  lengthCap: 0.26,
512
- stepSize: 1.95,
513
- frustumLength: 1000.0,
504
+ directionCount: 8,
505
+ stepCount: 32,
514
506
  randomTexture: undefined,
515
507
  },
516
508
  });
517
- const blur = createBlur("czm_ambient_occlusion_blur");
518
- blur.uniforms.stepSize = 0.86;
519
- const generateAndBlur = new PostProcessStageComposite({
520
- name: "czm_ambient_occlusion_generate_blur",
521
- stages: [generate, blur],
522
- });
523
509
 
524
510
  const ambientOcclusionModulate = new PostProcessStage({
525
511
  name: "czm_ambient_occlusion_composite",
526
512
  fragmentShader: AmbientOcclusionModulate,
527
513
  uniforms: {
528
514
  ambientOcclusionOnly: false,
529
- ambientOcclusionTexture: generateAndBlur.name,
515
+ ambientOcclusionTexture: generate.name,
530
516
  },
531
517
  });
532
518
 
@@ -556,20 +542,20 @@ PostProcessStageLibrary.createAmbientOcclusionStage = function () {
556
542
  generate.uniforms.lengthCap = value;
557
543
  },
558
544
  },
559
- stepSize: {
545
+ directionCount: {
560
546
  get: function () {
561
- return generate.uniforms.stepSize;
547
+ return generate.uniforms.directionCount;
562
548
  },
563
549
  set: function (value) {
564
- generate.uniforms.stepSize = value;
550
+ generate.uniforms.directionCount = value;
565
551
  },
566
552
  },
567
- frustumLength: {
553
+ stepCount: {
568
554
  get: function () {
569
- return generate.uniforms.frustumLength;
555
+ return generate.uniforms.stepCount;
570
556
  },
571
557
  set: function (value) {
572
- generate.uniforms.frustumLength = value;
558
+ generate.uniforms.stepCount = value;
573
559
  },
574
560
  },
575
561
  randomTexture: {
@@ -580,30 +566,6 @@ PostProcessStageLibrary.createAmbientOcclusionStage = function () {
580
566
  generate.uniforms.randomTexture = value;
581
567
  },
582
568
  },
583
- delta: {
584
- get: function () {
585
- return blur.uniforms.delta;
586
- },
587
- set: function (value) {
588
- blur.uniforms.delta = value;
589
- },
590
- },
591
- sigma: {
592
- get: function () {
593
- return blur.uniforms.sigma;
594
- },
595
- set: function (value) {
596
- blur.uniforms.sigma = value;
597
- },
598
- },
599
- blurStepSize: {
600
- get: function () {
601
- return blur.uniforms.stepSize;
602
- },
603
- set: function (value) {
604
- blur.uniforms.stepSize = value;
605
- },
606
- },
607
569
  ambientOcclusionOnly: {
608
570
  get: function () {
609
571
  return ambientOcclusionModulate.uniforms.ambientOcclusionOnly;
@@ -616,7 +578,7 @@ PostProcessStageLibrary.createAmbientOcclusionStage = function () {
616
578
 
617
579
  return new PostProcessStageComposite({
618
580
  name: "czm_ambient_occlusion",
619
- stages: [generateAndBlur, ambientOcclusionModulate],
581
+ stages: [generate, ambientOcclusionModulate],
620
582
  inputPreviousStageTexture: false,
621
583
  uniforms: uniforms,
622
584
  });
@@ -80,7 +80,7 @@ Object.defineProperties(PropertyAttributeProperty.prototype, {
80
80
  * True if offset/scale should be applied. If both offset/scale were
81
81
  * undefined, they default to identity so this property is set false
82
82
  *
83
- * @memberof MetadataClassProperty.prototype
83
+ * @memberof PropertyAttributeProperty.prototype
84
84
  * @type {boolean}
85
85
  * @readonly
86
86
  * @private
@@ -94,7 +94,13 @@ Object.defineProperties(PropertyAttributeProperty.prototype, {
94
94
  /**
95
95
  * The offset to be added to property values as part of the value transform.
96
96
  *
97
- * @memberof MetadataClassProperty.prototype
97
+ * This is always defined, even when `hasValueTransform` is `false`. If
98
+ * the property JSON itself did not define it, then it will inherit the
99
+ * value from the `MetadataClassProperty`. There, it also is always
100
+ * defined, and initialized to the default value if it was not contained
101
+ * in the class property JSON.
102
+ *
103
+ * @memberof PropertyAttributeProperty.prototype
98
104
  * @type {number|Cartesian2|Cartesian3|Cartesian4|Matrix2|Matrix3|Matrix4}
99
105
  * @readonly
100
106
  * @private
@@ -108,7 +114,13 @@ Object.defineProperties(PropertyAttributeProperty.prototype, {
108
114
  /**
109
115
  * The scale to be multiplied to property values as part of the value transform.
110
116
  *
111
- * @memberof MetadataClassProperty.prototype
117
+ * This is always defined, even when `hasValueTransform` is `false`. If
118
+ * the property JSON itself did not define it, then it will inherit the
119
+ * value from the `MetadataClassProperty`. There, it also is always
120
+ * defined, and initialized to the default value if it was not contained
121
+ * in the class property JSON.
122
+ *
123
+ * @memberof PropertyAttributeProperty.prototype
112
124
  * @type {number|Cartesian2|Cartesian3|Cartesian4|Matrix2|Matrix3|Matrix4}
113
125
  * @readonly
114
126
  * @private
@@ -111,6 +111,12 @@ Object.defineProperties(PropertyTextureProperty.prototype, {
111
111
  /**
112
112
  * The offset to be added to property values as part of the value transform.
113
113
  *
114
+ * This is always defined, even when `hasValueTransform` is `false`. If
115
+ * the property JSON itself did not define it, then it will inherit the
116
+ * value from the `MetadataClassProperty`. There, it also is always
117
+ * defined, and initialized to the default value if it was not contained
118
+ * in the class property JSON.
119
+ *
114
120
  * @memberof PropertyTextureProperty.prototype
115
121
  * @type {number|Cartesian2|Cartesian3|Cartesian4|Matrix2|Matrix3|Matrix4}
116
122
  * @readonly
@@ -125,6 +131,12 @@ Object.defineProperties(PropertyTextureProperty.prototype, {
125
131
  /**
126
132
  * The scale to be multiplied to property values as part of the value transform.
127
133
  *
134
+ * This is always defined, even when `hasValueTransform` is `false`. If
135
+ * the property JSON itself did not define it, then it will inherit the
136
+ * value from the `MetadataClassProperty`. There, it also is always
137
+ * defined, and initialized to the default value if it was not contained
138
+ * in the class property JSON.
139
+ *
128
140
  * @memberof PropertyTextureProperty.prototype
129
141
  * @type {number|Cartesian2|Cartesian3|Cartesian4|Matrix2|Matrix3|Matrix4}
130
142
  * @readonly
@@ -79,6 +79,7 @@ import VoxelCell from "./VoxelCell.js";
79
79
  import VoxelPrimitive from "./VoxelPrimitive.js";
80
80
  import getMetadataClassProperty from "./getMetadataClassProperty.js";
81
81
  import PickedMetadataInfo from "./PickedMetadataInfo.js";
82
+ import getMetadataProperty from "./getMetadataProperty.js";
82
83
 
83
84
  const requestRenderAfterFrame = function (scene) {
84
85
  return function () {
@@ -4402,7 +4403,8 @@ Scene.prototype.pickVoxel = function (windowPosition, width, height) {
4402
4403
  * values from
4403
4404
  * @param {string} propertyName The name of the metadata property to pick
4404
4405
  * values from
4405
- * @returns The metadata value
4406
+ * @returns {MetadataValue|undefined} The metadata value, or `undefined` when
4407
+ * no matching metadata was found at the given position
4406
4408
  *
4407
4409
  * @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
4408
4410
  */
@@ -4426,7 +4428,11 @@ Scene.prototype.pickMetadata = function (
4426
4428
  // Check if the picked object is a model that has structural
4427
4429
  // metadata, with a schema that contains the specified
4428
4430
  // property.
4429
- const schema = pickedObject.detail?.model?.structuralMetadata?.schema;
4431
+ const structuralMetadata = pickedObject.detail?.model?.structuralMetadata;
4432
+ if (!defined(structuralMetadata)) {
4433
+ return undefined;
4434
+ }
4435
+ const schema = structuralMetadata.schema;
4430
4436
  const classProperty = getMetadataClassProperty(
4431
4437
  schema,
4432
4438
  schemaId,
@@ -4436,12 +4442,21 @@ Scene.prototype.pickMetadata = function (
4436
4442
  if (!defined(classProperty)) {
4437
4443
  return undefined;
4438
4444
  }
4445
+ const metadataProperty = getMetadataProperty(
4446
+ structuralMetadata,
4447
+ className,
4448
+ propertyName,
4449
+ );
4450
+ if (!defined(metadataProperty)) {
4451
+ return undefined;
4452
+ }
4439
4453
 
4440
4454
  const pickedMetadataInfo = new PickedMetadataInfo(
4441
4455
  schemaId,
4442
4456
  className,
4443
4457
  propertyName,
4444
4458
  classProperty,
4459
+ metadataProperty,
4445
4460
  );
4446
4461
 
4447
4462
  const pickedMetadataValues = this._picking.pickMetadata(
@@ -81,6 +81,8 @@ function SkyBox(options) {
81
81
 
82
82
  this._attributeLocations = undefined;
83
83
  this._useHdr = undefined;
84
+ this._hasError = false;
85
+ this._error = undefined;
84
86
  }
85
87
 
86
88
  /**
@@ -111,6 +113,15 @@ SkyBox.prototype.update = function (frameState, useHdr) {
111
113
  return undefined;
112
114
  }
113
115
 
116
+ // Throw any errors that had previously occurred asynchronously so they aren't
117
+ // ignored when running. See https://github.com/CesiumGS/cesium/pull/12307
118
+ if (this._hasError) {
119
+ const error = this._error;
120
+ this._hasError = false;
121
+ this._error = undefined;
122
+ throw error;
123
+ }
124
+
114
125
  if (this._sources !== this.sources) {
115
126
  this._sources = this.sources;
116
127
  const sources = this.sources;
@@ -141,10 +152,18 @@ SkyBox.prototype.update = function (frameState, useHdr) {
141
152
 
142
153
  if (typeof sources.positiveX === "string") {
143
154
  // Given urls for cube-map images. Load them.
144
- loadCubeMap(context, this._sources).then(function (cubeMap) {
145
- that._cubeMap = that._cubeMap && that._cubeMap.destroy();
146
- that._cubeMap = cubeMap;
147
- });
155
+ loadCubeMap(context, this._sources)
156
+ .then(function (cubeMap) {
157
+ that._cubeMap = that._cubeMap && that._cubeMap.destroy();
158
+ that._cubeMap = cubeMap;
159
+ })
160
+ .catch((error) => {
161
+ // Defer throwing the error until the next call to update to prevent
162
+ // test from failing in `afterAll` if this is rejected after the test
163
+ // using the Skybox ends. See https://github.com/CesiumGS/cesium/pull/12307
164
+ this._hasError = true;
165
+ this._error = error;
166
+ });
148
167
  } else {
149
168
  this._cubeMap = this._cubeMap && this._cubeMap.destroy();
150
169
  this._cubeMap = new CubeMap({
@@ -159,13 +159,13 @@ const pickFeaturesTags = combine(tags, {
159
159
  * });
160
160
  * // Access a Web Map Service (WMS) server.
161
161
  * const wms = new Cesium.UrlTemplateImageryProvider({
162
- * url : 'https://programs.communications.gov.au/geoserver/ows?tiled=true&' +
163
- * 'transparent=true&format=image%2Fpng&exceptions=application%2Fvnd.ogc.se_xml&' +
164
- * 'styles=&service=WMS&version=1.1.1&request=GetMap&' +
165
- * 'layers=public%3AMyBroadband_Availability&srs=EPSG%3A3857&' +
162
+ * url : 'https://services.ga.gov.au/gis/services/NM_Hydrology_and_Marine_Points/MapServer/WMSServer?' +
163
+ * 'tiled=true&transparent=true&format=image%2Fpng&exceptions=application%2Fvnd.ogc.se_xml&' +
164
+ * 'styles=&service=WMS&version=1.3.0&request=GetMap&' +
165
+ * 'layers=Bores&crs=EPSG%3A3857&' +
166
166
  * 'bbox={westProjected}%2C{southProjected}%2C{eastProjected}%2C{northProjected}&' +
167
167
  * 'width=256&height=256',
168
- * rectangle : Cesium.Rectangle.fromDegrees(96.799393, -43.598214999057824, 153.63925700000001, -9.2159219997013)
168
+ * rectangle : Cesium.Rectangle.fromDegrees(95.0, -55.0, 170.0, -1.0) // From GetCapabilities EX_GeographicBoundingBox
169
169
  * });
170
170
  * // Using custom tags in your template url.
171
171
  * const custom = new Cesium.UrlTemplateImageryProvider({
@@ -4,23 +4,37 @@ import defined from "../Core/defined.js";
4
4
  import IonResource from "../Core/IonResource.js";
5
5
  import GoogleMaps from "../Core/GoogleMaps.js";
6
6
  import Resource from "../Core/Resource.js";
7
+ import oneTimeWarning from "../Core/oneTimeWarning.js";
8
+ import deprecationWarning from "../Core/deprecationWarning.js";
7
9
 
8
10
  /**
9
- * Creates a {@link Cesium3DTileset} instance for the Google Photorealistic 3D Tiles tileset.
11
+ * Creates a {@link Cesium3DTileset} instance for the Google Photorealistic 3D
12
+ * Tiles tileset.
13
+ *
14
+ * Google Photorealistic 3D Tiles can only be used with the Google geocoder. To
15
+ * confirm that you are aware of this restriction pass
16
+ * `usingOnlyWithGoogleGeocoder: true` to the apiOptions. Otherwise a one time
17
+ * warning will be displayed when this function is called.
10
18
  *
11
19
  * @function
12
20
  *
13
- * @param {string} [key=GoogleMaps.defaultApiKey] Your API key to access Google Photorealistic 3D Tiles. See {@link https://developers.google.com/maps/documentation/javascript/get-api-key} for instructions on how to create your own key.
14
- * @param {Cesium3DTileset.ConstructorOptions} [options] An object describing initialization options.
21
+ * @param {object} [apiOptions]
22
+ * @param {string} [apiOptions.key=GoogleMaps.defaultApiKey] Your API key to access Google Photorealistic 3D Tiles. See {@link https://developers.google.com/maps/documentation/javascript/get-api-key} for instructions on how to create your own key.
23
+ * @param {true} [apiOptions.onlyUsingWithGoogleGeocoder] Confirmation that this tileset will only be used with the Google geocoder.
24
+ * @param {Cesium3DTileset.ConstructorOptions} [tilesetOptions] An object describing initialization options.
15
25
  * @returns {Promise<Cesium3DTileset>}
16
26
  *
17
27
  * @see GoogleMaps
18
28
  *
19
29
  * @example
20
- * const viewer = new Cesium.Viewer("cesiumContainer");
30
+ * const viewer = new Cesium.Viewer("cesiumContainer", {
31
+ * geocoder: Cesium.IonGeocodeProviderType.GOOGLE
32
+ * });
21
33
  *
22
34
  * try {
23
- * const tileset = await Cesium.createGooglePhotorealistic3DTileset();
35
+ * const tileset = await Cesium.createGooglePhotorealistic3DTileset({
36
+ * onlyUsingWithGoogleGeocoder: true,
37
+ * });
24
38
  * viewer.scene.primitives.add(tileset));
25
39
  * } catch (error) {
26
40
  * console.log(`Error creating tileset: ${error}`);
@@ -30,27 +44,52 @@ import Resource from "../Core/Resource.js";
30
44
  * // Use your own Google Maps API key
31
45
  * Cesium.GoogleMaps.defaultApiKey = "your-api-key";
32
46
  *
33
- * const viewer = new Cesium.Viewer("cesiumContainer");
47
+ * const viewer = new Cesium.Viewer("cesiumContainer". {
48
+ * geocoder: Cesium.IonGeocodeProviderType.GOOGLE
49
+ * });
34
50
  *
35
51
  * try {
36
- * const tileset = await Cesium.createGooglePhotorealistic3DTileset();
52
+ * const tileset = await Cesium.createGooglePhotorealistic3DTileset({
53
+ * onlyUsingWithGoogleGeocoder: true,
54
+ * });
37
55
  * viewer.scene.primitives.add(tileset));
38
56
  * } catch (error) {
39
57
  * console.log(`Error creating tileset: ${error}`);
40
58
  * }
41
59
  */
42
- async function createGooglePhotorealistic3DTileset(key, options) {
43
- options = defaultValue(options, {});
44
- options.cacheBytes = defaultValue(options.cacheBytes, 1536 * 1024 * 1024);
45
- options.maximumCacheOverflowBytes = defaultValue(
46
- options.maximumCacheOverflowBytes,
60
+ async function createGooglePhotorealistic3DTileset(apiOptions, tilesetOptions) {
61
+ tilesetOptions = defaultValue(tilesetOptions, {});
62
+ tilesetOptions.cacheBytes = defaultValue(
63
+ tilesetOptions.cacheBytes,
64
+ 1536 * 1024 * 1024,
65
+ );
66
+ tilesetOptions.maximumCacheOverflowBytes = defaultValue(
67
+ tilesetOptions.maximumCacheOverflowBytes,
47
68
  1024 * 1024 * 1024,
48
69
  );
49
- options.enableCollision = defaultValue(options.enableCollision, true);
70
+ tilesetOptions.enableCollision = defaultValue(
71
+ tilesetOptions.enableCollision,
72
+ true,
73
+ );
50
74
 
51
- key = defaultValue(key, GoogleMaps.defaultApiKey);
75
+ apiOptions = defaultValue(apiOptions, defaultValue.EMPTY_OBJECT);
76
+ if (typeof apiOptions === "string") {
77
+ deprecationWarning(
78
+ "createGooglePhotorealistic3DTileset(key)",
79
+ "createGooglePhotorealistic3DTileset(key) has been deprecated. It is replaced by createGooglePhotorealistic3DTileset({key}). It will be removed in Cesium 1.126.",
80
+ );
81
+ apiOptions = { key: apiOptions };
82
+ }
83
+ if (!apiOptions.onlyUsingWithGoogleGeocoder) {
84
+ oneTimeWarning(
85
+ "google-tiles-with-google-geocoder",
86
+ "Only the Google geocoder can be used with Google Photorealistic 3D Tiles. Set the `geocode` property of Viewer constructor options. You can set additionalOptions.onlyUsingWithGoogleGeocoder to hide this warning once you have configured the geocoder.",
87
+ );
88
+ }
89
+
90
+ const key = defaultValue(apiOptions.key, GoogleMaps.defaultApiKey);
52
91
  if (!defined(key)) {
53
- return requestCachedIonTileset(options);
92
+ return requestCachedIonTileset(tilesetOptions);
54
93
  }
55
94
 
56
95
  let credits;
@@ -67,7 +106,7 @@ async function createGooglePhotorealistic3DTileset(key, options) {
67
106
  credits: credits,
68
107
  });
69
108
 
70
- return Cesium3DTileset.fromUrl(resource, options);
109
+ return Cesium3DTileset.fromUrl(resource, tilesetOptions);
71
110
  }
72
111
 
73
112
  const metadataCache = {};
@@ -0,0 +1,48 @@
1
+ import defined from "../Core/defined.js";
2
+
3
+ /**
4
+ * Return the `PropertyTextureProperty` from the given `StructuralMetadata`
5
+ * that matches the given description.
6
+ *
7
+ * If the given structural metadata is `undefined`, then `undefined` is returned.
8
+ *
9
+ * Otherwise, this method will check all the property textures in the given
10
+ * structural metadata.
11
+ *
12
+ * If it finds a property texture that has a class with an `_id` that matches
13
+ * the given name, and that contains a property for the given property name, then
14
+ * this property is returned.
15
+ *
16
+ * Otherwise, `undefined` is returned
17
+ *
18
+ * @param {StructuralMetadata} structuralMetadata The structural metadata
19
+ * @param {string} className The name of the metadata class
20
+ * @param {string} propertyName The name of the metadata property
21
+ * @returns {PropertyTextureProperty|undefined}
22
+ * @private
23
+ */
24
+ function getMetadataProperty(structuralMetadata, className, propertyName) {
25
+ if (!defined(structuralMetadata)) {
26
+ return undefined;
27
+ }
28
+ const propertyTextures = structuralMetadata.propertyTextures;
29
+ for (const propertyTexture of propertyTextures) {
30
+ const metadataClass = propertyTexture.class;
31
+ if (metadataClass.id === className) {
32
+ const properties = propertyTexture.properties;
33
+ const property = properties[propertyName];
34
+ if (defined(property)) {
35
+ return property;
36
+ }
37
+ }
38
+ }
39
+ // Note: This could check for property attributes in a similar
40
+ // way. But since picking arbitrary property attributes via the
41
+ // frame buffer is not supported yet, returning "undefined" here
42
+ // causes the picking to bail out early and safely when no
43
+ // property texture was found.
44
+ // See https://github.com/CesiumGS/cesium/issues/12225
45
+ return undefined;
46
+ }
47
+
48
+ export default getMetadataProperty;
@@ -4,7 +4,7 @@ float czm_reverseLogDepth(float logZ)
4
4
  float near = czm_currentFrustum.x;
5
5
  float far = czm_currentFrustum.y;
6
6
  float log2Depth = logZ * czm_log2FarDepthFromNearPlusOne;
7
- float depthFromNear = pow(2.0, log2Depth) - 1.0;
7
+ float depthFromNear = exp2(log2Depth) - 1.0;
8
8
  return far * (1.0 - near / (depthFromNear + near)) / (far - near);
9
9
  #endif
10
10
  return logZ;
@@ -5,7 +5,7 @@ export default "float czm_reverseLogDepth(float logZ)\n\
5
5
  float near = czm_currentFrustum.x;\n\
6
6
  float far = czm_currentFrustum.y;\n\
7
7
  float log2Depth = logZ * czm_log2FarDepthFromNearPlusOne;\n\
8
- float depthFromNear = pow(2.0, log2Depth) - 1.0;\n\
8
+ float depthFromNear = exp2(log2Depth) - 1.0;\n\
9
9
  return far * (1.0 - near / (depthFromNear + near)) / (far - near);\n\
10
10
  #endif\n\
11
11
  return logZ;\n\
@@ -62,7 +62,7 @@ void main() {
62
62
 
63
63
  float NdotL = max(dot(V, L), 0.0);
64
64
  if (NdotL > 0.0) {
65
- color += vec4(texture(u_radianceTexture, L).rgb, 1.0) * NdotL;
65
+ color += vec4(czm_textureCube(u_radianceTexture, L).rgb, 1.0) * NdotL;
66
66
  weight += NdotL;
67
67
  }
68
68
  }
@@ -63,7 +63,7 @@ void main() {\n\
63
63
  \n\
64
64
  float NdotL = max(dot(V, L), 0.0);\n\
65
65
  if (NdotL > 0.0) {\n\
66
- color += vec4(texture(u_radianceTexture, L).rgb, 1.0) * NdotL;\n\
66
+ color += vec4(czm_textureCube(u_radianceTexture, L).rgb, 1.0) * NdotL;\n\
67
67
  weight += NdotL;\n\
68
68
  }\n\
69
69
  }\n\
@@ -28,6 +28,13 @@ SelectedFeature selectedFeature;
28
28
 
29
29
  void main()
30
30
  {
31
+ #ifdef HAS_POINT_CLOUD_SHOW_STYLE
32
+ if (v_pointCloudShow == 0.0)
33
+ {
34
+ discard;
35
+ }
36
+ #endif
37
+
31
38
  #ifdef HAS_MODEL_SPLITTER
32
39
  modelSplitterStage();
33
40
  #endif
@@ -29,6 +29,13 @@ SelectedFeature selectedFeature;\n\
29
29
  \n\
30
30
  void main()\n\
31
31
  {\n\
32
+ #ifdef HAS_POINT_CLOUD_SHOW_STYLE\n\
33
+ if (v_pointCloudShow == 0.0)\n\
34
+ {\n\
35
+ discard;\n\
36
+ }\n\
37
+ #endif\n\
38
+ \n\
32
39
  #ifdef HAS_MODEL_SPLITTER\n\
33
40
  modelSplitterStage();\n\
34
41
  #endif\n\
@@ -145,5 +145,13 @@ void main()
145
145
  gl_PointSize *= show;
146
146
  #endif
147
147
 
148
- gl_Position = show * positionClip;
148
+ // Important NOT to compute gl_Position = show * positionClip or we hit:
149
+ // https://github.com/CesiumGS/cesium/issues/11270
150
+ //
151
+ // We will discard points with v_pointCloudShow == 0 in the fragment shader.
152
+ gl_Position = positionClip;
153
+
154
+ #ifdef HAS_POINT_CLOUD_SHOW_STYLE
155
+ v_pointCloudShow = show;
156
+ #endif
149
157
  }
@@ -146,6 +146,14 @@ void main()\n\
146
146
  gl_PointSize *= show;\n\
147
147
  #endif\n\
148
148
  \n\
149
- gl_Position = show * positionClip;\n\
149
+ // Important NOT to compute gl_Position = show * positionClip or we hit:\n\
150
+ // https://github.com/CesiumGS/cesium/issues/11270\n\
151
+ //\n\
152
+ // We will discard points with v_pointCloudShow == 0 in the fragment shader.\n\
153
+ gl_Position = positionClip;\n\
154
+ \n\
155
+ #ifdef HAS_POINT_CLOUD_SHOW_STYLE\n\
156
+ v_pointCloudShow = show;\n\
157
+ #endif\n\
150
158
  }\n\
151
159
  ";