@cesium/engine 26.1.0 → 26.3.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 (325) hide show
  1. package/Build/ThirdParty/Workers/zip-web-worker.js +764 -520
  2. package/Build/Workers/{chunk-HS6AD4P2.js → chunk-2DKJSPYF.js} +14 -14
  3. package/Build/Workers/{chunk-QVLAFFJY.js → chunk-2PWVICP6.js} +1 -1
  4. package/Build/Workers/{chunk-ILME5BXA.js → chunk-2YY724ZX.js} +8 -8
  5. package/Build/Workers/{chunk-ENNFMWDW.js → chunk-4DMAXPKB.js} +12 -12
  6. package/Build/Workers/{chunk-CDJDJ5LK.js → chunk-4LRFYRBX.js} +2 -2
  7. package/Build/Workers/{chunk-76FDC45O.js → chunk-5JCZHJUU.js} +13 -13
  8. package/Build/Workers/{chunk-5LSOO2KD.js → chunk-5KG7KDDW.js} +7 -7
  9. package/Build/Workers/{chunk-A6X24AZI.js → chunk-6BSNYZZG.js} +5 -5
  10. package/Build/Workers/{chunk-IGAZBTFZ.js → chunk-6R6SGKYN.js} +6 -6
  11. package/Build/Workers/{chunk-SS5ABQGY.js → chunk-6V2KDEHL.js} +4 -4
  12. package/Build/Workers/{chunk-ZMBHFYOX.js → chunk-75BC2IHI.js} +7 -7
  13. package/Build/Workers/{chunk-LGNDTZVX.js → chunk-7SESBH2I.js} +4 -4
  14. package/Build/Workers/{chunk-CLCTQVVL.js → chunk-7WXBTNRV.js} +8 -8
  15. package/Build/Workers/{chunk-WBSY7HDY.js → chunk-A7SMPV6B.js} +12 -12
  16. package/Build/Workers/{chunk-CEEZE3YZ.js → chunk-ATSXKJ3L.js} +7 -7
  17. package/Build/Workers/{chunk-AHWAZRBV.js → chunk-B4AVL7VI.js} +1 -1
  18. package/Build/Workers/{chunk-6HK6IXK2.js → chunk-B7Q2WF6Q.js} +4 -4
  19. package/Build/Workers/{chunk-YKU2Q3A2.js → chunk-BNDSDQ7D.js} +9 -12
  20. package/Build/Workers/{chunk-R4FPNAZ2.js → chunk-CKK6CUXK.js} +9 -9
  21. package/Build/Workers/{chunk-FCP2QY4G.js → chunk-COKOYTRS.js} +5 -5
  22. package/Build/Workers/{chunk-7D2HZKH7.js → chunk-CQ4TZXAT.js} +7 -7
  23. package/Build/Workers/{chunk-TVZD72WJ.js → chunk-DKSANM4A.js} +12 -12
  24. package/Build/Workers/{chunk-FDK4K5IA.js → chunk-DZK34ZVD.js} +1 -1
  25. package/Build/Workers/{chunk-N7CCOFLX.js → chunk-E7G32DWL.js} +1 -1
  26. package/Build/Workers/{chunk-XDWCTQCZ.js → chunk-EDETO6NY.js} +2 -2
  27. package/Build/Workers/{chunk-2EFYUSUY.js → chunk-F34TJJLA.js} +16 -16
  28. package/Build/Workers/{chunk-GXWQZBAI.js → chunk-GLHDTTTO.js} +2 -2
  29. package/Build/Workers/{chunk-T5QBPLE3.js → chunk-GS7RY2DH.js} +11 -11
  30. package/Build/Workers/{chunk-C7JQVRLM.js → chunk-HDD3RFLT.js} +25 -3
  31. package/Build/Workers/{chunk-E7NZJOK7.js → chunk-HDPNFEPP.js} +121 -93
  32. package/Build/Workers/{chunk-VAL7DYNR.js → chunk-JBJ6BRIM.js} +4 -4
  33. package/Build/Workers/{chunk-XQ3SKCMM.js → chunk-JKTWW7IO.js} +5 -5
  34. package/Build/Workers/{chunk-UVO6COT2.js → chunk-JL4NWWQY.js} +5 -5
  35. package/Build/Workers/{chunk-DBD5WWG2.js → chunk-JMUUAW4X.js} +10 -10
  36. package/Build/Workers/{chunk-UEY73NRN.js → chunk-KBGAHN5R.js} +1 -1
  37. package/Build/Workers/{chunk-LD64RPYV.js → chunk-KEWK6VZL.js} +12 -12
  38. package/Build/Workers/{chunk-JW6OZT4R.js → chunk-L73K5UPP.js} +10 -10
  39. package/Build/Workers/{chunk-DIGUUD6G.js → chunk-LL2SGJYH.js} +6 -6
  40. package/Build/Workers/{chunk-XLXSDIP5.js → chunk-LYJUL4XQ.js} +6 -6
  41. package/Build/Workers/{chunk-SM2CDCYF.js → chunk-M6W46OAP.js} +7 -7
  42. package/Build/Workers/{chunk-EHTS2YPT.js → chunk-MDDKCLMF.js} +17 -17
  43. package/Build/Workers/{chunk-FGQFQHN5.js → chunk-MUW4DJV7.js} +18 -18
  44. package/Build/Workers/{chunk-HHV3MCGV.js → chunk-N5YK44FS.js} +5 -5
  45. package/Build/Workers/{chunk-RG4F5R57.js → chunk-NZQUP52G.js} +9 -9
  46. package/Build/Workers/{chunk-B4CQSLZJ.js → chunk-PKZA44LH.js} +6 -6
  47. package/Build/Workers/{chunk-OBEU25PI.js → chunk-Q2JS5LCB.js} +17 -17
  48. package/Build/Workers/{chunk-KGXSYGBG.js → chunk-QTAEVUED.js} +13 -13
  49. package/Build/Workers/{chunk-NIWITKQK.js → chunk-SEJIXZZ4.js} +11 -11
  50. package/Build/Workers/{chunk-SGRGNDOD.js → chunk-SL2HCFYW.js} +10 -10
  51. package/Build/Workers/{chunk-SF6K72D7.js → chunk-SLHK3KAR.js} +5 -5
  52. package/Build/Workers/{chunk-JKXV6PG5.js → chunk-UZY5XRL2.js} +1 -1
  53. package/Build/Workers/{chunk-LNSQVXFH.js → chunk-VRECSMG3.js} +2 -2
  54. package/Build/Workers/{chunk-A3O6EDBK.js → chunk-X27HKF5E.js} +2 -2
  55. package/Build/Workers/{chunk-7KVKHY7O.js → chunk-XBY3354M.js} +6 -6
  56. package/Build/Workers/{chunk-GSWMAFTE.js → chunk-XRZCS3HE.js} +23 -16
  57. package/Build/Workers/{chunk-6YR6JBMY.js → chunk-XSIUYAT6.js} +2 -2
  58. package/Build/Workers/{chunk-ZSGUV73H.js → chunk-Z2DW5NM2.js} +6 -6
  59. package/Build/Workers/combineGeometry.js +24 -24
  60. package/Build/Workers/createBoxGeometry.js +18 -18
  61. package/Build/Workers/createBoxOutlineGeometry.js +16 -16
  62. package/Build/Workers/createCircleGeometry.js +26 -26
  63. package/Build/Workers/createCircleOutlineGeometry.js +19 -19
  64. package/Build/Workers/createCoplanarPolygonGeometry.js +35 -35
  65. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
  66. package/Build/Workers/createCorridorGeometry.js +31 -33
  67. package/Build/Workers/createCorridorOutlineGeometry.js +29 -31
  68. package/Build/Workers/createCylinderGeometry.js +20 -20
  69. package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
  70. package/Build/Workers/createEllipseGeometry.js +26 -26
  71. package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
  72. package/Build/Workers/createEllipsoidGeometry.js +19 -19
  73. package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
  74. package/Build/Workers/createFrustumGeometry.js +18 -18
  75. package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
  76. package/Build/Workers/createGeometry.js +24 -24
  77. package/Build/Workers/createGroundPolylineGeometry.js +24 -24
  78. package/Build/Workers/createPlaneGeometry.js +16 -16
  79. package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
  80. package/Build/Workers/createPolygonGeometry.js +34 -34
  81. package/Build/Workers/createPolygonOutlineGeometry.js +31 -31
  82. package/Build/Workers/createPolylineGeometry.js +26 -26
  83. package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
  84. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
  85. package/Build/Workers/createRectangleGeometry.js +27 -27
  86. package/Build/Workers/createRectangleOutlineGeometry.js +21 -21
  87. package/Build/Workers/createSimplePolylineGeometry.js +24 -24
  88. package/Build/Workers/createSphereGeometry.js +19 -19
  89. package/Build/Workers/createSphereOutlineGeometry.js +18 -18
  90. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  91. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  92. package/Build/Workers/createVectorTileGeometries.js +24 -24
  93. package/Build/Workers/createVectorTilePoints.js +13 -13
  94. package/Build/Workers/createVectorTilePolygons.js +22 -22
  95. package/Build/Workers/createVectorTilePolylines.js +14 -14
  96. package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
  97. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
  98. package/Build/Workers/createVerticesFromHeightmap.js +22 -22
  99. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
  100. package/Build/Workers/createWallGeometry.js +24 -24
  101. package/Build/Workers/createWallOutlineGeometry.js +24 -24
  102. package/Build/Workers/decodeDraco.js +10 -10
  103. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  104. package/Build/Workers/decodeI3S.js +10 -10
  105. package/Build/Workers/gaussianSplatSorter.js +4 -4
  106. package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
  107. package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
  108. package/Build/Workers/transcodeKTX2.js +6 -6
  109. package/Build/Workers/transferTypedArrayTest.js +1 -1
  110. package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
  111. package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
  112. package/Source/Core/ArcGISTiledElevationTerrainProvider.js +1 -5
  113. package/Source/Core/BoundingSphere.js +0 -3
  114. package/Source/Core/Cesium3DTilesTerrainGeometryProcessor.js +3 -4
  115. package/Source/Core/CoplanarPolygonGeometry.js +2 -2
  116. package/Source/Core/CorridorGeometry.js +2 -4
  117. package/Source/Core/CorridorOutlineGeometry.js +1 -3
  118. package/Source/Core/EarthOrientationParameters.js +2 -2
  119. package/Source/Core/EllipseGeometryLibrary.js +2 -2
  120. package/Source/Core/EllipsoidGeodesic.js +3 -3
  121. package/Source/Core/EllipsoidRhumbLine.js +1 -1
  122. package/Source/Core/GroundPolylineGeometry.js +2 -2
  123. package/Source/Core/Heap.js +1 -1
  124. package/Source/Core/HermitePolynomialApproximation.js +215 -179
  125. package/Source/Core/InterpolationAlgorithm.js +1 -0
  126. package/Source/Core/Ion.js +1 -1
  127. package/Source/Core/IonResource.js +5 -0
  128. package/Source/Core/IonSnapGeometryType.js +59 -0
  129. package/Source/Core/IonSnapHeat.js +33 -0
  130. package/Source/Core/IonSnapMode.js +45 -0
  131. package/Source/Core/IonSnapParentGeometryType.js +52 -0
  132. package/Source/Core/IonSnapService.js +369 -0
  133. package/Source/Core/JulianDate.js +1 -1
  134. package/Source/Core/LagrangePolynomialApproximation.js +55 -52
  135. package/Source/Core/LinearApproximation.js +69 -66
  136. package/Source/Core/Math.js +59 -0
  137. package/Source/Core/Matrix2.js +2 -2
  138. package/Source/Core/Matrix3.js +2 -2
  139. package/Source/Core/OrthographicFrustum.js +1 -1
  140. package/Source/Core/PerspectiveFrustum.js +1 -1
  141. package/Source/Core/PolygonGeometry.js +2 -2
  142. package/Source/Core/PolygonGeometryLibrary.js +1 -1
  143. package/Source/Core/PolygonOutlineGeometry.js +1 -1
  144. package/Source/Core/PolylineGeometry.js +1 -1
  145. package/Source/Core/PolylineVolumeGeometryLibrary.js +1 -1
  146. package/Source/Core/Rectangle.js +7 -1
  147. package/Source/Core/RectangleOutlineGeometry.js +1 -1
  148. package/Source/Core/SimplePolylineGeometry.js +1 -1
  149. package/Source/Core/SnapService.js +63 -0
  150. package/Source/Core/TerrainEncoding.js +2 -2
  151. package/Source/Core/TerrainPicker.js +179 -168
  152. package/Source/Core/TimeIntervalCollection.js +1 -3
  153. package/Source/Core/Tipsify.js +1 -1
  154. package/Source/Core/Transforms.js +5 -1
  155. package/Source/Core/VectorPipeline.js +1211 -0
  156. package/Source/Core/VectorProvider.js +669 -0
  157. package/Source/Core/WallOutlineGeometry.js +1 -1
  158. package/Source/Core/getTimestamp.js +4 -2
  159. package/Source/DataSources/CompositeEntityCollection.js +0 -1
  160. package/Source/DataSources/CzmlDataSource.js +2 -0
  161. package/Source/DataSources/DataSourceDisplay.js +1 -1
  162. package/Source/DataSources/GeoJsonDataSource.js +0 -1
  163. package/Source/DataSources/GeometryVisualizer.js +1 -1
  164. package/Source/DataSources/KmlDataSource.js +1 -2
  165. package/Source/DataSources/PolylineVisualizer.js +1 -1
  166. package/Source/DataSources/StaticOutlineGeometryBatch.js +1 -1
  167. package/Source/Renderer/AutomaticUniforms.js +67 -2
  168. package/Source/Renderer/Context.js +9 -3
  169. package/Source/Renderer/DrawCommand.js +22 -0
  170. package/Source/Renderer/Framebuffer.js +4 -0
  171. package/Source/Renderer/Pass.js +11 -10
  172. package/Source/Renderer/ShaderBuilder.js +1 -1
  173. package/Source/Renderer/Texture.js +11 -0
  174. package/Source/Renderer/UniformState.js +54 -1
  175. package/Source/Renderer/VertexArray.js +0 -1
  176. package/Source/Scene/ArcGisMapServerImageryProvider.js +0 -5
  177. package/Source/Scene/ArcGisMapService.js +1 -1
  178. package/Source/Scene/Billboard.js +2 -1
  179. package/Source/Scene/BillboardCollection.js +7 -3
  180. package/Source/Scene/BufferPointCollection.js +4 -7
  181. package/Source/Scene/BufferPolygonCollection.js +56 -27
  182. package/Source/Scene/BufferPolylineCollection.js +61 -8
  183. package/Source/Scene/BufferPolylineMaterial.js +6 -5
  184. package/Source/Scene/BufferPrimitiveCollection.js +226 -34
  185. package/Source/Scene/Camera.js +71 -5
  186. package/Source/Scene/Cesium3DTile.js +12 -0
  187. package/Source/Scene/Cesium3DTileset.js +62 -9
  188. package/Source/Scene/Cesium3DTilesetBaseTraversal.js +15 -3
  189. package/Source/Scene/Cesium3DTilesetCache.js +15 -0
  190. package/Source/Scene/ClippingPlaneCollection.js +2 -2
  191. package/Source/Scene/ClippingPolygon.js +154 -100
  192. package/Source/Scene/ClippingPolygonCollection.js +352 -694
  193. package/Source/Scene/Controllers/Controller.js +63 -0
  194. package/Source/Scene/Controllers/ControllerHost.js +78 -0
  195. package/Source/Scene/Controllers/HybridScreenSpacePanCameraController.js +106 -0
  196. package/Source/Scene/Controllers/MouseButton.js +32 -0
  197. package/Source/Scene/Controllers/ScreenSpaceElevatorCameraController.js +295 -0
  198. package/Source/Scene/Controllers/ScreenSpaceInputBindings.js +154 -0
  199. package/Source/Scene/Controllers/ScreenSpaceMapCameraController.js +310 -0
  200. package/Source/Scene/Controllers/ScreenSpaceTiltOrbitCameraController.js +642 -0
  201. package/Source/Scene/Controllers/ScreenSpaceZoomCameraController.js +431 -0
  202. package/Source/Scene/Controllers/defaultPickWorldPosition.js +84 -0
  203. package/Source/Scene/CreditDisplay.js +62 -0
  204. package/Source/Scene/DerivedCommand.js +94 -0
  205. package/Source/Scene/EdgeFramebuffer.js +1 -5
  206. package/Source/Scene/FrameState.js +17 -0
  207. package/Source/Scene/GeoJsonPrimitive.js +114 -24
  208. package/Source/Scene/Globe.js +20 -0
  209. package/Source/Scene/GlobeDepth.js +27 -1
  210. package/Source/Scene/GlobeSurfaceShaderSet.js +42 -53
  211. package/Source/Scene/GlobeSurfaceTile.js +61 -10
  212. package/Source/Scene/GlobeSurfaceTileProvider.js +351 -26
  213. package/Source/Scene/GltfLoader.js +88 -9
  214. package/Source/Scene/GltfSpzLoader.js +1 -1
  215. package/Source/Scene/GltfVertexBufferLoader.js +6 -3
  216. package/Source/Scene/HeightReference.js +1 -1
  217. package/Source/Scene/I3SDataProvider.js +1 -1
  218. package/Source/Scene/I3SLayer.js +1 -1
  219. package/Source/Scene/I3SNode.js +2 -2
  220. package/Source/Scene/ImageryLayerCollection.js +188 -4
  221. package/Source/Scene/IonImageryProvider.js +1 -5
  222. package/Source/Scene/Label.js +4 -4
  223. package/Source/Scene/LabelCollection.js +1 -1
  224. package/Source/Scene/MVTDataProvider.js +11 -0
  225. package/Source/Scene/Model/B3dmLoader.js +1 -2
  226. package/Source/Scene/Model/EdgeVisibilityPipelineStage.js +10 -8
  227. package/Source/Scene/Model/I3dmLoader.js +1 -1
  228. package/Source/Scene/Model/InstancingPipelineStage.js +4 -7
  229. package/Source/Scene/Model/MaterialPipelineStage.js +124 -1
  230. package/Source/Scene/Model/Model.js +250 -26
  231. package/Source/Scene/Model/Model3DTileContent.js +5 -0
  232. package/Source/Scene/Model/ModelClippingPlanesPipelineStage.js +28 -1
  233. package/Source/Scene/Model/ModelClippingPolygonsPipelineStage.js +54 -19
  234. package/Source/Scene/Model/ModelDrawCommand.js +160 -16
  235. package/Source/Scene/Model/ModelDrawCommands.js +4 -0
  236. package/Source/Scene/Model/ModelRenderResources.js +2 -3
  237. package/Source/Scene/Model/ModelSceneGraph.js +31 -1
  238. package/Source/Scene/Model/ModelVectorLookupPipelineStage.js +205 -0
  239. package/Source/Scene/Model/PickingPipelineStage.js +33 -0
  240. package/Source/Scene/Model/PrimitiveRenderResources.js +24 -0
  241. package/Source/Scene/ModelComponents.js +71 -0
  242. package/Source/Scene/Picking.js +16 -5
  243. package/Source/Scene/PlanarFillIdFramebuffer.js +172 -0
  244. package/Source/Scene/PntsParser.js +0 -1
  245. package/Source/Scene/PolylineCollection.js +1 -1
  246. package/Source/Scene/PostProcessStage.js +26 -5
  247. package/Source/Scene/ResourceCache.js +7 -4
  248. package/Source/Scene/ResourceCacheKey.js +16 -13
  249. package/Source/Scene/Scene.js +258 -6
  250. package/Source/Scene/ScreenSpaceCameraController.js +1 -2
  251. package/Source/Scene/ShadowMap.js +9 -3
  252. package/Source/Scene/ShadowMapShader.js +50 -2
  253. package/Source/Scene/SnapFramebuffer.js +121 -0
  254. package/Source/Scene/Snapping.js +241 -0
  255. package/Source/Scene/TerrainFillMesh.js +3 -2
  256. package/Source/Scene/UrlTemplate3DTilesDataProvider.js +13 -2
  257. package/Source/Scene/Vector3DTileContent.js +2 -3
  258. package/Source/Scene/VectorGltf3DTileContent.js +31 -3
  259. package/Source/Scene/View.js +10 -8
  260. package/Source/Scene/VoxelTraversal.js +1 -1
  261. package/Source/Scene/WebMapServiceImageryProvider.js +5 -1
  262. package/Source/Scene/WebMapTileServiceImageryProvider.js +6 -1
  263. package/Source/Scene/createElevationBandMaterial.js +1 -1
  264. package/Source/Scene/renderBufferPointCollection.js +1 -2
  265. package/Source/Scene/renderBufferPolygonCollection.js +1 -2
  266. package/Source/Scene/renderBufferPolylineCollection.js +6 -3
  267. package/Source/Shaders/BufferPolylineMaterialVS.glsl +14 -2
  268. package/Source/Shaders/BufferPolylineMaterialVS.js +14 -2
  269. package/Source/Shaders/Builtin/Constants/passCesium3DTile.glsl +1 -1
  270. package/Source/Shaders/Builtin/Constants/passCesium3DTile.js +1 -1
  271. package/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.glsl +1 -1
  272. package/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.js +1 -1
  273. package/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.glsl +1 -1
  274. package/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.js +1 -1
  275. package/Source/Shaders/Builtin/Constants/passCesium3DTilePlanarFillId.glsl +9 -0
  276. package/Source/Shaders/Builtin/Constants/passCesium3DTilePlanarFillId.js +11 -0
  277. package/Source/Shaders/Builtin/Constants/passClassification.glsl +1 -1
  278. package/Source/Shaders/Builtin/Constants/passClassification.js +1 -1
  279. package/Source/Shaders/Builtin/Constants/passGaussianSplats.glsl +1 -1
  280. package/Source/Shaders/Builtin/Constants/passGaussianSplats.js +1 -1
  281. package/Source/Shaders/Builtin/Constants/passOpaque.glsl +1 -1
  282. package/Source/Shaders/Builtin/Constants/passOpaque.js +1 -1
  283. package/Source/Shaders/Builtin/Constants/passTranslucent.glsl +1 -1
  284. package/Source/Shaders/Builtin/Constants/passTranslucent.js +1 -1
  285. package/Source/Shaders/Builtin/Constants/passVoxels.glsl +1 -1
  286. package/Source/Shaders/Builtin/Constants/passVoxels.js +1 -1
  287. package/Source/Shaders/Builtin/CzmBuiltins.js +4 -4
  288. package/Source/Shaders/Builtin/Functions/eyeToCartographicDelta.glsl +74 -0
  289. package/Source/Shaders/Builtin/Functions/eyeToCartographicDelta.js +76 -0
  290. package/Source/Shaders/GlobeFS.glsl +20 -14
  291. package/Source/Shaders/GlobeFS.js +20 -14
  292. package/Source/Shaders/GlobeVS.glsl +0 -32
  293. package/Source/Shaders/GlobeVS.js +0 -32
  294. package/Source/Shaders/Materials/PolylineGlowMaterial.glsl +1 -1
  295. package/Source/Shaders/Materials/PolylineGlowMaterial.js +1 -1
  296. package/Source/Shaders/Model/MaterialStageFS.glsl +8 -2
  297. package/Source/Shaders/Model/MaterialStageFS.js +8 -2
  298. package/Source/Shaders/Model/ModelClippingPolygonsStageFS.glsl +15 -3
  299. package/Source/Shaders/Model/ModelClippingPolygonsStageFS.js +15 -3
  300. package/Source/Shaders/Model/ModelClippingPolygonsStageVS.glsl +20 -24
  301. package/Source/Shaders/Model/ModelClippingPolygonsStageVS.js +20 -24
  302. package/Source/Shaders/Model/ModelFS.glsl +109 -0
  303. package/Source/Shaders/Model/ModelFS.js +109 -0
  304. package/Source/Shaders/Model/ModelVS.glsl +7 -2
  305. package/Source/Shaders/Model/ModelVS.js +7 -2
  306. package/Source/Shaders/Model/ModelVectorLookupStageFS.glsl +6 -0
  307. package/Source/Shaders/Model/ModelVectorLookupStageFS.js +8 -0
  308. package/Source/Shaders/Model/ModelVectorLookupStageVS.glsl +15 -0
  309. package/Source/Shaders/Model/ModelVectorLookupStageVS.js +17 -0
  310. package/Source/Shaders/Model/VerticalExaggerationStageVS.glsl +9 -10
  311. package/Source/Shaders/Model/VerticalExaggerationStageVS.js +9 -11
  312. package/Source/Shaders/VectorCommon.glsl +305 -0
  313. package/Source/Shaders/VectorCommon.js +307 -0
  314. package/Source/ThirdParty/Workers/zip-web-worker.js +1 -1
  315. package/Source/ThirdParty/zip-module.wasm +0 -0
  316. package/Source/Widget/CesiumWidget.js +30 -0
  317. package/index.d.ts +1326 -65
  318. package/index.js +179 -155
  319. package/package.json +6 -6
  320. package/Source/Shaders/Builtin/Functions/clipPolygons.glsl +0 -37
  321. package/Source/Shaders/Builtin/Functions/clipPolygons.js +0 -39
  322. package/Source/Shaders/Builtin/Functions/unpackClippingExtents.glsl +0 -14
  323. package/Source/Shaders/Builtin/Functions/unpackClippingExtents.js +0 -15
  324. package/Source/Shaders/PolygonSignedDistanceFS.glsl +0 -131
  325. package/Source/Shaders/PolygonSignedDistanceFS.js +0 -132
