@cesium/engine 22.2.0 → 23.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 (282) hide show
  1. package/Build/Workers/{chunk-YFEZPDAY.js → chunk-2GL2EUEE.js} +11 -11
  2. package/Build/Workers/{chunk-A3NUMZBG.js → chunk-2WI4HGJU.js} +6 -6
  3. package/Build/Workers/{chunk-3JB2X2PR.js → chunk-36LBFITA.js} +665 -366
  4. package/Build/Workers/{chunk-VSZ5DB2W.js → chunk-3B65YFXC.js} +1 -1
  5. package/Build/Workers/{chunk-PSHZAHFE.js → chunk-4LGFX2P5.js} +11 -11
  6. package/Build/Workers/{chunk-AMWXJ5A7.js → chunk-4UNQX2MP.js} +2 -2
  7. package/Build/Workers/{chunk-LDSQMLRC.js → chunk-52K3GJKG.js} +3 -3
  8. package/Build/Workers/{chunk-MSTAVM2N.js → chunk-56OHFSLH.js} +10 -10
  9. package/Build/Workers/{chunk-IWOSJVFQ.js → chunk-5A7YSAXT.js} +14 -14
  10. package/Build/Workers/{chunk-PMDPP22G.js → chunk-5JP5FG7U.js} +7 -7
  11. package/Build/Workers/{chunk-DIJ7IG5D.js → chunk-5R7SBUTW.js} +10 -10
  12. package/Build/Workers/chunk-5VKZVPO5.js +1829 -0
  13. package/Build/Workers/{chunk-L2FSBEW2.js → chunk-6FVFM2KB.js} +5 -5
  14. package/Build/Workers/{chunk-G6WQA27G.js → chunk-6SLGTBB2.js} +5 -5
  15. package/Build/Workers/{chunk-3HUEBDFC.js → chunk-7KRN6JPQ.js} +14 -14
  16. package/Build/Workers/{chunk-GMHDOQPH.js → chunk-AA33B6PU.js} +4 -4
  17. package/Build/Workers/{chunk-7CDQUIP5.js → chunk-AP6XWET5.js} +8 -8
  18. package/Build/Workers/{chunk-IVN5HSOI.js → chunk-APDKMX7W.js} +6 -6
  19. package/Build/Workers/{chunk-72LZ3FN6.js → chunk-ARCFIOKA.js} +12 -12
  20. package/Build/Workers/{chunk-UBJYWGMV.js → chunk-BNBD2YZK.js} +16 -16
  21. package/Build/Workers/{chunk-VGH2CSC7.js → chunk-DT5SJBKA.js} +29 -15
  22. package/Build/Workers/{chunk-ED4UXMYY.js → chunk-ESD4IEOU.js} +5 -5
  23. package/Build/Workers/{chunk-JFN2DQHY.js → chunk-FSDVXW7M.js} +5 -5
  24. package/Build/Workers/{chunk-JERDRSEI.js → chunk-G3YT7M7A.js} +1 -1
  25. package/Build/Workers/{chunk-NY3CWLIZ.js → chunk-GN5NEUDT.js} +8 -8
  26. package/Build/Workers/{chunk-O3GWUTWM.js → chunk-HYLEKKO5.js} +1 -1
  27. package/Build/Workers/{chunk-64PJ4MTB.js → chunk-HYTFXWMY.js} +7 -7
  28. package/Build/Workers/{chunk-FPRM6PCE.js → chunk-IFA7VHHP.js} +560 -306
  29. package/Build/Workers/{chunk-FM5XPC2E.js → chunk-IYVDOB5V.js} +4 -4
  30. package/Build/Workers/{chunk-P7ISUYLW.js → chunk-JUGY5AZN.js} +4 -4
  31. package/Build/Workers/{chunk-JONWM4IO.js → chunk-KPYU6YZG.js} +1 -1
  32. package/Build/Workers/{chunk-JUOSYFXT.js → chunk-L7RDJ4V7.js} +1 -1
  33. package/Build/Workers/{chunk-MWGB6DLR.js → chunk-LDQWNMEC.js} +1 -1
  34. package/Build/Workers/{chunk-C6FTHSJA.js → chunk-MQJG522T.js} +6 -6
  35. package/Build/Workers/{chunk-WH4HDRGN.js → chunk-MT5M7RLZ.js} +2 -2
  36. package/Build/Workers/{chunk-4ZQN7M7E.js → chunk-N4AWE7TZ.js} +10 -10
  37. package/Build/Workers/{chunk-SDUH3N6G.js → chunk-NAYRNPEP.js} +4 -4
  38. package/Build/Workers/{chunk-7OPRTZBT.js → chunk-NNHU33JK.js} +7 -7
  39. package/Build/Workers/{chunk-CQCEPC6N.js → chunk-NQCAZU7S.js} +13 -13
  40. package/Build/Workers/{chunk-35J4D6PX.js → chunk-NUYLNQKV.js} +2 -2
  41. package/Build/Workers/{chunk-I45CATZK.js → chunk-OC6X22PG.js} +9 -9
  42. package/Build/Workers/{chunk-7MGTX4WP.js → chunk-OHBM4YG4.js} +12 -12
  43. package/Build/Workers/{chunk-DCR62BCO.js → chunk-OMXN7YF4.js} +12 -12
  44. package/Build/Workers/{chunk-XPNY2VY3.js → chunk-OQ3EAJNW.js} +2 -2
  45. package/Build/Workers/{chunk-4I7BCCNU.js → chunk-OQBPOKPZ.js} +6 -6
  46. package/Build/Workers/{chunk-2JNPWPLE.js → chunk-PQVNT5CJ.js} +6 -6
  47. package/Build/Workers/{chunk-K64RQCRK.js → chunk-QA24Q62E.js} +17 -17
  48. package/Build/Workers/{chunk-K6BXEBAF.js → chunk-QQX7S5QT.js} +17 -17
  49. package/Build/Workers/{chunk-2YVTOY5Z.js → chunk-QTOHIXGF.js} +10 -10
  50. package/Build/Workers/{chunk-4MCPC4TE.js → chunk-R7M4XNPP.js} +8 -8
  51. package/Build/Workers/{chunk-C35SJ4QP.js → chunk-SGKTBHFQ.js} +13 -13
  52. package/Build/Workers/{chunk-BKYJBTHW.js → chunk-SQTRWKO2.js} +5 -5
  53. package/Build/Workers/{chunk-I4D5IP46.js → chunk-T43FXHNC.js} +7 -7
  54. package/Build/Workers/{chunk-QO6Z5UJE.js → chunk-UEEGWJJP.js} +2 -2
  55. package/Build/Workers/{chunk-ZUWF63QU.js → chunk-WKXDCVBO.js} +4 -4
  56. package/Build/Workers/{chunk-N5MNKWED.js → chunk-Y5AJSEEN.js} +2 -2
  57. package/Build/Workers/{chunk-V26Y7ZQL.js → chunk-ZIW5FCIW.js} +37 -27
  58. package/Build/Workers/combineGeometry.js +24 -24
  59. package/Build/Workers/createBoxGeometry.js +18 -18
  60. package/Build/Workers/createBoxOutlineGeometry.js +16 -16
  61. package/Build/Workers/createCircleGeometry.js +26 -26
  62. package/Build/Workers/createCircleOutlineGeometry.js +19 -19
  63. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
  64. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
  65. package/Build/Workers/createCorridorGeometry.js +29 -29
  66. package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
  67. package/Build/Workers/createCylinderGeometry.js +20 -20
  68. package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
  69. package/Build/Workers/createEllipseGeometry.js +26 -26
  70. package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
  71. package/Build/Workers/createEllipsoidGeometry.js +19 -19
  72. package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
  73. package/Build/Workers/createFrustumGeometry.js +18 -18
  74. package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
  75. package/Build/Workers/createGeometry.js +24 -24
  76. package/Build/Workers/createGroundPolylineGeometry.js +22 -22
  77. package/Build/Workers/createPlaneGeometry.js +16 -16
  78. package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
  79. package/Build/Workers/createPolygonGeometry.js +32 -32
  80. package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
  81. package/Build/Workers/createPolylineGeometry.js +25 -25
  82. package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
  83. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
  84. package/Build/Workers/createRectangleGeometry.js +27 -27
  85. package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
  86. package/Build/Workers/createSimplePolylineGeometry.js +23 -23
  87. package/Build/Workers/createSphereGeometry.js +19 -19
  88. package/Build/Workers/createSphereOutlineGeometry.js +18 -18
  89. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  90. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  91. package/Build/Workers/createVectorTileGeometries.js +24 -24
  92. package/Build/Workers/createVectorTilePoints.js +13 -13
  93. package/Build/Workers/createVectorTilePolygons.js +22 -22
  94. package/Build/Workers/createVectorTilePolylines.js +14 -14
  95. package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
  96. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
  97. package/Build/Workers/createVerticesFromHeightmap.js +22 -22
  98. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
  99. package/Build/Workers/createWallGeometry.js +24 -24
  100. package/Build/Workers/createWallOutlineGeometry.js +23 -23
  101. package/Build/Workers/decodeDraco.js +10 -10
  102. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  103. package/Build/Workers/decodeI3S.js +10 -10
  104. package/Build/Workers/gaussianSplatSorter.js +4 -4
  105. package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
  106. package/Build/Workers/incrementallyBuildTerrainPicker.js +20 -12
  107. package/Build/Workers/transcodeKTX2.js +6 -6
  108. package/Build/Workers/transferTypedArrayTest.js +1 -1
  109. package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
  110. package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
  111. package/Source/Core/AttributeCompression.js +53 -6
  112. package/Source/Core/BoxGeometry.js +1 -1
  113. package/Source/Core/Cartesian2.js +689 -684
  114. package/Source/Core/Cartesian3.js +1044 -1043
  115. package/Source/Core/Cartesian4.js +816 -813
  116. package/Source/Core/CornerType.js +1 -1
  117. package/Source/Core/CorridorGeometry.js +1 -1
  118. package/Source/Core/FeatureDetection.js +1 -32
  119. package/Source/Core/Geometry.js +1 -1
  120. package/Source/Core/GoogleMaps.js +23 -2
  121. package/Source/Core/IntersectionTests.js +2 -2
  122. package/Source/Core/Ion.js +1 -1
  123. package/Source/Core/OpenCageGeocoderService.js +2 -3
  124. package/Source/Core/PinBuilder.js +1 -1
  125. package/Source/Core/PolygonGeometry.js +1 -1
  126. package/Source/Core/PolylineGeometry.js +1 -1
  127. package/Source/Core/PolylineVolumeGeometry.js +1 -1
  128. package/Source/Core/RectangleGeometry.js +1 -1
  129. package/Source/Core/ScreenSpaceEventHandler.js +4 -8
  130. package/Source/Core/TerrainMesh.js +11 -8
  131. package/Source/Core/TerrainPicker.js +24 -7
  132. package/Source/Core/VideoSynchronizer.js +1 -1
  133. package/Source/Core/WallGeometry.js +1 -1
  134. package/Source/Core/globalTypes.js +16 -0
  135. package/Source/Core/writeTextToCanvas.js +40 -86
  136. package/Source/DataSources/BillboardGraphics.js +1 -1
  137. package/Source/DataSources/BoxGraphics.js +1 -1
  138. package/Source/DataSources/CallbackPositionProperty.js +1 -1
  139. package/Source/DataSources/CorridorGraphics.js +1 -1
  140. package/Source/DataSources/CzmlDataSource.js +1 -1
  141. package/Source/DataSources/EllipseGraphics.js +1 -1
  142. package/Source/DataSources/EllipsoidGraphics.js +1 -1
  143. package/Source/DataSources/Entity.js +1 -1
  144. package/Source/DataSources/EntityCluster.js +2 -2
  145. package/Source/DataSources/GeoJsonDataSource.js +2 -2
  146. package/Source/DataSources/GpxDataSource.js +1 -1
  147. package/Source/DataSources/KmlDataSource.js +1 -1
  148. package/Source/DataSources/KmlTour.js +1 -1
  149. package/Source/DataSources/LabelGraphics.js +1 -1
  150. package/Source/DataSources/ModelGraphics.js +1 -1
  151. package/Source/DataSources/PlaneGraphics.js +1 -1
  152. package/Source/DataSources/PolygonGraphics.js +1 -1
  153. package/Source/DataSources/PolylineGraphics.js +1 -1
  154. package/Source/DataSources/PolylineVolumeGraphics.js +1 -1
  155. package/Source/DataSources/RectangleGraphics.js +1 -1
  156. package/Source/DataSources/WallGraphics.js +1 -1
  157. package/Source/DataSources/exportKml.js +1 -1
  158. package/Source/Renderer/Context.js +11 -10
  159. package/Source/Renderer/ContextLimits.js +66 -33
  160. package/Source/Renderer/ShaderDestination.js +54 -13
  161. package/Source/Renderer/ShaderSource.js +19 -18
  162. package/Source/Renderer/Texture.js +1 -1
  163. package/Source/Renderer/Texture3D.js +166 -7
  164. package/Source/Renderer/TextureAtlas.js +2 -2
  165. package/Source/Scene/Appearance.js +1 -1
  166. package/Source/Scene/ArcGisMapService.js +1 -1
  167. package/Source/Scene/Billboard.js +8 -5
  168. package/Source/Scene/BillboardCollection.js +65 -26
  169. package/Source/Scene/BillboardTexture.js +4 -1
  170. package/Source/Scene/BufferLoader.js +65 -74
  171. package/Source/Scene/Camera.js +13 -2
  172. package/Source/Scene/ClippingPlaneCollection.js +2 -2
  173. package/Source/Scene/CloudCollection.js +2 -2
  174. package/Source/Scene/CubeMapPanorama.js +351 -0
  175. package/Source/Scene/CumulusCloud.js +1 -1
  176. package/Source/Scene/DerivedCommand.js +8 -31
  177. package/Source/Scene/DracoLoader.js +79 -78
  178. package/Source/Scene/DynamicEnvironmentMapManager.js +41 -26
  179. package/Source/Scene/EquirectangularPanorama.js +264 -0
  180. package/Source/Scene/Fog.js +1 -1
  181. package/Source/Scene/FrameState.js +7 -0
  182. package/Source/Scene/GaussianSplatPrimitive.js +907 -168
  183. package/Source/Scene/Globe.js +3 -10
  184. package/Source/Scene/GlobeSurfaceShaderSet.js +36 -32
  185. package/Source/Scene/GltfBufferViewLoader.js +109 -118
  186. package/Source/Scene/GltfDracoLoader.js +167 -176
  187. package/Source/Scene/GltfImageLoader.js +91 -101
  188. package/Source/Scene/GltfIndexBufferLoader.js +228 -241
  189. package/Source/Scene/GltfJsonLoader.js +90 -99
  190. package/Source/Scene/GltfLoader.js +323 -324
  191. package/Source/Scene/GltfSpzLoader.js +127 -134
  192. package/Source/Scene/GltfStructuralMetadataLoader.js +181 -186
  193. package/Source/Scene/GltfTextureLoader.js +217 -231
  194. package/Source/Scene/GltfVertexBufferLoader.js +267 -276
  195. package/Source/Scene/GoogleStreetViewCubeMapPanoramaProvider.js +341 -0
  196. package/Source/Scene/ImageBasedLighting.js +2 -2
  197. package/Source/Scene/ImageryLayerCollection.js +2 -2
  198. package/Source/Scene/ImageryProvider.js +2 -2
  199. package/Source/Scene/Label.js +7 -5
  200. package/Source/Scene/LabelCollection.js +60 -2
  201. package/Source/Scene/Material.js +1 -1
  202. package/Source/Scene/MaterialAppearance.js +1 -1
  203. package/Source/Scene/Megatexture.js +174 -242
  204. package/Source/Scene/MetadataClassProperty.js +212 -7
  205. package/Source/Scene/MetadataComponentType.js +162 -127
  206. package/Source/Scene/MetadataSchemaLoader.js +60 -67
  207. package/Source/Scene/MetadataTable.js +14 -0
  208. package/Source/Scene/MetadataTableProperty.js +14 -0
  209. package/Source/Scene/Model/B3dmLoader.js +216 -224
  210. package/Source/Scene/Model/CustomShader.js +6 -1
  211. package/Source/Scene/Model/CustomShaderPipelineStage.js +122 -7
  212. package/Source/Scene/Model/GeoJsonLoader.js +53 -61
  213. package/Source/Scene/Model/GeometryPipelineStage.js +17 -3
  214. package/Source/Scene/Model/I3dmLoader.js +232 -240
  215. package/Source/Scene/Model/MaterialPipelineStage.js +17 -0
  216. package/Source/Scene/Model/MetadataPipelineStage.js +438 -22
  217. package/Source/Scene/Model/Model.js +1 -1
  218. package/Source/Scene/Model/PntsLoader.js +78 -89
  219. package/Source/Scene/ModelComponents.js +10 -0
  220. package/Source/Scene/Panorama.js +53 -0
  221. package/Source/Scene/PanoramaProvider.js +43 -0
  222. package/Source/Scene/ParticleSystem.js +2 -2
  223. package/Source/Scene/PointPrimitive.js +1 -1
  224. package/Source/Scene/PointPrimitiveCollection.js +14 -22
  225. package/Source/Scene/Polyline.js +0 -1
  226. package/Source/Scene/PolylineCollection.js +1 -4
  227. package/Source/Scene/PolylineColorAppearance.js +1 -6
  228. package/Source/Scene/PolylineMaterialAppearance.js +1 -6
  229. package/Source/Scene/PostProcessStageCollection.js +1 -1
  230. package/Source/Scene/PropertyTable.js +43 -0
  231. package/Source/Scene/PropertyTexture.js +1 -1
  232. package/Source/Scene/PropertyTextureProperty.js +0 -97
  233. package/Source/Scene/QuadtreePrimitive.js +6 -3
  234. package/Source/Scene/ResourceLoader.js +84 -92
  235. package/Source/Scene/Scene.js +12 -0
  236. package/Source/Scene/ShadowMap.js +1 -2
  237. package/Source/Scene/SkyBox.js +29 -164
  238. package/Source/Scene/StructuralMetadata.js +18 -3
  239. package/Source/Scene/Vector3DTileClampedPolylines.js +1 -5
  240. package/Source/Scene/Vector3DTilePolylines.js +1 -5
  241. package/Source/Scene/VoxelPrimitive.js +16 -33
  242. package/Source/Scene/VoxelRenderResources.js +1 -8
  243. package/Source/Scene/VoxelTraversal.js +16 -61
  244. package/Source/Scene/WebMapTileServiceImageryProvider.js +1 -1
  245. package/Source/Scene/createElevationBandMaterial.js +1 -1
  246. package/Source/Scene/parseStructuralMetadata.js +244 -0
  247. package/Source/Scene/processVoxelProperties.js +1 -1
  248. package/Source/Shaders/BillboardCollectionFS.glsl +66 -40
  249. package/Source/Shaders/BillboardCollectionFS.js +67 -40
  250. package/Source/Shaders/BillboardCollectionVS.glsl +22 -31
  251. package/Source/Shaders/BillboardCollectionVS.js +22 -31
  252. package/Source/Shaders/Builtin/CzmBuiltins.js +4 -0
  253. package/Source/Shaders/Builtin/Functions/columbusViewMorph.glsl +8 -1
  254. package/Source/Shaders/Builtin/Functions/columbusViewMorph.js +8 -1
  255. package/Source/Shaders/Builtin/Functions/decodeRGB8.glsl +22 -0
  256. package/Source/Shaders/Builtin/Functions/decodeRGB8.js +24 -0
  257. package/Source/Shaders/Builtin/Functions/unpackTexture.glsl +35 -0
  258. package/Source/Shaders/Builtin/Functions/unpackTexture.js +37 -0
  259. package/Source/Shaders/CubeMapPanoramaVS.glsl +11 -0
  260. package/Source/Shaders/CubeMapPanoramaVS.js +13 -0
  261. package/Source/Shaders/Model/MetadataStageFS.glsl +2 -1
  262. package/Source/Shaders/Model/MetadataStageFS.js +2 -1
  263. package/Source/Shaders/Model/MetadataStageVS.glsl +2 -1
  264. package/Source/Shaders/Model/MetadataStageVS.js +2 -1
  265. package/Source/Shaders/Model/ModelFS.glsl +9 -1
  266. package/Source/Shaders/Model/ModelFS.js +9 -1
  267. package/Source/Shaders/Model/ModelVS.glsl +4 -2
  268. package/Source/Shaders/Model/ModelVS.js +4 -2
  269. package/Source/Shaders/PointPrimitiveCollectionVS.glsl +8 -39
  270. package/Source/Shaders/PointPrimitiveCollectionVS.js +8 -39
  271. package/Source/Shaders/Voxels/IntersectionUtils.glsl +1 -1
  272. package/Source/Shaders/Voxels/IntersectionUtils.js +1 -1
  273. package/Source/Shaders/Voxels/Megatexture.glsl +15 -83
  274. package/Source/Shaders/Voxels/Megatexture.js +15 -83
  275. package/Source/Shaders/Voxels/Octree.glsl +6 -9
  276. package/Source/Shaders/Voxels/Octree.js +6 -9
  277. package/Source/Widget/CesiumWidget.js +1 -1
  278. package/Source/Workers/incrementallyBuildTerrainPicker.js +16 -2
  279. package/index.d.ts +582 -193
  280. package/index.js +91 -83
  281. package/package.json +2 -1
  282. package/Build/Workers/chunk-ZGWX2R5I.js +0 -1443