@@ -294,13 +294,13 @@ function getModelMatrixAndNodeTransform(
294
294
  const instances = renderResources.runtimeNode.node.instances;
295
295
  if (instances.transformInWorldSpace) {
296
296
  // Replicate the multiplication order in LegacyInstancingStageVS.
297
- modelMatrix = Matrix4.multiplyTransformation(
297
+ Matrix4.multiplyTransformation(
298
298
  model.modelMatrix,
299
299
  sceneGraph.components.transform,
300
300
  modelMatrix,
301
301
  );
302
302
 
303
- nodeComputedTransform = Matrix4.multiplyTransformation(
303
+ Matrix4.multiplyTransformation(
304
304
  sceneGraph.axisCorrectionMatrix,
305
305
  renderResources.runtimeNode.computedTransform,
306
306
  nodeComputedTransform,
@@ -308,16 +308,13 @@ function getModelMatrixAndNodeTransform(
308
308
  } else {
309
309
  // The node transform should be pre-multiplied with the instancing transform.
310
310
  modelMatrix = Matrix4.clone(sceneGraph.computedModelMatrix, modelMatrix);
311
- modelMatrix = Matrix4.multiplyTransformation(
311
+ Matrix4.multiplyTransformation(
312
312
  modelMatrix,
313
313
  renderResources.runtimeNode.computedTransform,
314
314
  modelMatrix,
315
315
  );
316
316
 
317
- nodeComputedTransform = Matrix4.clone(
318
- Matrix4.IDENTITY,
319
- nodeComputedTransform,
320
- );
317
+ Matrix4.clone(Matrix4.IDENTITY, nodeComputedTransform);
321
318
  }
322
319
  }
323
320
 
@@ -170,13 +170,28 @@ MaterialPipelineStage.process = function (
170
170
  const disablePointCloudNormals =
171
171
  defined(model.pointCloudShading) && !model.pointCloudShading.normalShading;
172
172
 
173
+ if (defined(material.planarFill)) {
174
+ processPlanarFill(
175
+ material.planarFill,
176
+ primitive,
177
+ renderResources,
178
+ frameState,
179
+ );
180
+ }
181
+
182
+ // When backgroundFill is true (BENTLEY_materials_planar_fill), the primitive
183
+ // must be unlit so it matches the background color exactly.
184
+ const hasBackgroundFill =
185
+ defined(material.planarFill) && material.planarFill.backgroundFill;
186
+
173
187
  // Classification models will be rendered as unlit.
174
188
  const lightingOptions = renderResources.lightingOptions;
175
189
  if (
176
190
  material.unlit ||
177
191
  !hasNormals ||
178
192
  hasClassification ||
179
- disablePointCloudNormals
193
+ disablePointCloudNormals ||
194
+ hasBackgroundFill
180
195
  ) {
181
196
  lightingOptions.lightingModel = LightingModel.UNLIT;
182
197
  } else {
@@ -232,6 +247,114 @@ MaterialPipelineStage.process = function (
232
247
  }
233
248
  };
234
249
 
250
+ /**
251
+ * Add uniforms and defines for the BENTLEY_materials_planar_fill extension.
252
+ *
253
+ * Per the BENTLEY_materials_planar_fill spec:
254
+ * <ul>
255
+ * <li>ALL planar primitives must render in front of non-planar (Depth Ordering).</li>
256
+ * <li><code>behind</code> fills must render behind coplanar geometry from the SAME
257
+ * logical object only (same feature ID from EXT_mesh_features).</li>
258
+ * </ul>
259
+ *
260
+ * Instead of using fixed polygon offset units (which don't scale well with
261
+ * logarithmic depth), we use proportional depth scaling in the shader.
262
+ * This approach matches the edge visibility system and scales naturally
263
+ * at all viewing distances.
264
+ *
265
+ * @param {ModelComponents.PlanarFill} planarFill The planar fill properties of the material
266
+ * @param {ModelComponents.Primitive} primitive The primitive to be rendered
267
+ * @param {PrimitiveRenderResources} renderResources The render resources for the primitive
268
+ * @param {FrameState} frameState The frame state.
269
+ * @private
270
+ */
271
+ function processPlanarFill(planarFill, primitive, renderResources, frameState) {
272
+ const { uniformMap, shaderBuilder } = renderResources;
273
+
274
+ // Signal to Scene that the planar fill ID framebuffer is needed.
275
+ frameState.planarFillRequested = true;
276
+
277
+ // All planar fills get a proportional depth pull toward camera. Behind fills
278
+ // additionally sample the planar fill ID texture to test same-feature; if so,
279
+ // they apply a small proportional push to sit behind non-behind geometry.
280
+ shaderBuilder.addDefine(
281
+ "HAS_PLANAR_FILL_DEPTH",
282
+ undefined,
283
+ ShaderDestination.FRAGMENT,
284
+ );
285
+
286
+ // Configure background fill for BENTLEY_materials_planar_fill extension.
287
+ // When backgroundFill is true, the fill is rendered using the view's background color
288
+ // to create an invisible masking polygon. Lighting is forced to unlit in process().
289
+ //
290
+ // NOTE: The wireframeFill property from BENTLEY_materials_planar_fill is intentionally
291
+ // not handled here. CesiumJS does not yet have a proper wireframe rendering mode
292
+ // (debugWireframe is not a true wireframe mode), so wireframeFill is loaded as a NO-OP.
293
+ // When a proper wireframe mode is added to CesiumJS, wireframeFill support should be
294
+ // implemented here to control fill visibility in that mode. See
295
+ // https://github.com/CesiumGS/cesium/issues/13620.
296
+ if (planarFill.backgroundFill) {
297
+ shaderBuilder.addDefine(
298
+ "HAS_BACKGROUND_FILL",
299
+ undefined,
300
+ ShaderDestination.FRAGMENT,
301
+ );
302
+ }
303
+
304
+ const hasFeatureIds =
305
+ defined(primitive.featureIds) && primitive.featureIds.length > 0;
306
+ if (!hasFeatureIds) {
307
+ return;
308
+ }
309
+
310
+ // "Same logical object" is implementation-defined per the spec; this
311
+ // implementation uses the primitive's first feature ID set. Primitives
312
+ // without feature IDs (checked above) don't participate in the
313
+ // behind-fill same-object test.
314
+ const featureIdMember = primitive.featureIds[0].positionalLabel;
315
+ shaderBuilder.addDefine(
316
+ "PLANAR_FILL_FEATURE_ID",
317
+ featureIdMember,
318
+ ShaderDestination.FRAGMENT,
319
+ );
320
+
321
+ if (planarFill.behind) {
322
+ // Behind fills READ the planar fill ID texture to test whether the
323
+ // pixel they cover belongs to the same logical object.
324
+ shaderBuilder.addDefine(
325
+ "HAS_PLANAR_FILL_BEHIND",
326
+ undefined,
327
+ ShaderDestination.FRAGMENT,
328
+ );
329
+ } else {
330
+ // Non-behind fills WRITE their feature IDs to the planar fill ID
331
+ // texture in a pre-pass so behind fills can test same-object
332
+ // coplanarity. Mark this primitive for the pre-pass derived command.
333
+ renderResources.planarFillIdPass = true;
334
+
335
+ // Add a define so that during the pre-pass the shader outputs
336
+ // the feature ID instead of the normal color.
337
+ shaderBuilder.addDefine(
338
+ "HAS_PLANAR_FILL_ID_PASS",
339
+ undefined,
340
+ ShaderDestination.FRAGMENT,
341
+ );
342
+
343
+ // Runtime uniform to distinguish the pre-pass from the main pass
344
+ // (same shader program serves both commands). This default returns false
345
+ // for the main command; the derived pre-pass command overrides it to
346
+ // return true (see derivePlanarFillIdCommand in ModelDrawCommand.js).
347
+ shaderBuilder.addUniform(
348
+ "bool",
349
+ "u_isPlanarFillIdPass",
350
+ ShaderDestination.FRAGMENT,
351
+ );
352
+ uniformMap.u_isPlanarFillIdPass = function () {
353
+ return false;
354
+ };
355
+ }
356
+ }
357
+
235
358
  /**
236
359
  * Process constant LOD extension for a texture
237
360
  *
@@ -13,6 +13,7 @@ import Ellipsoid from "../../Core/Ellipsoid.js";
13
13
  import Event from "../../Core/Event.js";
14
14
  import Matrix3 from "../../Core/Matrix3.js";
15
15
  import Matrix4 from "../../Core/Matrix4.js";
16
+ import Rectangle from "../../Core/Rectangle.js";
16
17
  import Resource from "../../Core/Resource.js";
17
18
  import RuntimeError from "../../Core/RuntimeError.js";
18
19
  import Pass from "../../Renderer/Pass.js";
@@ -46,6 +47,8 @@ import StyleCommandsNeeded from "./StyleCommandsNeeded.js";
46
47
  import pickModel from "./pickModel.js";
47
48
  import ModelImagery from "./ModelImagery.js";
48
49
 
50
+ /** @import { VectorTileData } from "../../Core/VectorPipeline.js"; */
51
+
49
52
  /**
50
53
  * <div class="notice">
51
54
  * To construct a Model, call {@link Model.fromGltfAsync}. Do not call the constructor directly.
@@ -73,7 +76,7 @@ import ModelImagery from "./ModelImagery.js";
73
76
  * {@link https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Vendor/EXT_mesh_gpu_instancing|EXT_mesh_gpu_instancing}
74
77
  * </li>
75
78
  * <li>
76
- * {@link https://github.com/KhronosGroup/glTF/pull/2514|EXT_mesh_primitive_restart}
79
+ * {@link https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Vendor/EXT_mesh_primitive_restart|EXT_mesh_primitive_restart}
77
80
  * </li>
78
81
  * <li>
79
82
  * {@link https://github.com/KhronosGroup/glTF/pull/2479|EXT_mesh_primitive_edge_visibility}
@@ -105,6 +108,10 @@ import ModelImagery from "./ModelImagery.js";
105
108
  * {@link https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit/README.md|KHR_materials_unlit}
106
109
  * </li>
107
110
  * <li>
111
+ * {@link https://github.com/KhronosGroup/glTF/pull/2569|KHR_mesh_primitive_restart}
112
+ * (requires a WebGL 2 context; behavior on WebGL 1 is undefined)
113
+ * </li>
114
+ * <li>
108
115
  * {@link https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_mesh_quantization|KHR_mesh_quantization}
109
116
  * </li>
110
117
  * <li>
@@ -269,6 +276,7 @@ function Model(options) {
269
276
  */
270
277
  this.referenceMatrix = undefined;
271
278
  this._iblReferenceFrameMatrix = Matrix3.clone(Matrix3.IDENTITY); // Derived from reference matrix and the current view matrix
279
+ this._clippingPlanesMatrix = Matrix4.clone(Matrix4.IDENTITY); // Derived from the reference matrix and the clipping planes' own model matrix
272
280
 
273
281
  this._resourcesLoaded = false;
274
282
  this._drawCommandsBuilt = false;
@@ -380,7 +388,6 @@ function Model(options) {
380
388
  this._clippingPlanes = clippingPlanes;
381
389
  }
382
390
  this._clippingPlanesState = 0; // If this value changes, the shaders need to be regenerated.
383
- this._clippingPlanesMatrix = Matrix4.clone(Matrix4.IDENTITY); // Derived from reference matrix and the current view matrix
384
391
 
385
392
  // If the given clipping polygons don't have an owner, make this model its owner.
386
393
  // Otherwise, the clipping polygons are passed down from a tileset.
@@ -395,6 +402,30 @@ function Model(options) {
395
402
  this._clippingPolygons = clippingPolygons;
396
403
  }
397
404
  this._clippingPolygonsState = 0; // If this value changes, the shaders need to be regenerated.
405
+ this._clippingPolygonsNeedRebake = false; // If true, the clipping textures are rebaked.
406
+ this._removeClippingPolygonAdded = undefined;
407
+ this._removeClippingPolygonRemoved = undefined;
408
+ updateClippingPolygonListeners(this);
409
+
410
+ /**
411
+ * Vector lookup data baked for this model's bounding region by the scene's
412
+ * VectorProvider, draping vector data onto the model's surface.
413
+ * @type {VectorTileData|undefined}
414
+ * @ignore
415
+ */
416
+ this._vectorData = undefined;
417
+
418
+ this._vectorLookupFlags = 0; // If this value changes, the shaders need to be regenerated.
419
+
420
+ /*
421
+ * Textures and other intermediate data used in polygon clipping workflows.
422
+ * Clipping polygons build on top of the vector tile data system (both rely on the same rendering technique), thus the type.
423
+ * @type {VectorTileData | undefined}
424
+ * @private
425
+ */
426
+ this._clippingPolygonData = undefined;
427
+
428
+ this._rectangle = new Rectangle();
398
429
 
399
430
  this._modelImagery = new ModelImagery(this);
400
431
 
@@ -1372,7 +1403,17 @@ Object.defineProperties(Model.prototype, {
1372
1403
  if (value !== this._clippingPolygons) {
1373
1404
  // Handle destroying old clipping polygons, new clipping polygons ownership
1374
1405
  ClippingPolygonCollection.setOwner(value, this, "_clippingPolygons");
1406
+ updateClippingPolygonListeners(this);
1375
1407
  this.resetDrawCommands();
1408
+
1409
+ this._clippingPolygonsState = 0;
1410
+ this._clippingPolygonsNeedRebake = true;
1411
+ if (defined(this._clippingPolygonData)) {
1412
+ ClippingPolygonCollection.releaseRectangleData(
1413
+ this._clippingPolygonData,
1414
+ );
1415
+ this._clippingPolygonData = undefined;
1416
+ }
1376
1417
  }
1377
1418
  },
1378
1419
  },
@@ -1784,6 +1825,41 @@ Object.defineProperties(Model.prototype, {
1784
1825
  },
1785
1826
  });
1786
1827
 
1828
+ /**
1829
+ * A rectangle that bounds the model in geodetic coordinates. For 3D tile content with a
1830
+ * region bounding volume this is the tile's rectangle. Otherwise the model's bounding sphere
1831
+ * is projected onto the given ellipsoid.
1832
+ *
1833
+ * @param {Ellipsoid} [ellipsoid=Ellipsoid.default] Projects the bounding sphere (for models without a region bounding volume).
1834
+ * @returns {Rectangle} The bounding rectangle.
1835
+ *
1836
+ * @exception {DeveloperError} The model is not loaded. Use Model.readyEvent or wait for Model.ready to be true.
1837
+ *
1838
+ * @private
1839
+ */
1840
+ Model.prototype.getRectangle = function (ellipsoid) {
1841
+ //>>includeStart('debug', pragmas.debug);
1842
+ if (!this._ready) {
1843
+ throw new DeveloperError(
1844
+ "The model is not loaded. Use Model.readyEvent or wait for Model.ready to be true.",
1845
+ );
1846
+ }
1847
+ //>>includeEnd('debug');
1848
+
1849
+ // A region bounding volume's rectangle is fixed in WGS84, so the ellipsoid argument does not apply.
1850
+ const bv = this._content?.tile?.contentBoundingVolume;
1851
+ if (defined(bv?.rectangle)) {
1852
+ return bv.rectangle;
1853
+ }
1854
+
1855
+ ellipsoid = ellipsoid ?? this._scene?.ellipsoid ?? Ellipsoid.default;
1856
+ return Rectangle.fromBoundingSphere(
1857
+ this.boundingSphere,
1858
+ ellipsoid,
1859
+ this._rectangle,
1860
+ );
1861
+ };
1862
+
1787
1863
  /**
1788
1864
  * Returns the node with the given <code>name</code> in the glTF. This is used to
1789
1865
  * modify a node's transform for user-defined animation.
@@ -2012,6 +2088,7 @@ Model.prototype.update = function (frameState) {
2012
2088
  updateSkipLevelOfDetail(this, frameState);
2013
2089
  updateClippingPlanes(this, frameState);
2014
2090
  updateClippingPolygons(this, frameState);
2091
+ updateVectorLookup(this, frameState);
2015
2092
  updateSceneMode(this, frameState);
2016
2093
  updateFog(this, frameState);
2017
2094
  updateVerticalExaggeration(this, frameState);
@@ -2215,22 +2292,140 @@ function updateClippingPlanes(model, frameState) {
2215
2292
  }
2216
2293
  }
2217
2294
 
2295
+ // Only the collection's owner subscribes to its add/remove events. Tileset-owned
2296
+ // collections are handled by the tileset, which marks its tiles dirty instead.
2297
+ function updateClippingPolygonListeners(model) {
2298
+ model._removeClippingPolygonAdded =
2299
+ model._removeClippingPolygonAdded && model._removeClippingPolygonAdded();
2300
+ model._removeClippingPolygonRemoved =
2301
+ model._removeClippingPolygonRemoved &&
2302
+ model._removeClippingPolygonRemoved();
2303
+
2304
+ const clippingPolygons = model._clippingPolygons;
2305
+ if (!defined(clippingPolygons) || clippingPolygons.owner !== model) {
2306
+ return;
2307
+ }
2308
+
2309
+ const markDirty = () => {
2310
+ model._clippingPolygonsNeedRebake = true;
2311
+ };
2312
+ model._removeClippingPolygonAdded =
2313
+ clippingPolygons.polygonAdded.addEventListener(markDirty);
2314
+ model._removeClippingPolygonRemoved =
2315
+ clippingPolygons.polygonRemoved.addEventListener(markDirty);
2316
+ }
2317
+
2218
2318
  function updateClippingPolygons(model, frameState) {
2219
- // Update the clipping polygon collection / state for this model to detect any changes.
2319
+ const clippingPolygons = model._clippingPolygons;
2320
+ const enabled = model.isClippingPolygonsEnabled();
2321
+
2322
+ // Detect enabled/inverse changes, which require shader regeneration.
2220
2323
  let currentClippingPolygonsState = 0;
2221
- if (model.isClippingPolygonsEnabled()) {
2222
- if (model._clippingPolygons.owner === model) {
2223
- model._clippingPolygons.update(frameState);
2224
- model._clippingPolygons.queueCommands(frameState);
2324
+ if (enabled) {
2325
+ if (clippingPolygons.owner === model) {
2326
+ clippingPolygons.update(frameState);
2225
2327
  }
2226
- currentClippingPolygonsState =
2227
- model._clippingPolygons.clippingPolygonsState;
2328
+ currentClippingPolygonsState = clippingPolygons.clippingPolygonsState;
2228
2329
  }
2229
2330
 
2230
2331
  if (currentClippingPolygonsState !== model._clippingPolygonsState) {
2231
2332
  model.resetDrawCommands();
2232
2333
  model._clippingPolygonsState = currentClippingPolygonsState;
2233
2334
  }
2335
+
2336
+ const wasClipped = (model._clippingPolygonData?.polygonRings.length ?? 0) > 0;
2337
+
2338
+ // A polygon add/remove or a model move only requires rebaking the clipping textures.
2339
+ if (model._clippingPolygonsNeedRebake) {
2340
+ model._clippingPolygonsNeedRebake = false;
2341
+ if (defined(model._clippingPolygonData)) {
2342
+ ClippingPolygonCollection.releaseRectangleData(
2343
+ model._clippingPolygonData,
2344
+ );
2345
+ model._clippingPolygonData = undefined;
2346
+ }
2347
+ }
2348
+
2349
+ if (!enabled || !model._ready) {
2350
+ return;
2351
+ }
2352
+
2353
+ if (!defined(model._clippingPolygonData)) {
2354
+ model._clippingPolygonData = clippingPolygons.requestRectangleData(
2355
+ model.getRectangle(clippingPolygons.ellipsoid),
2356
+ frameState.context,
2357
+ );
2358
+ }
2359
+
2360
+ const isClipped = (model._clippingPolygonData?.polygonRings.length ?? 0) > 0;
2361
+ if (wasClipped !== isClipped) {
2362
+ // Rerun the model pipeline to enable/disable clipping
2363
+ model.resetDrawCommands();
2364
+ }
2365
+ }
2366
+
2367
+ const scratchVectorRectangle = new Rectangle();
2368
+
2369
+ function releaseVectorData(model) {
2370
+ if (!defined(model._vectorData)) {
2371
+ return;
2372
+ }
2373
+
2374
+ model._scene?.vectorProvider?.releaseTileData(model._vectorData);
2375
+ model._vectorData = undefined;
2376
+ }
2377
+
2378
+ // Each kind of geometry declares its own lookup textures, so the mix drives the shader.
2379
+ function vectorLookupFlags(vectorData) {
2380
+ if (vectorData?.show !== true) {
2381
+ return 0;
2382
+ }
2383
+
2384
+ let flags = 1;
2385
+ flags |= vectorData.hasPolylines ? 2 : 0;
2386
+ flags |= vectorData.hasPolygons ? 4 : 0;
2387
+ return flags;
2388
+ }
2389
+
2390
+ function updateVectorLookup(model, frameState) {
2391
+ const provider = model._scene?.vectorProvider;
2392
+ // HeightReference.CLAMP_TO_3D_TILE covers tileset content only, not standalone glTF.
2393
+ const active =
2394
+ defined(provider) &&
2395
+ defined(model._content) &&
2396
+ model.ready &&
2397
+ frameState.mode === SceneMode.SCENE3D;
2398
+
2399
+ if (active) {
2400
+ // A tile's content region is far tighter than a rectangle circumscribing the bounding sphere.
2401
+ const rectangle =
2402
+ model._content?.tile?.contentBoundingVolume.rectangle ??
2403
+ Rectangle.fromBoundingSphere(
2404
+ model.boundingSphere,
2405
+ provider.ellipsoid,
2406
+ scratchVectorRectangle,
2407
+ );
2408
+ model._vectorData = defined(model._vectorData)
2409
+ ? provider.updateDataForRectangle(
2410
+ rectangle,
2411
+ frameState.context,
2412
+ model._vectorData,
2413
+ HeightReference.CLAMP_TO_3D_TILE,
2414
+ )
2415
+ : provider.requestDataForRectangle(
2416
+ rectangle,
2417
+ frameState.context,
2418
+ HeightReference.CLAMP_TO_3D_TILE,
2419
+ );
2420
+ } else {
2421
+ releaseVectorData(model);
2422
+ }
2423
+
2424
+ const flags = vectorLookupFlags(model._vectorData);
2425
+ if (flags !== model._vectorLookupFlags) {
2426
+ model.resetDrawCommands();
2427
+ model._vectorLookupFlags = flags;
2428
+ }
2234
2429
  }
2235
2430
 
2236
2431
  function updateSceneMode(model, frameState) {
@@ -2479,16 +2674,10 @@ function updateReferenceMatrices(model, frameState) {
2479
2674
  );
2480
2675
 
2481
2676
  if (model.isClippingEnabled()) {
2482
- let clippingPlanesMatrix = scratchClippingPlanesMatrix;
2483
- clippingPlanesMatrix = Matrix4.multiply(
2484
- context.uniformState.view3D,
2677
+ const clippingPlanesMatrix = Matrix4.multiply(
2485
2678
  referenceMatrix,
2486
- clippingPlanesMatrix,
2487
- );
2488
- clippingPlanesMatrix = Matrix4.multiply(
2489
- clippingPlanesMatrix,
2490
2679
  model._clippingPlanes.modelMatrix,
2491
- clippingPlanesMatrix,
2680
+ scratchClippingPlanesMatrix,
2492
2681
  );
2493
2682
  model._clippingPlanesMatrix = Matrix4.inverseTranspose(
2494
2683
  clippingPlanesMatrix,
@@ -2504,6 +2693,10 @@ function updateSceneGraph(model, frameState) {
2504
2693
  ? model._clampedModelMatrix
2505
2694
  : model.modelMatrix;
2506
2695
  sceneGraph.updateModelMatrix(modelMatrix, frameState);
2696
+ if (model._updateModelMatrix) {
2697
+ // The model moved, so re-bake the clipping textures for its new rectangle.
2698
+ model._clippingPolygonsNeedRebake = true;
2699
+ }
2507
2700
  model._updateModelMatrix = false;
2508
2701
  }
2509
2702
 
@@ -2563,6 +2756,22 @@ function updateShowCreditsOnScreen(model) {
2563
2756
  }
2564
2757
  }
2565
2758
 
2759
+ /**
2760
+ * Determines whether a model is wholly clipped away by inverse clipping. In
2761
+ * inverse mode a model with no polygon geometry lies entirely outside every
2762
+ * polygon, so all of it is clipped and it should not be drawn.
2763
+ * @param {Model} model
2764
+ * @returns {boolean}
2765
+ * @private
2766
+ */
2767
+ function isModelClippedAwayByInversePolygons(model) {
2768
+ return (
2769
+ model.isClippingPolygonsEnabled() &&
2770
+ model._clippingPolygons.inverse &&
2771
+ (model._clippingPolygonData?.polygonRings.length ?? 0) === 0
2772
+ );
2773
+ }
2774
+
2566
2775
  function submitDrawCommands(model, frameState) {
2567
2776
  // Check that show is true after draw commands are built;
2568
2777
  // we want the user to be able to instantly see the model
@@ -2583,7 +2792,8 @@ function submitDrawCommands(model, frameState) {
2583
2792
  model._show &&
2584
2793
  model._computedScale !== 0 &&
2585
2794
  displayConditionPassed &&
2586
- (!invisible || silhouette);
2795
+ (!invisible || silhouette) &&
2796
+ !isModelClippedAwayByInversePolygons(model);
2587
2797
 
2588
2798
  const passes = frameState.passes;
2589
2799
  const submitCommandsForPass =
@@ -2808,6 +3018,16 @@ Model.prototype.isClippingPolygonsEnabled = function () {
2808
3018
  );
2809
3019
  };
2810
3020
 
3021
+ /**
3022
+ * Gets whether draped vector data is baked and renderable for this model.
3023
+ *
3024
+ * @returns {boolean} <code>true</code> if the model drapes vector data.
3025
+ * @private
3026
+ */
3027
+ Model.prototype.hasDrapedVectors = function () {
3028
+ return this._vectorData?.show === true;
3029
+ };
3030
+
2811
3031
  /**
2812
3032
  * Returns true if this object was destroyed; otherwise, false.
2813
3033
  * <br /><br />
@@ -2855,6 +3075,8 @@ Model.prototype.destroy = function () {
2855
3075
  this.destroyPipelineResources();
2856
3076
  this.destroyModelResources();
2857
3077
 
3078
+ releaseVectorData(this);
3079
+
2858
3080
  // Remove callbacks for height reference behavior.
2859
3081
  if (defined(this._removeUpdateHeightCallback)) {
2860
3082
  this._removeUpdateHeightCallback();
@@ -2866,6 +3088,12 @@ Model.prototype.destroy = function () {
2866
3088
  this._terrainProviderChangedCallback = undefined;
2867
3089
  }
2868
3090
 
3091
+ // Remove clipping polygon event listeners if this model subscribed to them.
3092
+ this._removeClippingPolygonAdded =
3093
+ this._removeClippingPolygonAdded && this._removeClippingPolygonAdded();
3094
+ this._removeClippingPolygonRemoved =
3095
+ this._removeClippingPolygonRemoved && this._removeClippingPolygonRemoved();
3096
+
2869
3097
  // Only destroy the ClippingPlaneCollection if this is the owner.
2870
3098
  const clippingPlaneCollection = this._clippingPlanes;
2871
3099
  if (
@@ -2877,15 +3105,11 @@ Model.prototype.destroy = function () {
2877
3105
  }
2878
3106
  this._clippingPlanes = undefined;
2879
3107
 
2880
- // Only destroy the ClippingPolygonCollection if this is the owner.
2881
- const clippingPolygonCollection = this._clippingPolygons;
2882
- if (
2883
- defined(clippingPolygonCollection) &&
2884
- !clippingPolygonCollection.isDestroyed() &&
2885
- clippingPolygonCollection.owner === this
2886
- ) {
2887
- clippingPolygonCollection.destroy();
3108
+ if (defined(this._clippingPolygonData)) {
3109
+ ClippingPolygonCollection.releaseRectangleData(this._clippingPolygonData);
2888
3110
  }
3111
+ this._clippingPolygonData = undefined;
3112
+
2889
3113
  this._clippingPolygons = undefined;
2890
3114
 
2891
3115
  // Only destroy the ImageBasedLighting if this is the owner.
@@ -310,6 +310,10 @@ class Model3DTileContent {
310
310
  model._clippingPolygonsState = 0;
311
311
  }
312
312
 
313
+ if (tile.clippingPolygonsNeedRebake) {
314
+ model._clippingPolygonsNeedRebake = true;
315
+ }
316
+
313
317
  model.update(frameState);
314
318
 
315
319
  if (!this._ready && model.ready) {
@@ -490,6 +494,7 @@ function makeModelOptions(tileset, tile, content, additionalOptions) {
490
494
  incrementallyLoadTextures: false,
491
495
  customShader: tileset.customShader,
492
496
  content: content,
497
+ scene: tileset._scene,
493
498
  colorBlendMode: tileset.colorBlendMode,
494
499
  colorBlendAmount: tileset.colorBlendAmount,
495
500
  lightColor: tileset.lightColor,
@@ -2,6 +2,7 @@ import Cartesian2 from "../../Core/Cartesian2.js";
2
2
  import ClippingPlaneCollection from "../ClippingPlaneCollection.js";
3
3
  import combine from "../../Core/combine.js";
4
4
  import Color from "../../Core/Color.js";
5
+ import Matrix4 from "../../Core/Matrix4.js";
5
6
  import ModelClippingPlanesStageFS from "../../Shaders/Model/ModelClippingPlanesStageFS.js";
6
7
  import ShaderDestination from "../../Renderer/ShaderDestination.js";
7
8
 
@@ -17,6 +18,9 @@ const ModelClippingPlanesPipelineStage = {
17
18
  };
18
19
 
19
20
  const textureResolutionScratch = new Cartesian2();
21
+ const scratchClippingPlanesMatrix = new Matrix4();
22
+ const scratchClippingPlanesMatrix2 = new Matrix4();
23
+
20
24
  /**
21
25
  * Process a model. This modifies the following parts of the render resources:
22
26
  *
@@ -116,7 +120,30 @@ ModelClippingPlanesPipelineStage.process = function (
116
120
  return style;
117
121
  },
118
122
  model_clippingPlanesMatrix: function () {
119
- return model._clippingPlanesMatrix;
123
+ // The clipping planes matrix is factored into a view-dependent and a
124
+ // view-independent part:
125
+ // inverseTranspose(view3D * reference * clipping)
126
+ // = transpose(inverseView3D) * inverseTranspose(reference * clipping).
127
+ //
128
+ // The view-dependent part, transpose(inverseView3D), reuses inverseView3D
129
+ // already maintained on UniformState. Since it uses the active view, this is
130
+ // also correct in the shadow cast pass, where inverseView3D is the light's
131
+ // view rather than the camera's. Only a transpose is needed here, no inverse.
132
+ const inverseViewTranspose = Matrix4.transpose(
133
+ context.uniformState.inverseView3D,
134
+ scratchClippingPlanesMatrix,
135
+ );
136
+ // The view-independent part, inverseTranspose(reference * clipping), is
137
+ // computed once per frame in Model.updateReferenceMatrices.
138
+ //
139
+ // This recomputes the same product for every primitive of a model within
140
+ // a pass. If it ever shows up in profiling, see the discussion of
141
+ // alternatives in https://github.com/CesiumGS/cesium/pull/13388.
142
+ return Matrix4.multiply(
143
+ inverseViewTranspose,
144
+ model._clippingPlanesMatrix,
145
+ scratchClippingPlanesMatrix2,
146
+ );
120
147
  },
121
148
  };
122
149