@@ -1,5 +1,7 @@
1
1
  import Matrix3 from "../../Core/Matrix3.js";
2
+ import PrimitiveType from "../../Core/PrimitiveType.js";
2
3
  import defined from "../../Core/defined.js";
4
+ import oneTimeWarning from "../../Core/oneTimeWarning.js";
3
5
  import ShaderDestination from "../../Renderer/ShaderDestination.js";
4
6
  import MetadataStageFS from "../../Shaders/Model/MetadataStageFS.js";
5
7
  import MetadataStageVS from "../../Shaders/Model/MetadataStageVS.js";
@@ -34,7 +36,7 @@ const MetadataPipelineStage = {
34
36
  FUNCTION_ID_INITIALIZE_METADATA_VS: "initializeMetadataVS",
35
37
  FUNCTION_ID_INITIALIZE_METADATA_FS: "initializeMetadataFS",
36
38
  FUNCTION_SIGNATURE_INITIALIZE_METADATA:
37
- "void initializeMetadata(out Metadata metadata, out MetadataClass metadataClass, out MetadataStatistics metadataStatistics, ProcessedAttributes attributes)",
39
+ "void initializeMetadata(FeatureIds featureIds, out Metadata metadata, out MetadataClass metadataClass, out MetadataStatistics metadataStatistics, ProcessedAttributes attributes)",
38
40
  FUNCTION_ID_SET_METADATA_VARYINGS: "setMetadataVaryings",
39
41
  FUNCTION_SIGNATURE_SET_METADATA_VARYINGS: "void setMetadataVaryings()",
40
42
 
@@ -85,6 +87,11 @@ MetadataPipelineStage.process = function (
85
87
  const { shaderBuilder, model } = renderResources;
86
88
  const { structuralMetadata = {}, content } = model;
87
89
  const statistics = content?.tileset.metadataExtension?.statistics;
90
+ const webgl2 = frameState.context.webgl2;
91
+ const usedMetadataProperties = collectMetadataUsedByOtherStages(
92
+ model,
93
+ primitive,
94
+ );
88
95
 
89
96
  const propertyAttributesInfo = getPropertyAttributesInfo(
90
97
  structuralMetadata.propertyAttributes,
@@ -95,9 +102,18 @@ MetadataPipelineStage.process = function (
95
102
  structuralMetadata.propertyTextures,
96
103
  statistics,
97
104
  );
105
+ const propertyTablesInfo = getPropertyTablesInfo(
106
+ structuralMetadata.propertyTables,
107
+ primitive,
108
+ renderResources,
109
+ statistics,
110
+ usedMetadataProperties,
111
+ );
98
112
 
99
113
  // Declare <type>MetadataClass and <type>MetadataStatistics structs as needed
100
- const allPropertyInfos = propertyAttributesInfo.concat(propertyTexturesInfo);
114
+ const allPropertyInfos = propertyAttributesInfo
115
+ .concat(propertyTexturesInfo)
116
+ .concat(propertyTablesInfo);
101
117
  declareMetadataTypeStructs(shaderBuilder, allPropertyInfos);
102
118
 
103
119
  // Always declare the Metadata, MetadataClass, and MetadataStatistics structs
@@ -112,7 +128,11 @@ MetadataPipelineStage.process = function (
112
128
  }
113
129
  for (let i = 0; i < propertyTexturesInfo.length; i++) {
114
130
  const info = propertyTexturesInfo[i];
115
- processPropertyTextureProperty(renderResources, info);
131
+ processPropertyTextureProperty(renderResources, info, webgl2);
132
+ }
133
+ for (let i = 0; i < propertyTablesInfo.length; i++) {
134
+ const info = propertyTablesInfo[i];
135
+ processPropertyTableProperty(renderResources, info, webgl2);
116
136
  }
117
137
  };
118
138
 
@@ -122,6 +142,7 @@ MetadataPipelineStage.process = function (
122
142
  * @param {PropertyAttribute[]} propertyAttributes The PropertyAttributes with properties to be described
123
143
  * @param {ModelComponents.Primitive} primitive The primitive to be rendered
124
144
  * @param {object} [statistics] Statistics about the properties (if the model is from a 3DTiles tileset)
145
+ * @param {object} usedMetadataProperties Metadata properties used in the primitive's shader by other stages
125
146
  * @returns {object[]} An array of objects containing information about each PropertyAttributeProperty
126
147
  * @private
127
148
  */
@@ -160,6 +181,7 @@ function getPropertyAttributeInfo(propertyAttribute, primitive, statistics) {
160
181
  infoArray[i] = {
161
182
  metadataVariable: sanitizeGlslIdentifier(propertyId),
162
183
  property,
184
+ classProperty: property.classProperty,
163
185
  type: property.classProperty.type,
164
186
  glslType,
165
187
  variableName,
@@ -202,7 +224,10 @@ function getPropertyTextureInfo(propertyTexture, statistics) {
202
224
  const classStatistics = statistics?.classes[classId];
203
225
 
204
226
  const propertiesArray = Object.entries(propertyTexture.properties).filter(
205
- ([id, property]) => property.isGpuCompatible(),
227
+ ([id, property]) => {
228
+ const numChannels = property.textureReader.channels.length;
229
+ return property.classProperty.isGpuCompatible(numChannels);
230
+ },
206
231
  );
207
232
  const infoArray = new Array(propertiesArray.length);
208
233
 
@@ -212,8 +237,9 @@ function getPropertyTextureInfo(propertyTexture, statistics) {
212
237
  infoArray[i] = {
213
238
  metadataVariable: sanitizeGlslIdentifier(propertyId),
214
239
  property,
240
+ classProperty: property.classProperty,
215
241
  type: property.classProperty.type,
216
- glslType: property.getGlslType(),
242
+ glslType: property.classProperty.getGlslType(),
217
243
  propertyStatistics: classStatistics?.properties[propertyId],
218
244
  shaderDestination: ShaderDestination.FRAGMENT,
219
245
  };
@@ -222,10 +248,177 @@ function getPropertyTextureInfo(propertyTexture, statistics) {
222
248
  return infoArray;
223
249
  }
224
250
 
251
+ const NUM_CHANNELS = 4; // use all channels for property table textures
252
+
253
+ function getPropertyTablesInfo(
254
+ propertyTables,
255
+ primitive,
256
+ renderResources,
257
+ statistics,
258
+ usedMetadataProperties,
259
+ ) {
260
+ if (!defined(propertyTables)) {
261
+ return [];
262
+ }
263
+
264
+ // Each feature ID set can reference a property table.
265
+ // For a given primitive, as we have here, the mapping is 1:1.
266
+ // (This isn't strictly enforced in the EXT_mesh_features schema, but would be considered ill-formed and ambiguous.
267
+ // There _is_ a way to specify which featureID set to use for picking and styling in the Cesium3DTileset API, which we may want to respect here in the future).
268
+ const tableToFeatureSetInfo = mapPropertyTablesToFeatureIdSets(
269
+ renderResources,
270
+ primitive,
271
+ );
272
+
273
+ return propertyTables
274
+ .filter(
275
+ (propertyTable) =>
276
+ defined(propertyTable.class) &&
277
+ tableToFeatureSetInfo.has(String(propertyTable.id)),
278
+ )
279
+ .flatMap((propertyTable) =>
280
+ getPropertyTableInfo(
281
+ propertyTable,
282
+ tableToFeatureSetInfo,
283
+ statistics,
284
+ usedMetadataProperties,
285
+ ),
286
+ );
287
+ }
288
+
289
+ function getPropertyTableInfo(
290
+ propertyTable,
291
+ tableToFeatureSetInfo,
292
+ statistics,
293
+ usedMetadataProperties,
294
+ ) {
295
+ const { sanitizeGlslIdentifier } = ModelUtility;
296
+
297
+ const classDefinition = propertyTable.class;
298
+ const classStatistics = statistics?.classes[classDefinition.id];
299
+ const featureSetInfo =
300
+ tableToFeatureSetInfo.get(String(propertyTable.id)) ?? {};
301
+
302
+ // Depending on whether the featureIDs are a feature texture or feature attribute,
303
+ // the shader usage may be restricted to a given shader stage.
304
+ const shaderDestination =
305
+ featureSetInfo.shaderDestination ?? ShaderDestination.BOTH;
306
+
307
+ const properties = propertyTable.properties;
308
+ const classProperties = classDefinition.properties;
309
+ const infoArray = [];
310
+
311
+ // This is the per-table index of the property info, which is used to index into the property table texture
312
+ // during a texelFetch.
313
+ let propertyInfoIndex = 0;
314
+
315
+ // See note in {@link parseStructuralMetadata.collectGpuCompatiblePropertyBufferViews} about
316
+ // why we iterate over the class definition properties rather than the property table properties.
317
+ for (const [propertyId, classProperty] of Object.entries(classProperties)) {
318
+ if (!classProperty.isGpuCompatible(NUM_CHANNELS)) {
319
+ continue;
320
+ }
321
+
322
+ // For performance reasons, since property tables can be quite large, only include properties that are used by other pipeline stages in the shader.
323
+ // Note: we could do this for property textures and attributes as well - but since users can call the `pickMetadata`
324
+ // API with an arbitrary metadata property, we'd need to rebuild every model's shaders each time such a call is made. Since property textures
325
+ // and attributes tend to be less numerous than property tables anyway, it's more important to optimize table usage in this way.
326
+ const property = properties[propertyId];
327
+ const propertyShaderDestination = ShaderDestination.intersection(
328
+ propertyDestination(propertyId, usedMetadataProperties),
329
+ shaderDestination,
330
+ );
331
+
332
+ if (propertyShaderDestination === ShaderDestination.NONE) {
333
+ // Still need to increment the index to stay aligned with the rows of the metadata texture.
334
+ // The texture includes metadata whether or not it's used in the shader.
335
+ propertyInfoIndex++;
336
+ continue;
337
+ }
338
+
339
+ infoArray.push({
340
+ metadataVariable: sanitizeGlslIdentifier(propertyId),
341
+ property: property,
342
+ classProperty: classProperty,
343
+ type: classProperty.type,
344
+ glslType: classProperty.getGlslType(),
345
+ propertyStatistics: classStatistics?.properties[propertyId],
346
+ shaderDestination: propertyShaderDestination,
347
+ propertyTable: propertyTable,
348
+ featureIdVariableName: featureSetInfo.variableName,
349
+ propertyInfoIndex: propertyInfoIndex,
350
+ });
351
+
352
+ propertyInfoIndex++;
353
+ }
354
+
355
+ return infoArray;
356
+ }
357
+
225
358
  /**
226
- * Declare <type>MetadataClass structs in the shader for each PropertyAttributeProperty and PropertyTextureProperty
359
+ * Map property tables to feature ID sets for a given primitive. In general, the mapping is not 1:1, but
360
+ * within a given primitive it is safe to treat it as such.
361
+ *
362
+ * @param {PrimitiveRenderResources} renderResources
363
+ * @param {ModelComponents.Primitive} primitive
364
+ * @returns A map from property table ID to an object with the corresponding feature ID set information
365
+ * for the given primitive. (Contains the shader variable name and shader destination.)
366
+ *
367
+ * @private
368
+ */
369
+ function mapPropertyTablesToFeatureIdSets(renderResources, primitive) {
370
+ const propertyTableToFeatureSet = new Map();
371
+
372
+ function addMapEntry(featureIds, shaderDestination) {
373
+ const propertyTableId = featureIds?.propertyTableId;
374
+ if (!defined(propertyTableId)) {
375
+ return;
376
+ }
377
+
378
+ const key = String(propertyTableId);
379
+ const entry = {
380
+ // This is consistent with the variable name given in the feature ID pipeline stage.
381
+ // Aliases can also be used, but this will always be valid.
382
+ variableName: featureIds.positionalLabel,
383
+ shaderDestination: shaderDestination,
384
+ };
385
+
386
+ const existingEntry = propertyTableToFeatureSet.get(key);
387
+ if (defined(existingEntry)) {
388
+ console.warn(
389
+ `Multiple feature ID sets reference the same property table ${propertyTableId} in primitive. Only one will be used.`,
390
+ );
391
+ }
392
+ propertyTableToFeatureSet.set(key, entry);
393
+ }
394
+
395
+ // Collect feature IDs from two sources: the primitive, and instances
396
+ const primitiveFeatureIds = primitive?.featureIds ?? [];
397
+ for (let i = 0; i < primitiveFeatureIds.length; i++) {
398
+ const featureIds = primitiveFeatureIds[i];
399
+ // Textures feature sets are fragment-only
400
+ const isTexture = defined(featureIds?.textureReader);
401
+ addMapEntry(
402
+ featureIds,
403
+ isTexture ? ShaderDestination.FRAGMENT : ShaderDestination.BOTH,
404
+ );
405
+ }
406
+
407
+ // Instance feature IDs (if present)
408
+ const instances = renderResources.runtimeNode?.node?.instances;
409
+ const instanceFeatureIds = instances?.featureIds ?? [];
410
+ for (let i = 0; i < instanceFeatureIds.length; i++) {
411
+ const featureIds = instanceFeatureIds[i];
412
+ addMapEntry(featureIds, ShaderDestination.BOTH);
413
+ }
414
+
415
+ return propertyTableToFeatureSet;
416
+ }
417
+
418
+ /**
419
+ * Declare <type>MetadataClass structs in the shader for each PropertyAttributeProperty, PropertyTextureProperty, and MetadataTableProperty
227
420
  * @param {ShaderBuilder} shaderBuilder The shader builder for the primitive
228
- * @param {object[]} propertyInfos Information about the PropertyAttributeProperties and PropertyTextureProperties
421
+ * @param {object[]} propertyInfos Information about the PropertyAttributeProperties, PropertyTextureProperties, and PropertyTableProperties
229
422
  * @private
230
423
  */
231
424
  function declareMetadataTypeStructs(shaderBuilder, propertyInfos) {
@@ -409,10 +602,11 @@ function addPropertyAttributePropertyMetadata(renderResources, propertyInfo) {
409
602
  * Update the shader for a single PropertyTextureProperty
410
603
  * @param {PrimitiveRenderResources} renderResources The render resources for the primitive
411
604
  * @param {object[]} propertyInfo Info about the PropertyTextureProperty
605
+ * @param {boolean} webgl2 True if the context is WebGL2
412
606
  * @private
413
607
  */
414
- function processPropertyTextureProperty(renderResources, propertyInfo) {
415
- addPropertyTexturePropertyMetadata(renderResources, propertyInfo);
608
+ function processPropertyTextureProperty(renderResources, propertyInfo, webgl2) {
609
+ addPropertyTexturePropertyMetadata(renderResources, propertyInfo, webgl2);
416
610
  addPropertyMetadataClass(renderResources.shaderBuilder, propertyInfo);
417
611
  addPropertyMetadataStatistics(renderResources.shaderBuilder, propertyInfo);
418
612
  }
@@ -422,15 +616,21 @@ function processPropertyTextureProperty(renderResources, propertyInfo) {
422
616
  * initializeMetadata function, for a PropertyTextureProperty
423
617
  * @param {PrimitiveRenderResources} renderResources The render resources for the primitive
424
618
  * @param {object} propertyInfo Info about the PropertyTextureProperty
619
+ * @param {boolean} webgl2 True if the context is WebGL2
425
620
  * @private
426
621
  */
427
- function addPropertyTexturePropertyMetadata(renderResources, propertyInfo) {
622
+ function addPropertyTexturePropertyMetadata(
623
+ renderResources,
624
+ propertyInfo,
625
+ webgl2,
626
+ ) {
428
627
  const { shaderBuilder, uniformMap } = renderResources;
429
628
  const { metadataVariable, glslType, property } = propertyInfo;
430
629
 
431
630
  const { texCoord, channels, index, texture, transform } =
432
631
  property.textureReader;
433
632
  const textureUniformName = `u_propertyTexture_${index}`;
633
+ const initializationLines = [];
434
634
 
435
635
  // Property texture properties may share the same physical texture, so only
436
636
  // add the texture uniform the first time we encounter it.
@@ -473,11 +673,18 @@ function addPropertyTexturePropertyMetadata(renderResources, propertyInfo) {
473
673
  texCoordVariableExpression = `vec2(${transformUniformName} * vec3(${texCoordVariable}, 1.0))`;
474
674
  }
475
675
  const valueExpression = `texture(${textureUniformName}, ${texCoordVariableExpression}).${channels}`;
476
-
477
- // Some types need an unpacking step or two. For example, since texture reads
478
- // are always normalized, UINT8 (not normalized) properties need to be
479
- // un-normalized in the shader.
480
- const unpackedValue = property.unpackInShader(valueExpression);
676
+ const classProperty = property.classProperty;
677
+ let unpackedValue;
678
+ if (webgl2) {
679
+ unpackedValue = classProperty.unpackTextureInShader(
680
+ valueExpression,
681
+ channels,
682
+ metadataVariable,
683
+ initializationLines,
684
+ );
685
+ } else {
686
+ unpackedValue = classProperty.unpackTextureInShaderWebGL1(valueExpression);
687
+ }
481
688
 
482
689
  const transformedValue = addValueTransformUniforms({
483
690
  valueExpression: unpackedValue,
@@ -488,23 +695,24 @@ function addPropertyTexturePropertyMetadata(renderResources, propertyInfo) {
488
695
  property: property,
489
696
  });
490
697
 
491
- const initializationLine = `metadata.${metadataVariable} = ${transformedValue};`;
698
+ const finalAssignment = `metadata.${metadataVariable} = ${transformedValue};`;
699
+ initializationLines.push(finalAssignment);
492
700
  shaderBuilder.addFunctionLines(
493
701
  MetadataPipelineStage.FUNCTION_ID_INITIALIZE_METADATA_FS,
494
- [initializationLine],
702
+ initializationLines,
495
703
  );
496
704
  }
497
705
 
498
706
  /**
499
707
  * Add fields to the MetadataClass struct, and metadataClass value expressions
500
- * to the initializeMetadata function, for a PropertyAttributeProperty or
501
- * PropertyTextureProperty
708
+ * to the initializeMetadata function, for a PropertyAttributeProperty,
709
+ * PropertyTextureProperty, or MetadataTableProperty
502
710
  * @param {ShaderBuilder} shaderBuilder The shader builder for the primitive
503
- * @param {object} propertyInfo Info about the PropertyAttributeProperty or PropertyTextureProperty
711
+ * @param {object} propertyInfo Info about the PropertyAttributeProperty, PropertyTextureProperty, or MetadataTableProperty
504
712
  * @private
505
713
  */
506
714
  function addPropertyMetadataClass(shaderBuilder, propertyInfo) {
507
- const { classProperty } = propertyInfo.property;
715
+ const classProperty = propertyInfo.classProperty;
508
716
  const { metadataVariable, glslType, shaderDestination } = propertyInfo;
509
717
 
510
718
  // Construct assignment statements to set values in the metadataClass struct
@@ -594,6 +802,113 @@ function addPropertyMetadataStatistics(shaderBuilder, propertyInfo) {
594
802
  );
595
803
  }
596
804
 
805
+ function processPropertyTableProperty(renderResources, propertyInfo, webgl2) {
806
+ addPropertyTablePropertyMetadata(renderResources, propertyInfo, webgl2);
807
+ addPropertyMetadataClass(renderResources.shaderBuilder, propertyInfo);
808
+ addPropertyMetadataStatistics(renderResources.shaderBuilder, propertyInfo);
809
+ }
810
+
811
+ function addPropertyTablePropertyMetadata(
812
+ renderResources,
813
+ propertyInfo,
814
+ webgl2,
815
+ ) {
816
+ const { shaderBuilder, uniformMap } = renderResources;
817
+ const {
818
+ metadataVariable,
819
+ glslType,
820
+ property,
821
+ featureIdVariableName,
822
+ propertyTable,
823
+ propertyInfoIndex,
824
+ } = propertyInfo;
825
+
826
+ if (!webgl2) {
827
+ oneTimeWarning(
828
+ "PropertyTableCustomShader",
829
+ "Property table support for custom shaders requires WebGL2.",
830
+ );
831
+ return;
832
+ }
833
+
834
+ if (!defined(featureIdVariableName) || !defined(propertyTable.texture)) {
835
+ return;
836
+ }
837
+
838
+ // For property tables, all properties are packed into a single texture.
839
+ // Thus, the texture identifier is based on the table id.
840
+ const textureUniformName = `u_propertyTableTexture_${propertyTable.id}`;
841
+ const initializationLines = [];
842
+
843
+ if (!uniformMap.hasOwnProperty(textureUniformName)) {
844
+ // Note that, unlike property textures, property table textures are available in both
845
+ // the vertex and fragment shaders. While property textures rely on interpolated UV coords,
846
+ // property table textures generally apply to non-interpolated texel fetches based on (featureId, propertyId).
847
+ shaderBuilder.addUniform(
848
+ "sampler2D",
849
+ textureUniformName,
850
+ ShaderDestination.BOTH,
851
+ );
852
+ uniformMap[textureUniformName] = () => propertyTable.texture;
853
+ }
854
+
855
+ const shaderDestination = propertyInfo.shaderDestination;
856
+ if (ShaderDestination.includesVertexShader(shaderDestination)) {
857
+ shaderBuilder.addStructField(
858
+ MetadataPipelineStage.STRUCT_ID_METADATA_VS,
859
+ glslType,
860
+ metadataVariable,
861
+ );
862
+ }
863
+
864
+ if (ShaderDestination.includesFragmentShader(shaderDestination)) {
865
+ shaderBuilder.addStructField(
866
+ MetadataPipelineStage.STRUCT_ID_METADATA_FS,
867
+ glslType,
868
+ metadataVariable,
869
+ );
870
+ }
871
+
872
+ const featureIdExpression = `featureIds.${featureIdVariableName}`;
873
+ const texCoordExpression = `ivec2(${featureIdExpression}, ${propertyInfoIndex})`;
874
+ const textureSampleExpression = `texelFetch(${textureUniformName}, ${texCoordExpression}, 0)`;
875
+ const classProperty = propertyInfo.classProperty;
876
+
877
+ const unpackedVariable = classProperty.unpackTextureInShader(
878
+ textureSampleExpression,
879
+ `rgba`,
880
+ metadataVariable,
881
+ initializationLines,
882
+ );
883
+
884
+ const transformedValue = addValueTransformUniforms({
885
+ valueExpression: unpackedVariable,
886
+ renderResources: renderResources,
887
+ glslType: glslType,
888
+ metadataVariable: metadataVariable,
889
+ shaderDestination: shaderDestination,
890
+ // If the property is on the schema but not used by this primitive, value transforms come from class schema property
891
+ property: property ?? classProperty,
892
+ });
893
+
894
+ const finalAssignment = `metadata.${metadataVariable} = ${transformedValue};`;
895
+ initializationLines.push(finalAssignment);
896
+
897
+ if (ShaderDestination.includesVertexShader(shaderDestination)) {
898
+ shaderBuilder.addFunctionLines(
899
+ MetadataPipelineStage.FUNCTION_ID_INITIALIZE_METADATA_VS,
900
+ initializationLines,
901
+ );
902
+ }
903
+
904
+ if (ShaderDestination.includesFragmentShader(shaderDestination)) {
905
+ shaderBuilder.addFunctionLines(
906
+ MetadataPipelineStage.FUNCTION_ID_INITIALIZE_METADATA_FS,
907
+ initializationLines,
908
+ );
909
+ }
910
+ }
911
+
597
912
  /**
598
913
  * Construct GLSL assignment statements to set metadata spec values in a struct
599
914
  * @param {object[]} fieldNames An object with the following properties:
@@ -609,6 +924,8 @@ function getStructAssignments(fieldNames, values, struct, type) {
609
924
  function constructAssignment(field) {
610
925
  const value = values[field.specName];
611
926
  if (defined(value)) {
927
+ // Note: template literals will coerce arrays to strings, if needed (e.g. if the metadata type is a vecN or an array, or even an array of vecN)
928
+ // In any case, the resulting string ends up as a flattened, comma-separated list. For example: [[1,2], [3,4]] will end up as vec4(1,2,3,4), which is valid GLSL.
612
929
  return `${struct}.${field.shaderName} = ${type}(${value});`;
613
930
  }
614
931
  }
@@ -627,7 +944,7 @@ function getStructAssignments(fieldNames, values, struct, type) {
627
944
  * @param {string} options.glslType The GLSL type of the variable
628
945
  * @param {ShaderDestination} options.shaderDestination Which shader(s) use this variable
629
946
  * @param {PrimitiveRenderResources} options.renderResources The render resources for this primitive
630
- * @param {(PropertyAttributeProperty|PropertyTextureProperty)} options.property The property from which the value is derived
947
+ * @param {(PropertyAttributeProperty|PropertyTextureProperty|MetadataTableProperty|MetadataClassProperty)} options.property The property from which the value is derived
631
948
  * @returns {string} A wrapped GLSL value expression
632
949
  * @private
633
950
  */
@@ -647,6 +964,8 @@ function addValueTransformUniforms(options) {
647
964
  shaderBuilder.addUniform(glslType, offsetUniformName, shaderDestination);
648
965
  shaderBuilder.addUniform(glslType, scaleUniformName, shaderDestination);
649
966
 
967
+ // Note: if property is an instance of MetadataClassProperty, offset and scale will be the default values set on the class definition.
968
+ // Otherwise, the spec allows them to be overridden per-property instance.
650
969
  const { offset, scale } = property;
651
970
  uniformMap[offsetUniformName] = () => offset;
652
971
  uniformMap[scaleUniformName] = () => scale;
@@ -654,4 +973,101 @@ function addValueTransformUniforms(options) {
654
973
  return `czm_valueTransform(${offsetUniformName}, ${scaleUniformName}, ${valueExpression})`;
655
974
  }
656
975
 
976
+ function collectMetadataUsedByOtherStages(model, primitive) {
977
+ const usedInVertex = new Set();
978
+ const usedInFragment = new Set();
979
+
980
+ collectMetadataUsedInCustomShader(model, usedInVertex, usedInFragment);
981
+ collectMetadataUsedInPointCloudStyling(
982
+ model,
983
+ primitive,
984
+ usedInVertex,
985
+ usedInFragment,
986
+ );
987
+
988
+ return {
989
+ usedInVertex,
990
+ usedInFragment,
991
+ };
992
+ }
993
+
994
+ function collectMetadataUsedInCustomShader(
995
+ model,
996
+ usedInVertex,
997
+ usedInFragment,
998
+ ) {
999
+ const customShader = model.customShader;
1000
+ if (!defined(customShader)) {
1001
+ return;
1002
+ }
1003
+
1004
+ const fragmentMetadataSet =
1005
+ customShader.usedVariablesFragment?.metadataSet ?? {};
1006
+ for (const propertyId in fragmentMetadataSet) {
1007
+ if (fragmentMetadataSet.hasOwnProperty(propertyId)) {
1008
+ usedInFragment.add(propertyId);
1009
+ }
1010
+ }
1011
+
1012
+ const vertexMetadataSet = customShader.usedVariablesVertex?.metadataSet ?? {};
1013
+ for (const propertyId in vertexMetadataSet) {
1014
+ if (vertexMetadataSet.hasOwnProperty(propertyId)) {
1015
+ usedInVertex.add(propertyId);
1016
+ }
1017
+ }
1018
+ }
1019
+
1020
+ function collectMetadataUsedInPointCloudStyling(
1021
+ model,
1022
+ primitive,
1023
+ usedInVertex,
1024
+ usedInFragment,
1025
+ ) {
1026
+ const style = model.style;
1027
+ const hasPointCloudStyle =
1028
+ defined(style) && primitive.primitiveType === PrimitiveType.POINTS;
1029
+ if (!hasPointCloudStyle) {
1030
+ return;
1031
+ }
1032
+
1033
+ const colorVariables = style.color?.getVariables() ?? [];
1034
+ for (const propertyId of colorVariables) {
1035
+ usedInVertex.add(propertyId);
1036
+ usedInFragment.add(propertyId);
1037
+ }
1038
+
1039
+ const showVariables = style.show?.getVariables() ?? [];
1040
+ for (const propertyId of showVariables) {
1041
+ usedInVertex.add(propertyId);
1042
+ usedInFragment.add(propertyId);
1043
+ }
1044
+
1045
+ // Only used in vertex shader
1046
+ const pointSizeVariables = style.pointSize?.getVariables() ?? [];
1047
+ for (const propertyId of pointSizeVariables) {
1048
+ usedInVertex.add(propertyId);
1049
+ }
1050
+ }
1051
+
1052
+ /**
1053
+ * Determines the shader destination(s) for a given property based on its use in other pipeline stages.
1054
+ *
1055
+ * @param {object} propertyId The ID of the property to check
1056
+ * @param {object} usedMetadataProperties Metadata properties used in the primitive's shader by other stages
1057
+ * @returns {ShaderDestination} The shader destination(s) for the property
1058
+ * @private
1059
+ */
1060
+ function propertyDestination(propertyId, usedMetadataProperties) {
1061
+ const fragmentDestination = usedMetadataProperties.usedInFragment.has(
1062
+ propertyId,
1063
+ )
1064
+ ? ShaderDestination.FRAGMENT
1065
+ : ShaderDestination.NONE;
1066
+ const vertexDestination = usedMetadataProperties.usedInVertex.has(propertyId)
1067
+ ? ShaderDestination.VERTEX
1068
+ : ShaderDestination.NONE;
1069
+
1070
+ return ShaderDestination.union(fragmentDestination, vertexDestination);
1071
+ }
1072
+
657
1073
  export default MetadataPipelineStage;
@@ -175,7 +175,7 @@ import ModelImagery from "./ModelImagery.js";
175
175
  *
176
176
  * @see Model.fromGltfAsync
177
177
  *
178
- * @demo {@link https://sandcastle.cesium.com/index.html?src=3D%20Models.html|Cesium Sandcastle Models Demo}
178
+ * @demo {@link https://sandcastle.cesium.com/index.html?id=3d-models|Cesium Sandcastle Models Demo}
179
179
  */
180
180
  function Model(options) {
181
181
  options = options ?? Frozen.EMPTY_OBJECT;