@cesium/engine 24.0.0 → 26.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.
- package/Build/Workers/{chunk-6WLHJFD3.js → chunk-3VFEWOBI.js} +59 -32
- package/Build/Workers/{chunk-UQU4RXLT.js → chunk-424RNO3D.js} +50 -45
- package/Build/Workers/chunk-4MGMYHOO.js +147 -0
- package/Build/Workers/{chunk-AMIHNSST.js → chunk-4S7IE3LB.js} +2 -2
- package/Build/Workers/{chunk-J6AW5YHS.js → chunk-52JDLOEM.js} +14 -14
- package/Build/Workers/{chunk-6RMS4S72.js → chunk-54I6Y66F.js} +6 -6
- package/Build/Workers/{chunk-C6P4IG5P.js → chunk-6YEE6JDR.js} +6 -6
- package/Build/Workers/{chunk-72VYSVEW.js → chunk-7J2HKPRH.js} +11 -10
- package/Build/Workers/{chunk-7O5XJTVE.js → chunk-7WM2PX4V.js} +5 -5
- package/Build/Workers/{chunk-5A2SW66E.js → chunk-ACXQXN46.js} +16 -16
- package/Build/Workers/{chunk-VLDEUTOP.js → chunk-AYKR4VBR.js} +2 -2
- package/Build/Workers/{chunk-YQFTYQMZ.js → chunk-C6J67V5A.js} +3 -2
- package/Build/Workers/{chunk-D4EJ2NXG.js → chunk-C6KNZ7T4.js} +17 -17
- package/Build/Workers/{chunk-7MDYBRYJ.js → chunk-CFQP6LYM.js} +4 -4
- package/Build/Workers/{chunk-YAOZMOFL.js → chunk-CXOYE2WM.js} +5 -5
- package/Build/Workers/{chunk-B6SCUUFP.js → chunk-CZEYZU4N.js} +10 -10
- package/Build/Workers/{chunk-NPF7SSHZ.js → chunk-DBOEKL43.js} +7 -7
- package/Build/Workers/{chunk-44EMEGKW.js → chunk-DDWSZVMY.js} +5 -5
- package/Build/Workers/{chunk-7X322WP2.js → chunk-DOBXCNC3.js} +13 -13
- package/Build/Workers/{chunk-JCI63T3K.js → chunk-E7VQ76KE.js} +6 -6
- package/Build/Workers/{chunk-7TYLCBGK.js → chunk-EBSIOBXY.js} +12 -10
- package/Build/Workers/{chunk-GQUNK2XC.js → chunk-EF2QYXGA.js} +14 -14
- package/Build/Workers/{chunk-BJD6QGXZ.js → chunk-EPYXRCDB.js} +12 -12
- package/Build/Workers/{chunk-63SIWPLS.js → chunk-F6QDY6HU.js} +13 -13
- package/Build/Workers/{chunk-XY6HMDGI.js → chunk-FRQZECAO.js} +5 -5
- package/Build/Workers/{chunk-VMVOUQ5J.js → chunk-G7PXZRVF.js} +7 -7
- package/Build/Workers/{chunk-N65BAKSH.js → chunk-INUEEEQA.js} +8 -8
- package/Build/Workers/{chunk-7QRFIKWQ.js → chunk-IRBKFCEJ.js} +2 -2
- package/Build/Workers/{chunk-UIGVOKKI.js → chunk-IYOUHCZB.js} +3 -2
- package/Build/Workers/{chunk-5GXYJQ2K.js → chunk-J6BWOHUF.js} +3 -3
- package/Build/Workers/{chunk-A47HVBC5.js → chunk-KFSTQKNM.js} +7 -7
- package/Build/Workers/{chunk-EV3VGO6Y.js → chunk-KKOSKAZB.js} +17 -17
- package/Build/Workers/{chunk-6MPGQEHA.js → chunk-KSSWJIZW.js} +2 -2
- package/Build/Workers/{chunk-DHKPFLSJ.js → chunk-M3B5JKSM.js} +3 -2
- package/Build/Workers/chunk-MPZHGZU6.js +2342 -0
- package/Build/Workers/{chunk-YJZGW74L.js → chunk-MYP774IS.js} +2213 -1349
- package/Build/Workers/{chunk-LIB2H534.js → chunk-O3EA5HS7.js} +12 -11
- package/Build/Workers/{chunk-ILMFADZA.js → chunk-P3CK7MCY.js} +27 -5
- package/Build/Workers/chunk-Q3PY526V.js +3201 -0
- package/Build/Workers/chunk-QN67VG36.js +973 -0
- package/Build/Workers/{chunk-XJRBB253.js → chunk-QRWGUWI6.js} +11 -11
- package/Build/Workers/{chunk-AF3MU2RL.js → chunk-S4MCOY6I.js} +7 -6
- package/Build/Workers/{chunk-Y7HNNPNK.js → chunk-SMQZZOW6.js} +10 -10
- package/Build/Workers/{chunk-PVV64VFW.js → chunk-TKKIREQ6.js} +3 -2
- package/Build/Workers/{chunk-MKM27KGV.js → chunk-U3ZA64U7.js} +2 -2
- package/Build/Workers/{chunk-2N4KDHS3.js → chunk-UA25D5MX.js} +12 -11
- package/Build/Workers/{chunk-RQNJD3O4.js → chunk-UOOIQ3KX.js} +12 -12
- package/Build/Workers/{chunk-GOQBUCXH.js → chunk-V7VQKN6N.js} +709 -431
- package/Build/Workers/{chunk-LXMCPFFS.js → chunk-VQYETPWC.js} +4 -4
- package/Build/Workers/{chunk-NKT5K3K3.js → chunk-VWV2IJRB.js} +13 -12
- package/Build/Workers/chunk-XZMBNNDX.js +1287 -0
- package/Build/Workers/{chunk-ISY4EZCA.js → chunk-Y57HREW5.js} +4 -4
- package/Build/Workers/{chunk-EDXL4W76.js → chunk-Y5BF6AFU.js} +2 -2
- package/Build/Workers/{chunk-Q3C6VQH6.js → chunk-YLY7NKAB.js} +4 -4
- package/Build/Workers/{chunk-4TIG36AW.js → chunk-ZK3CF7ZD.js} +12 -12
- package/Build/Workers/{chunk-AJLTU6PF.js → chunk-ZP7JMQV4.js} +4 -1
- package/Build/Workers/{chunk-HXJMS2ZI.js → chunk-ZZ46LWL6.js} +1 -1
- package/Build/Workers/combineGeometry.js +24 -24
- package/Build/Workers/createBoxGeometry.js +18 -18
- package/Build/Workers/createBoxOutlineGeometry.js +16 -16
- package/Build/Workers/createCircleGeometry.js +26 -26
- package/Build/Workers/createCircleOutlineGeometry.js +19 -19
- package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
- package/Build/Workers/createCorridorGeometry.js +29 -29
- package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
- package/Build/Workers/createCylinderGeometry.js +20 -20
- package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
- package/Build/Workers/createEllipseGeometry.js +26 -26
- package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
- package/Build/Workers/createEllipsoidGeometry.js +19 -19
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
- package/Build/Workers/createFrustumGeometry.js +18 -18
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
- package/Build/Workers/createGeometry.js +24 -24
- package/Build/Workers/createGroundPolylineGeometry.js +175 -118
- package/Build/Workers/createPlaneGeometry.js +16 -16
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
- package/Build/Workers/createPolygonGeometry.js +32 -32
- package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
- package/Build/Workers/createPolylineGeometry.js +25 -25
- package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
- package/Build/Workers/createRectangleGeometry.js +27 -27
- package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
- package/Build/Workers/createSimplePolylineGeometry.js +23 -23
- package/Build/Workers/createSphereGeometry.js +19 -19
- package/Build/Workers/createSphereOutlineGeometry.js +18 -18
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -24
- package/Build/Workers/createVectorTilePoints.js +13 -13
- package/Build/Workers/createVectorTilePolygons.js +22 -22
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
- package/Build/Workers/createVerticesFromHeightmap.js +24 -23
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
- package/Build/Workers/createWallGeometry.js +24 -24
- package/Build/Workers/createWallOutlineGeometry.js +23 -23
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +10 -10
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
- package/Build/Workers/transcodeKTX2.js +12 -9
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Source/Core/ArcType.js +6 -1
- package/Source/Core/ArticulationStageType.js +5 -1
- package/Source/Core/AssociativeArray.js +100 -94
- package/Source/Core/BoundingSphere.js +1296 -1300
- package/Source/Core/Cartesian2.js +1 -1
- package/Source/Core/Cartesian3.js +2 -3
- package/Source/Core/Cartesian4.js +1 -1
- package/Source/Core/Cartographic.js +257 -249
- package/Source/Core/ClockRange.js +6 -1
- package/Source/Core/ClockStep.js +6 -1
- package/Source/Core/Color.js +844 -835
- package/Source/Core/ComponentDatatype.js +39 -1
- package/Source/Core/CornerType.js +6 -1
- package/Source/Core/Credit.js +121 -124
- package/Source/Core/Ellipsoid.js +637 -660
- package/Source/Core/ExtrapolationType.js +6 -1
- package/Source/Core/GeocodeType.js +6 -1
- package/Source/Core/GeographicProjection.js +74 -74
- package/Source/Core/GeographicTilingScheme.js +179 -198
- package/Source/Core/GeometryOffsetAttribute.js +7 -1
- package/Source/Core/GeometryType.js +7 -1
- package/Source/Core/HeightmapEncoding.js +6 -1
- package/Source/Core/Iau2006XysData.js +24 -13
- package/Source/Core/IndexDatatype.js +3 -1
- package/Source/Core/InterpolationType.js +5 -1
- package/Source/Core/Intersect.js +6 -1
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/IonGeocodeProviderType.js +5 -1
- package/Source/Core/JulianDate.js +850 -848
- package/Source/Core/KeyboardEventModifier.js +6 -1
- package/Source/Core/MapProjection.js +40 -44
- package/Source/Core/Matrix2.js +906 -893
- package/Source/Core/Matrix3.js +1643 -1575
- package/Source/Core/Matrix4.js +2903 -2872
- package/Source/Core/PixelFormat.js +3 -1
- package/Source/Core/PrimitiveType.js +11 -1
- package/Source/Core/Ray.js +62 -60
- package/Source/Core/Rectangle.js +913 -904
- package/Source/Core/ReferenceFrame.js +6 -1
- package/Source/Core/RequestScheduler.js +8 -3
- package/Source/Core/RequestState.js +6 -1
- package/Source/Core/RequestType.js +6 -1
- package/Source/Core/Resource.js +1 -1
- package/Source/Core/ScreenSpaceEventHandler.js +51 -41
- package/Source/Core/ScreenSpaceEventType.js +6 -1
- package/Source/Core/TerrainQuantization.js +6 -1
- package/Source/Core/TilingScheme.js +100 -98
- package/Source/Core/TimeConstants.js +6 -1
- package/Source/Core/TimeStandard.js +6 -1
- package/Source/Core/TrackingReferenceFrame.js +6 -1
- package/Source/Core/Visibility.js +6 -1
- package/Source/Core/VulkanConstants.js +6 -1
- package/Source/Core/WebGLConstants.js +6 -1
- package/Source/Core/WebMercatorProjection.js +108 -109
- package/Source/Core/WebMercatorTilingScheme.js +246 -242
- package/Source/Core/WindingOrder.js +3 -1
- package/Source/Core/createColorRamp.js +37 -0
- package/Source/Core/globalTypes.js +25 -0
- package/Source/DataSources/StaticGroundGeometryPerMaterialBatch.js +1 -0
- package/Source/DataSources/StaticGroundPolylinePerMaterialBatch.js +1 -0
- package/Source/DataSources/StripeOrientation.js +6 -1
- package/Source/Renderer/BufferUsage.js +20 -9
- package/Source/Renderer/Context.js +2 -29
- package/Source/Renderer/DrawCommand.js +435 -403
- package/Source/Renderer/MipmapHint.js +5 -1
- package/Source/Renderer/Pass.js +10 -3
- package/Source/Renderer/PickId.js +44 -0
- package/Source/Renderer/PixelDatatype.js +3 -1
- package/Source/Renderer/RenderbufferFormat.js +5 -1
- package/Source/Renderer/ShaderDestination.js +4 -1
- package/Source/Renderer/TextureMagnificationFilter.js +3 -1
- package/Source/Renderer/TextureMinificationFilter.js +3 -1
- package/Source/Renderer/TextureWrap.js +5 -1
- package/Source/Renderer/createUniform.js +346 -239
- package/Source/Renderer/createUniformArray.js +494 -381
- package/Source/Scene/AlphaMode.js +5 -1
- package/Source/Scene/ArcGisBaseMapType.js +6 -1
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/AttributeType.js +3 -1
- package/Source/Scene/Axis.js +3 -1
- package/Source/Scene/BingMapsStyle.js +6 -1
- package/Source/Scene/BlendEquation.js +6 -1
- package/Source/Scene/BlendFunction.js +6 -1
- package/Source/Scene/BlendOption.js +6 -1
- package/Source/Scene/BlendingState.js +6 -1
- package/Source/Scene/BufferLoader.js +0 -2
- package/Source/Scene/BufferPoint.js +1 -0
- package/Source/Scene/BufferPointCollection.js +17 -1
- package/Source/Scene/BufferPolygon.js +3 -2
- package/Source/Scene/BufferPolygonCollection.js +13 -1
- package/Source/Scene/BufferPolyline.js +1 -0
- package/Source/Scene/BufferPolylineCollection.js +5 -1
- package/Source/Scene/BufferPrimitiveCollection.js +210 -43
- package/Source/Scene/CameraEventAggregator.js +30 -18
- package/Source/Scene/CameraEventType.js +6 -1
- package/Source/Scene/Cesium3DTile.js +54 -1
- package/Source/Scene/Cesium3DTileColorBlendMode.js +6 -1
- package/Source/Scene/Cesium3DTileContent.js +195 -254
- package/Source/Scene/Cesium3DTileContentFactory.js +10 -2
- package/Source/Scene/Cesium3DTileContentState.js +6 -1
- package/Source/Scene/Cesium3DTileContentType.js +3 -1
- package/Source/Scene/Cesium3DTileFeature.js +289 -306
- package/Source/Scene/Cesium3DTileOptimizationHint.js +6 -1
- package/Source/Scene/Cesium3DTilePass.js +5 -1
- package/Source/Scene/Cesium3DTilePointFeature.js +433 -511
- package/Source/Scene/Cesium3DTileRefine.js +6 -1
- package/Source/Scene/Cesium3DTileVectorFeature.js +586 -0
- package/Source/Scene/Cesium3DTileset.js +46 -6
- package/Source/Scene/ClassificationType.js +3 -1
- package/Source/Scene/CloudType.js +3 -1
- package/Source/Scene/ColorBlendMode.js +4 -1
- package/Source/Scene/Composite3DTileContent.js +254 -292
- package/Source/Scene/CullFace.js +6 -1
- package/Source/Scene/DepthFunction.js +6 -1
- package/Source/Scene/DynamicAtmosphereLightingType.js +3 -1
- package/Source/Scene/EdgeDisplayMode.js +50 -0
- package/Source/Scene/Empty3DTileContent.js +100 -132
- package/Source/Scene/EquirectangularPanorama.js +1 -0
- package/Source/Scene/ExpressionNodeType.js +6 -1
- package/Source/Scene/GaussianSplat3DTileContent.js +436 -478
- package/Source/Scene/GeoJsonPrimitive.js +874 -0
- package/Source/Scene/Geometry3DTileContent.js +151 -185
- package/Source/Scene/GltfBufferViewLoader.js +0 -2
- package/Source/Scene/GltfDracoLoader.js +0 -2
- package/Source/Scene/GltfImageLoader.js +0 -3
- package/Source/Scene/GltfIndexBufferLoader.js +0 -4
- package/Source/Scene/GltfJsonLoader.js +0 -2
- package/Source/Scene/GltfLoader.js +109 -5
- package/Source/Scene/GltfLoaderUtil.js +14 -0
- package/Source/Scene/GltfSpzLoader.js +0 -2
- package/Source/Scene/GltfStructuralMetadataLoader.js +0 -2
- package/Source/Scene/GltfTextureLoader.js +0 -2
- package/Source/Scene/GltfVertexBufferLoader.js +0 -4
- package/Source/Scene/HeightReference.js +5 -1
- package/Source/Scene/HorizontalOrigin.js +6 -1
- package/Source/Scene/ImageryProvider.js +1 -1
- package/Source/Scene/ImageryState.js +6 -1
- package/Source/Scene/Implicit3DTileContent.js +179 -214
- package/Source/Scene/ImplicitSubdivisionScheme.js +3 -1
- package/Source/Scene/InstanceAttributeSemantic.js +3 -1
- package/Source/Scene/IonWorldImageryStyle.js +6 -1
- package/Source/Scene/JobType.js +6 -1
- package/Source/Scene/LabelStyle.js +6 -1
- package/Source/Scene/MVTDataProvider.js +147 -0
- package/Source/Scene/MapMode2D.js +6 -1
- package/Source/Scene/MetadataComponentType.js +3 -1
- package/Source/Scene/MetadataSchemaLoader.js +0 -2
- package/Source/Scene/MetadataSemantic.js +6 -2
- package/Source/Scene/MetadataType.js +3 -1
- package/Source/Scene/Model/B3dmLoader.js +0 -3
- package/Source/Scene/Model/CustomShaderMode.js +3 -1
- package/Source/Scene/Model/CustomShaderTranslucencyMode.js +5 -1
- package/Source/Scene/Model/EdgeVisibilityPipelineStage.js +78 -337
- package/Source/Scene/Model/Extensions/Gpm/PpeSource.js +5 -1
- package/Source/Scene/Model/Extensions/Gpm/StorageType.js +5 -1
- package/Source/Scene/Model/GeoJsonLoader.js +0 -2
- package/Source/Scene/Model/I3dmLoader.js +0 -3
- package/Source/Scene/Model/InstancingPipelineStage.js +1 -1
- package/Source/Scene/Model/LightingModel.js +5 -1
- package/Source/Scene/Model/MaterialPipelineStage.js +184 -3
- package/Source/Scene/Model/Model.js +34 -0
- package/Source/Scene/Model/Model3DTileContent.js +424 -458
- package/Source/Scene/Model/ModelDrawCommand.js +31 -3
- package/Source/Scene/Model/ModelReader.js +474 -3
- package/Source/Scene/Model/ModelRuntimePrimitive.js +2 -1
- package/Source/Scene/Model/ModelType.js +3 -1
- package/Source/Scene/Model/ModelUtility.js +4 -0
- package/Source/Scene/Model/PntsLoader.js +4 -3
- package/Source/Scene/Model/StyleCommandsNeeded.js +3 -1
- package/Source/Scene/Model/UniformType.js +5 -1
- package/Source/Scene/Model/VaryingType.js +5 -1
- package/Source/Scene/Model/createVectorTileBuffersFromModelComponents.js +500 -139
- package/Source/Scene/Model/pickModel.js +94 -299
- package/Source/Scene/ModelAnimationLoop.js +6 -1
- package/Source/Scene/ModelAnimationState.js +6 -1
- package/Source/Scene/ModelComponents.js +47 -2
- package/Source/Scene/Multiple3DTileContent.js +291 -334
- package/Source/Scene/PrimitiveState.js +7 -1
- package/Source/Scene/QuadtreeOccluders.js +20 -15
- package/Source/Scene/QuadtreeTile.js +547 -541
- package/Source/Scene/QuadtreeTileLoadState.js +6 -1
- package/Source/Scene/QuadtreeTileProvider.js +159 -175
- package/Source/Scene/ResourceLoader.js +0 -1
- package/Source/Scene/ResourceLoaderState.js +7 -1
- package/Source/Scene/Scene.js +26 -0
- package/Source/Scene/SceneMode.js +4 -1
- package/Source/Scene/ShadowMode.js +3 -1
- package/Source/Scene/SkyBox.js +1 -1
- package/Source/Scene/SplitDirection.js +6 -1
- package/Source/Scene/StencilFunction.js +6 -1
- package/Source/Scene/StencilOperation.js +6 -1
- package/Source/Scene/TerrainState.js +7 -1
- package/Source/Scene/TileState.js +7 -1
- package/Source/Scene/Tileset3DTileContent.js +113 -146
- package/Source/Scene/Tonemapper.js +5 -1
- package/Source/Scene/UrlTemplate3DTilesDataProvider.js +499 -0
- package/Source/Scene/Vector3DTileContent.js +205 -234
- package/Source/Scene/VectorGltf3DTileContent.js +131 -61
- package/Source/Scene/VertexAttributeSemantic.js +3 -1
- package/Source/Scene/VerticalOrigin.js +6 -1
- package/Source/Scene/VoxelBoxShape.js +12 -6
- package/Source/Scene/VoxelContent.js +2 -0
- package/Source/Scene/VoxelCylinderShape.js +39 -38
- package/Source/Scene/VoxelEllipsoidShape.js +46 -96
- package/Source/Scene/VoxelMetadataOrder.js +6 -1
- package/Source/Scene/VoxelPrimitive.js +159 -175
- package/Source/Scene/VoxelProvider.js +64 -90
- package/Source/Scene/VoxelShapeType.js +3 -1
- package/Source/Scene/buildVectorGltfFromMVT.js +1059 -0
- package/Source/Scene/buildVoxelCustomShader.js +199 -0
- package/Source/Scene/decodeMVT.js +634 -0
- package/Source/Scene/renderBufferPointCollection.js +124 -127
- package/Source/Scene/renderBufferPolygonCollection.js +122 -122
- package/Source/Scene/renderBufferPolylineCollection.js +386 -238
- package/Source/Shaders/BufferPointMaterialFS.glsl +1 -0
- package/Source/Shaders/BufferPointMaterialFS.js +1 -0
- package/Source/Shaders/BufferPointMaterialVS.glsl +19 -9
- package/Source/Shaders/BufferPointMaterialVS.js +20 -10
- package/Source/Shaders/BufferPolygonMaterialVS.glsl +13 -4
- package/Source/Shaders/BufferPolygonMaterialVS.js +14 -5
- package/Source/Shaders/BufferPolylineMaterialVS.glsl +16 -2
- package/Source/Shaders/BufferPolylineMaterialVS.js +17 -3
- package/Source/Shaders/Builtin/Constants/passCesium3DTileEdgesDirect.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passCesium3DTileEdgesDirect.js +11 -0
- package/Source/Shaders/Builtin/Constants/passOverlay.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passOverlay.js +1 -1
- package/Source/Shaders/Builtin/CzmBuiltins.js +4 -0
- package/Source/Shaders/Builtin/Functions/computeTextureTransform.glsl +24 -0
- package/Source/Shaders/Builtin/Functions/computeTextureTransform.js +25 -0
- package/Source/Shaders/Model/ConstantLodStageFS.glsl +60 -0
- package/Source/Shaders/Model/ConstantLodStageFS.js +62 -0
- package/Source/Shaders/Model/ConstantLodStageVS.glsl +12 -0
- package/Source/Shaders/Model/ConstantLodStageVS.js +13 -0
- package/Source/Shaders/Model/EdgeVisibilityStageVS.glsl +0 -1
- package/Source/Shaders/Model/EdgeVisibilityStageVS.js +0 -1
- package/Source/Shaders/Model/MaterialStageFS.glsl +46 -20
- package/Source/Shaders/Model/MaterialStageFS.js +46 -20
- package/Source/Shaders/Voxels/convertLocalToBoxUv.glsl +0 -1
- package/Source/Shaders/Voxels/convertLocalToBoxUv.js +0 -1
- package/Source/Shaders/Voxels/convertLocalToCylinderUv.glsl +7 -9
- package/Source/Shaders/Voxels/convertLocalToCylinderUv.js +7 -9
- package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.glsl +7 -17
- package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.js +7 -17
- package/Source/Widget/CesiumWidget.js +11 -4
- package/index.d.ts +595 -343
- package/index.js +392 -378
- package/package.json +3 -3
- package/Build/Workers/chunk-DVB56LG7.js +0 -114
- package/Build/Workers/chunk-HKUES6UG.js +0 -2357
- package/Build/Workers/chunk-HRHRYFHS.js +0 -940
- package/Build/Workers/chunk-KLPGTXS3.js +0 -642
- package/Build/Workers/chunk-ZBZRTRJB.js +0 -1829
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
3
|
import Cartesian3 from "../../Core/Cartesian3.js";
|
|
4
|
-
import assert from "../../Core/assert.js";
|
|
5
4
|
import defined from "../../Core/defined.js";
|
|
6
5
|
import Matrix4 from "../../Core/Matrix4.js";
|
|
7
6
|
import PrimitiveType from "../../Core/PrimitiveType.js";
|
|
@@ -16,17 +15,20 @@ import VertexAttributeSemantic from "../VertexAttributeSemantic.js";
|
|
|
16
15
|
import ModelReader from "./ModelReader.js";
|
|
17
16
|
import ModelUtility from "./ModelUtility.js";
|
|
18
17
|
import ModelComponents from "../ModelComponents.js";
|
|
18
|
+
import Cesium3DTileVectorFeature from "../Cesium3DTileVectorFeature.js";
|
|
19
19
|
|
|
20
|
-
/** @import { TypedArray } from "../../Core/globalTypes.js"; */
|
|
20
|
+
/** @import { TypedArray, TypedArrayConstructor } from "../../Core/globalTypes.js"; */
|
|
21
21
|
/** @import BufferPrimitive from "../BufferPrimitive.js"; */
|
|
22
22
|
/** @import BufferPrimitiveCollection from "../BufferPrimitiveCollection.js"; */
|
|
23
23
|
/** @import VectorGltf3DTileContent from "../VectorGltf3DTileContent.js"; */
|
|
24
|
-
/** @import {Attribute, Components, Node, Primitive} from "../ModelComponents.js"; */
|
|
24
|
+
/** @import {Attribute, Components, Node, Polygon, Primitive, Vector} from "../ModelComponents.js"; */
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* @typedef {object} VectorTileResult
|
|
28
|
-
* @property {Array<BufferPrimitiveCollection<BufferPrimitive>>} collections
|
|
29
|
-
* @property {Array<Matrix4>} collectionLocalMatrices
|
|
28
|
+
* @property {Array<BufferPrimitiveCollection<BufferPrimitive>>} collections List of all vector primitive collections.
|
|
29
|
+
* @property {Array<Matrix4>} collectionLocalMatrices List of transform matrices for each collection; order matches 'collections'.
|
|
30
|
+
* @property {Map<BufferPrimitiveCollection<BufferPrimitive>, number>} collectionFeatureTableIds Maps vector primitive collection -> propertyTableId.
|
|
31
|
+
* @property {Map<number, Map<number, Cesium3DTileVectorFeature>>} featuresByTableId Maps propertyTableId -> featureId -> feature.
|
|
30
32
|
* @ignore
|
|
31
33
|
*/
|
|
32
34
|
|
|
@@ -48,7 +50,12 @@ function createVectorTileBuffersFromModelComponents(content, components) {
|
|
|
48
50
|
const rootNodes = components.scene.nodes;
|
|
49
51
|
|
|
50
52
|
/** @type {VectorTileResult} */
|
|
51
|
-
const result = {
|
|
53
|
+
const result = {
|
|
54
|
+
collections: [],
|
|
55
|
+
collectionLocalMatrices: [],
|
|
56
|
+
collectionFeatureTableIds: new Map(),
|
|
57
|
+
featuresByTableId: new Map(),
|
|
58
|
+
};
|
|
52
59
|
|
|
53
60
|
for (let i = 0; i < rootNodes.length; i++) {
|
|
54
61
|
appendNodeToBuffers(content, rootNodes[i], Matrix4.IDENTITY, result);
|
|
@@ -66,25 +73,6 @@ function getPrimitiveRestartIndex(indices) {
|
|
|
66
73
|
return Math.pow(2, bits) - 1;
|
|
67
74
|
}
|
|
68
75
|
|
|
69
|
-
/**
|
|
70
|
-
* @param {TypedArray} indices
|
|
71
|
-
* @param {Function} callback
|
|
72
|
-
* @ignore
|
|
73
|
-
*/
|
|
74
|
-
function forEachLineStripSegment(indices, callback) {
|
|
75
|
-
const restart = getPrimitiveRestartIndex(indices);
|
|
76
|
-
let segmentStart = 0;
|
|
77
|
-
for (let i = 0; i <= indices.length; i++) {
|
|
78
|
-
if (i === indices.length || indices[i] === restart) {
|
|
79
|
-
const segmentCount = i - segmentStart;
|
|
80
|
-
if (segmentCount > 0) {
|
|
81
|
-
callback(segmentStart, segmentCount);
|
|
82
|
-
}
|
|
83
|
-
segmentStart = i + 1;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
76
|
/**
|
|
89
77
|
* @param {Primitive} primitive
|
|
90
78
|
* @ignore
|
|
@@ -102,6 +90,7 @@ function gatherPrimitiveStats(primitive) {
|
|
|
102
90
|
};
|
|
103
91
|
|
|
104
92
|
const vector = primitive.vector;
|
|
93
|
+
const polygon = primitive.polygon;
|
|
105
94
|
const primitiveType = primitive.primitiveType;
|
|
106
95
|
const positionAttribute = ModelUtility.getAttributeBySemantic(
|
|
107
96
|
primitive,
|
|
@@ -113,35 +102,34 @@ function gatherPrimitiveStats(primitive) {
|
|
|
113
102
|
? ModelReader.readIndicesAsTypedArray(primitive.indices)
|
|
114
103
|
: undefined;
|
|
115
104
|
|
|
116
|
-
// @ts-expect-error Requires https://github.com/CesiumGS/cesium/pull/13203.
|
|
117
105
|
if (primitiveType === PrimitiveType.POINTS) {
|
|
118
|
-
stats.pointPrimitiveCount +=
|
|
119
|
-
stats.pointVertexCount +=
|
|
120
|
-
|
|
121
|
-
// @ts-expect-error Requires https://github.com/CesiumGS/cesium/pull/13203.
|
|
106
|
+
stats.pointPrimitiveCount += positionCount;
|
|
107
|
+
stats.pointVertexCount += positionCount;
|
|
122
108
|
} else if (primitiveType === PrimitiveType.LINE_STRIP) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
const polygonHoleCounts = vector.polygonHoleCounts;
|
|
141
|
-
if (polygonHoleCounts) {
|
|
142
|
-
for (let i = 0; i < polygonHoleCounts.length; i++) {
|
|
143
|
-
stats.polygonHoleCount += polygonHoleCounts[i];
|
|
109
|
+
const stripCount = vector ? vector.count : getPrimitiveCount(indices);
|
|
110
|
+
stats.polylinePrimitiveCount += stripCount;
|
|
111
|
+
stats.polylineVertexCount += indices.length - stripCount + 1;
|
|
112
|
+
} else if (
|
|
113
|
+
primitiveType === PrimitiveType.TRIANGLES ||
|
|
114
|
+
primitiveType === PrimitiveType.LINE_LOOP
|
|
115
|
+
) {
|
|
116
|
+
if (vector) {
|
|
117
|
+
stats.polygonPrimitiveCount += vector.count;
|
|
118
|
+
stats.polygonVertexCount += positionCount;
|
|
119
|
+
stats.polygonTriangleCount += indices.length / 3;
|
|
120
|
+
|
|
121
|
+
const polygonHoleCounts = vector.polygonHoleCounts;
|
|
122
|
+
if (polygonHoleCounts) {
|
|
123
|
+
for (let i = 0; i < polygonHoleCounts.length; i++) {
|
|
124
|
+
stats.polygonHoleCount += polygonHoleCounts[i];
|
|
125
|
+
}
|
|
144
126
|
}
|
|
127
|
+
} else {
|
|
128
|
+
const loopCount = getPrimitiveCount(polygon.loopIndices);
|
|
129
|
+
stats.polygonPrimitiveCount += polygon.count;
|
|
130
|
+
stats.polygonVertexCount += polygon.loopIndices.length - loopCount + 1;
|
|
131
|
+
stats.polygonTriangleCount += polygon.triangleIndices.length;
|
|
132
|
+
stats.polygonHoleCount += loopCount - polygon.count;
|
|
145
133
|
}
|
|
146
134
|
} else {
|
|
147
135
|
throw new RuntimeError(`Unexpected primitive type: ${primitiveType}`);
|
|
@@ -150,14 +138,42 @@ function gatherPrimitiveStats(primitive) {
|
|
|
150
138
|
return stats;
|
|
151
139
|
}
|
|
152
140
|
|
|
141
|
+
/**
|
|
142
|
+
* Returns the number of GL primitives, separated by primitive restart index
|
|
143
|
+
* values, defined in the given index list.
|
|
144
|
+
*
|
|
145
|
+
* @param {TypedArray} indices
|
|
146
|
+
* @ignore
|
|
147
|
+
*/
|
|
148
|
+
function getPrimitiveCount(indices) {
|
|
149
|
+
const restart = getPrimitiveRestartIndex(indices);
|
|
150
|
+
|
|
151
|
+
let count = 0;
|
|
152
|
+
|
|
153
|
+
for (let i = 0; i < indices.length; i++) {
|
|
154
|
+
if (indices[i] === restart && i + 1 < indices.length) {
|
|
155
|
+
count++;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return count + 1;
|
|
160
|
+
}
|
|
161
|
+
|
|
153
162
|
/**
|
|
154
163
|
* @param {VectorGltf3DTileContent} content
|
|
155
164
|
* @param {Primitive} primitive
|
|
156
165
|
* @param {BufferPrimitiveCollection<BufferPrimitive>} collection
|
|
166
|
+
* @param {number} collectionIndex
|
|
167
|
+
* @param {Map<number, Cesium3DTileVectorFeature>} features
|
|
157
168
|
* @ignore
|
|
158
169
|
*/
|
|
159
|
-
function appendPrimitiveToBuffers(
|
|
160
|
-
|
|
170
|
+
function appendPrimitiveToBuffers(
|
|
171
|
+
content,
|
|
172
|
+
primitive,
|
|
173
|
+
collection,
|
|
174
|
+
collectionIndex,
|
|
175
|
+
features,
|
|
176
|
+
) {
|
|
161
177
|
const positionAttribute = ModelUtility.getAttributeBySemantic(
|
|
162
178
|
primitive,
|
|
163
179
|
VertexAttributeSemantic.POSITION,
|
|
@@ -165,102 +181,370 @@ function appendPrimitiveToBuffers(content, primitive, collection) {
|
|
|
165
181
|
/** @type {TypedArray} */
|
|
166
182
|
const collectionPositions =
|
|
167
183
|
positionAttribute.typedArray ??
|
|
168
|
-
|
|
169
|
-
|
|
184
|
+
(collection.positionNormalized
|
|
185
|
+
? ModelReader.readAttributeAsRawCompactTypedArray(positionAttribute)
|
|
186
|
+
: ModelReader.readAttributeAsTypedArray(positionAttribute));
|
|
170
187
|
|
|
171
188
|
/** @type {TypedArray} */
|
|
172
189
|
const indices = primitive.indices
|
|
173
190
|
? ModelReader.readIndicesAsTypedArray(primitive.indices)
|
|
174
191
|
: undefined;
|
|
175
192
|
|
|
176
|
-
const
|
|
177
|
-
/** @type {Attribute} */
|
|
178
|
-
let featureIdAttribute;
|
|
179
|
-
/** @type {TypedArray} */
|
|
180
|
-
let featureIdArray;
|
|
181
|
-
if (featureIdComponent instanceof ModelComponents.FeatureIdAttribute) {
|
|
182
|
-
featureIdAttribute = ModelUtility.getAttributeBySemantic(
|
|
183
|
-
primitive,
|
|
184
|
-
VertexAttributeSemantic.FEATURE_ID,
|
|
185
|
-
featureIdComponent.setIndex,
|
|
186
|
-
);
|
|
187
|
-
featureIdArray =
|
|
188
|
-
featureIdAttribute.typedArray ??
|
|
189
|
-
ModelReader.readAttributeAsTypedArray(featureIdAttribute);
|
|
190
|
-
}
|
|
193
|
+
const getFeature = createFeatureFactoryFn(content, primitive, features);
|
|
191
194
|
|
|
192
195
|
if (collection instanceof BufferPointCollection) {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
196
|
+
appendBufferPoints(
|
|
197
|
+
collection,
|
|
198
|
+
collectionIndex,
|
|
199
|
+
collectionPositions,
|
|
200
|
+
indices,
|
|
201
|
+
getFeature,
|
|
202
|
+
);
|
|
203
|
+
} else if (collection instanceof BufferPolylineCollection) {
|
|
204
|
+
appendBufferPolylines(
|
|
205
|
+
collection,
|
|
206
|
+
collectionIndex,
|
|
207
|
+
collectionPositions,
|
|
208
|
+
indices,
|
|
209
|
+
getFeature,
|
|
210
|
+
);
|
|
211
|
+
} else if (collection instanceof BufferPolygonCollection) {
|
|
212
|
+
if (defined(primitive.vector)) {
|
|
213
|
+
appendBufferPolygonsDeprecated(
|
|
214
|
+
collection,
|
|
215
|
+
collectionIndex,
|
|
197
216
|
collectionPositions,
|
|
198
|
-
|
|
199
|
-
|
|
217
|
+
indices,
|
|
218
|
+
getFeature,
|
|
219
|
+
primitive.vector,
|
|
200
220
|
);
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
} else if (collection instanceof BufferPolylineCollection) {
|
|
209
|
-
// @ts-expect-error TODO
|
|
210
|
-
forEachLineStripSegment(indices, (indexOffset, indexCount) => {
|
|
211
|
-
const vertexOffset = indices[indexOffset];
|
|
212
|
-
const positions = collectionPositions.subarray(
|
|
213
|
-
vertexOffset * 3,
|
|
214
|
-
(vertexOffset + indexCount) * 3,
|
|
221
|
+
} else {
|
|
222
|
+
appendBufferPolygons(
|
|
223
|
+
collection,
|
|
224
|
+
collectionIndex,
|
|
225
|
+
collectionPositions,
|
|
226
|
+
getFeature,
|
|
227
|
+
primitive.polygon,
|
|
215
228
|
);
|
|
216
|
-
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
217
232
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
233
|
+
/**
|
|
234
|
+
* @callback FeatureFactoryFn
|
|
235
|
+
* @param {number} vertexOffset
|
|
236
|
+
* @returns {Cesium3DTileVectorFeature|undefined}
|
|
237
|
+
* @ignore
|
|
238
|
+
*/
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Returns a factory function that, given a vertex offset, returns the
|
|
242
|
+
* Cesium3DTileVectorFeature instance associated with the vertex.
|
|
243
|
+
*
|
|
244
|
+
* @param {VectorGltf3DTileContent} content
|
|
245
|
+
* @param {Primitive} primitive
|
|
246
|
+
* @param {Map<number, Cesium3DTileVectorFeature>} features
|
|
247
|
+
* @returns {FeatureFactoryFn}
|
|
248
|
+
* @ignore
|
|
249
|
+
*/
|
|
250
|
+
function createFeatureFactoryFn(content, primitive, features) {
|
|
251
|
+
// @ts-expect-error Missing types.
|
|
252
|
+
const label = content.tileset.featureIdLabel;
|
|
253
|
+
const featureIdComponent = ModelUtility.getFeatureIdsByLabel(
|
|
254
|
+
primitive.featureIds,
|
|
255
|
+
label,
|
|
256
|
+
);
|
|
257
|
+
|
|
258
|
+
if (!(featureIdComponent instanceof ModelComponents.FeatureIdAttribute)) {
|
|
259
|
+
return () => undefined;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
const featureIdAttribute = ModelUtility.getAttributeBySemantic(
|
|
263
|
+
primitive,
|
|
264
|
+
VertexAttributeSemantic.FEATURE_ID,
|
|
265
|
+
featureIdComponent.setIndex,
|
|
266
|
+
);
|
|
267
|
+
|
|
268
|
+
/** @type {TypedArray} */
|
|
269
|
+
const featureIdArray =
|
|
270
|
+
featureIdAttribute.typedArray ??
|
|
271
|
+
ModelReader.readAttributeAsTypedArray(featureIdAttribute);
|
|
272
|
+
|
|
273
|
+
for (let i = 0; i < featureIdArray.length; i++) {
|
|
274
|
+
const featureId = featureIdArray[i];
|
|
275
|
+
if (!features.has(featureId)) {
|
|
276
|
+
const feature = new Cesium3DTileVectorFeature(
|
|
277
|
+
content,
|
|
278
|
+
featureId,
|
|
279
|
+
featureIdComponent.propertyTableId,
|
|
238
280
|
);
|
|
281
|
+
features.set(featureId, feature);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
239
284
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
285
|
+
/** @type {FeatureFactoryFn} */
|
|
286
|
+
return function getFeature(vertexOffset) {
|
|
287
|
+
const featureId = featureIdArray[vertexOffset];
|
|
288
|
+
if (featureId !== featureIdComponent.nullFeatureId) {
|
|
289
|
+
return features.get(featureId);
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* @param {BufferPointCollection} collection
|
|
296
|
+
* @param {number} collectionIndex
|
|
297
|
+
* @param {TypedArray} collectionPositions
|
|
298
|
+
* @param {TypedArray} indices
|
|
299
|
+
* @param {FeatureFactoryFn} getFeature
|
|
300
|
+
* @ignore
|
|
301
|
+
*/
|
|
302
|
+
function appendBufferPoints(
|
|
303
|
+
collection,
|
|
304
|
+
collectionIndex,
|
|
305
|
+
collectionPositions,
|
|
306
|
+
indices,
|
|
307
|
+
getFeature,
|
|
308
|
+
) {
|
|
309
|
+
const vertexCount = collectionPositions.length / 3;
|
|
310
|
+
|
|
311
|
+
for (let i = 0, il = indices ? indices.length : vertexCount; i < il; i++) {
|
|
312
|
+
const vertexOffset = indices ? indices[i] : i;
|
|
313
|
+
Cartesian3.fromArray(
|
|
314
|
+
// @ts-expect-error https://github.com/CesiumGS/cesium/pull/13302
|
|
315
|
+
collectionPositions,
|
|
316
|
+
vertexOffset * 3,
|
|
317
|
+
scratchPosition,
|
|
318
|
+
);
|
|
319
|
+
|
|
320
|
+
const feature = getFeature(vertexOffset);
|
|
321
|
+
if (feature) {
|
|
322
|
+
feature.addPrimitiveByCollection(collectionIndex, i);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
collection.add(
|
|
326
|
+
{
|
|
327
|
+
position: scratchPosition,
|
|
328
|
+
pickObject: feature,
|
|
329
|
+
featureId: feature?.featureId,
|
|
330
|
+
},
|
|
331
|
+
scratchPoint,
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* @param {BufferPolylineCollection} collection
|
|
338
|
+
* @param {number} collectionIndex
|
|
339
|
+
* @param {TypedArray} collectionPositions
|
|
340
|
+
* @param {TypedArray} indices
|
|
341
|
+
* @param {FeatureFactoryFn} getFeature
|
|
342
|
+
* @ignore
|
|
343
|
+
*/
|
|
344
|
+
function appendBufferPolylines(
|
|
345
|
+
collection,
|
|
346
|
+
collectionIndex,
|
|
347
|
+
collectionPositions,
|
|
348
|
+
indices,
|
|
349
|
+
getFeature,
|
|
350
|
+
) {
|
|
351
|
+
const restartIndex = getPrimitiveRestartIndex(indices);
|
|
352
|
+
|
|
353
|
+
let lineIndexStart = 0;
|
|
354
|
+
let lineIndexCount = 0;
|
|
355
|
+
let primitiveIndex = 0;
|
|
356
|
+
|
|
357
|
+
for (let i = 0; i < indices.length; i++) {
|
|
358
|
+
// Iteration has reached the end of a line strip primitive if the current
|
|
359
|
+
// index is a "restart index", or the next index is out of bounds.
|
|
360
|
+
const index = indices[i];
|
|
361
|
+
if (index === restartIndex) {
|
|
362
|
+
lineIndexCount = i - lineIndexStart;
|
|
363
|
+
} else if (i + 1 === indices.length) {
|
|
364
|
+
lineIndexCount = i + 1 - lineIndexStart;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
if (lineIndexCount === 0) {
|
|
368
|
+
continue;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
const lineIndexEnd = lineIndexStart + lineIndexCount;
|
|
372
|
+
const lineIndices = indices.subarray(lineIndexStart, lineIndexEnd);
|
|
373
|
+
const positions = copyArrayByIndices(collectionPositions, lineIndices, 3);
|
|
374
|
+
|
|
375
|
+
const feature = getFeature(indices[lineIndexStart]);
|
|
376
|
+
if (feature) {
|
|
377
|
+
feature.addPrimitiveByCollection(collectionIndex, primitiveIndex);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
collection.add(
|
|
381
|
+
{ positions, pickObject: feature, featureId: feature?.featureId },
|
|
382
|
+
scratchPolyline,
|
|
383
|
+
);
|
|
384
|
+
|
|
385
|
+
lineIndexStart = i + 1;
|
|
386
|
+
lineIndexCount = 0;
|
|
387
|
+
primitiveIndex++;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* @param {BufferPolygonCollection} collection
|
|
393
|
+
* @param {number} collectionIndex
|
|
394
|
+
* @param {TypedArray} collectionPositions
|
|
395
|
+
* @param {TypedArray} indices
|
|
396
|
+
* @param {FeatureFactoryFn} getFeature
|
|
397
|
+
* @param {Vector} vector
|
|
398
|
+
* @deprecated To be removed after v1.142 release.
|
|
399
|
+
* @ignore
|
|
400
|
+
*/
|
|
401
|
+
function appendBufferPolygonsDeprecated(
|
|
402
|
+
collection,
|
|
403
|
+
collectionIndex,
|
|
404
|
+
collectionPositions,
|
|
405
|
+
indices,
|
|
406
|
+
getFeature,
|
|
407
|
+
vector,
|
|
408
|
+
) {
|
|
409
|
+
const polygonAttributeOffsets = vector.polygonAttributeOffsets;
|
|
410
|
+
const polygonIndicesOffsets = vector.polygonIndicesOffsets;
|
|
411
|
+
const polygonHoleCounts = vector.polygonHoleCounts;
|
|
412
|
+
const polygonHoleOffsets = vector.polygonHoleOffsets;
|
|
413
|
+
|
|
414
|
+
const vertexCount = collectionPositions.length / 3;
|
|
415
|
+
const polygonCount = polygonAttributeOffsets.length;
|
|
416
|
+
for (let i = 0; i < polygonCount; i++) {
|
|
417
|
+
const polygonVertexStart = polygonAttributeOffsets[i];
|
|
418
|
+
const polygonVertexEnd =
|
|
419
|
+
i + 1 < polygonCount ? polygonAttributeOffsets[i + 1] : vertexCount;
|
|
420
|
+
|
|
421
|
+
const positions = collectionPositions.subarray(
|
|
422
|
+
polygonVertexStart * 3,
|
|
423
|
+
polygonVertexEnd * 3,
|
|
424
|
+
);
|
|
248
425
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
for (let
|
|
254
|
-
|
|
426
|
+
let holes;
|
|
427
|
+
if (defined(polygonHoleCounts) && polygonHoleCounts[i] > 0) {
|
|
428
|
+
const holeCount = polygonHoleCounts[i];
|
|
429
|
+
holes = polygonHoleOffsets.slice(i, i + holeCount);
|
|
430
|
+
for (let h = 0; h < holeCount; h++) {
|
|
431
|
+
holes[h] -= polygonVertexStart;
|
|
255
432
|
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
const triangleIndexStart = polygonIndicesOffsets[i];
|
|
436
|
+
const triangleIndexEnd =
|
|
437
|
+
i + 1 < polygonCount ? polygonIndicesOffsets[i + 1] : indices.length;
|
|
438
|
+
const triangles = indices.slice(triangleIndexStart, triangleIndexEnd);
|
|
439
|
+
for (let t = 0; t < triangles.length; t++) {
|
|
440
|
+
triangles[t] -= polygonVertexStart;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
const feature = getFeature(polygonVertexStart);
|
|
444
|
+
if (feature) {
|
|
445
|
+
feature.addPrimitiveByCollection(collectionIndex, i);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
collection.add(
|
|
449
|
+
{
|
|
450
|
+
positions,
|
|
451
|
+
triangles,
|
|
452
|
+
holes,
|
|
453
|
+
pickObject: feature,
|
|
454
|
+
featureId: feature?.featureId,
|
|
455
|
+
},
|
|
456
|
+
scratchPolygon,
|
|
457
|
+
);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* @param {BufferPolygonCollection} collection
|
|
463
|
+
* @param {number} collectionIndex
|
|
464
|
+
* @param {TypedArray} collectionPositions
|
|
465
|
+
* @param {FeatureFactoryFn} getFeature
|
|
466
|
+
* @param {Polygon} polygon
|
|
467
|
+
* @ignore
|
|
468
|
+
*/
|
|
469
|
+
function appendBufferPolygons(
|
|
470
|
+
collection,
|
|
471
|
+
collectionIndex,
|
|
472
|
+
collectionPositions,
|
|
473
|
+
getFeature,
|
|
474
|
+
polygon,
|
|
475
|
+
) {
|
|
476
|
+
// Create mapping from vertex index in the source glTF primitive, to result
|
|
477
|
+
// vertex index in the extracted vector primitive.
|
|
478
|
+
const TypedArray = /** @type {TypedArrayConstructor} */ (
|
|
479
|
+
polygon.loopIndices.constructor
|
|
480
|
+
);
|
|
481
|
+
const resultLoopIndices = new TypedArray(polygon.loopIndices.length);
|
|
482
|
+
|
|
483
|
+
const loopRestartIndex = getPrimitiveRestartIndex(polygon.loopIndices);
|
|
484
|
+
|
|
485
|
+
for (let i = 0; i < polygon.count; i++) {
|
|
486
|
+
const isLastPolygon = i + 1 === polygon.count;
|
|
256
487
|
|
|
257
|
-
|
|
488
|
+
// Extract vertex loops, exterior loops followed by interior ("holes").
|
|
489
|
+
const loopIndicesStart = polygon.loopIndicesOffsets[i];
|
|
490
|
+
const loopIndicesEnd = isLastPolygon
|
|
491
|
+
? polygon.loopIndices.length
|
|
492
|
+
: polygon.loopIndicesOffsets[i + 1];
|
|
493
|
+
const loopIndices = polygon.loopIndices.subarray(
|
|
494
|
+
loopIndicesStart,
|
|
495
|
+
loopIndicesEnd,
|
|
496
|
+
);
|
|
497
|
+
const positions = copyArrayByIndices(
|
|
498
|
+
collectionPositions,
|
|
499
|
+
loopIndices,
|
|
500
|
+
3,
|
|
501
|
+
resultLoopIndices,
|
|
502
|
+
);
|
|
258
503
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
504
|
+
// List start indices of interior loops ("holes").
|
|
505
|
+
const holesArray = [];
|
|
506
|
+
for (let j = 0; j < loopIndices.length; j++) {
|
|
507
|
+
const isLastIndex = j + 1 === loopIndices.length;
|
|
508
|
+
if (loopIndices[j] === loopRestartIndex && !isLastIndex) {
|
|
509
|
+
holesArray.push(j);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
const holes = new TypedArray(holesArray);
|
|
513
|
+
|
|
514
|
+
// Extract or tessellate triangle indices.
|
|
515
|
+
let triangles;
|
|
516
|
+
if (defined(polygon.triangleIndices)) {
|
|
517
|
+
const triangleIndicesStart = polygon.triangleIndicesOffsets[i];
|
|
518
|
+
const triangleIndicesEnd = isLastPolygon
|
|
519
|
+
? polygon.triangleIndices.length
|
|
520
|
+
: polygon.triangleIndicesOffsets[i + 1];
|
|
521
|
+
triangles = polygon.triangleIndices.subarray(
|
|
522
|
+
triangleIndicesStart,
|
|
523
|
+
triangleIndicesEnd,
|
|
524
|
+
);
|
|
525
|
+
// Rewrite collection-local indices to polygon-local indices.
|
|
526
|
+
for (let j = 0; j < triangles.length; j++) {
|
|
527
|
+
triangles[j] = resultLoopIndices[triangles[j]];
|
|
262
528
|
}
|
|
529
|
+
} else {
|
|
530
|
+
throw new Error("Runtime triangulation not yet supported.");
|
|
263
531
|
}
|
|
532
|
+
|
|
533
|
+
const feature = getFeature(loopIndices[0]);
|
|
534
|
+
if (feature) {
|
|
535
|
+
feature.addPrimitiveByCollection(collectionIndex, i);
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
collection.add(
|
|
539
|
+
{
|
|
540
|
+
positions,
|
|
541
|
+
triangles,
|
|
542
|
+
holes,
|
|
543
|
+
pickObject: feature,
|
|
544
|
+
featureId: feature?.featureId,
|
|
545
|
+
},
|
|
546
|
+
scratchPolygon,
|
|
547
|
+
);
|
|
264
548
|
}
|
|
265
549
|
}
|
|
266
550
|
|
|
@@ -283,42 +567,66 @@ function appendNodeToBuffers(content, node, parentTransform, result) {
|
|
|
283
567
|
for (let i = 0; i < primitives.length; i++) {
|
|
284
568
|
const primitive = primitives[i];
|
|
285
569
|
const primitiveType = primitive.primitiveType;
|
|
286
|
-
if (!primitive.vector) {
|
|
287
|
-
continue;
|
|
288
|
-
}
|
|
289
570
|
|
|
290
571
|
/** @type {BufferPrimitiveCollection<BufferPrimitive>} */
|
|
291
572
|
let collection;
|
|
292
573
|
|
|
293
574
|
const stats = gatherPrimitiveStats(primitive);
|
|
294
575
|
|
|
295
|
-
|
|
576
|
+
const positionAttribute = ModelUtility.getAttributeBySemantic(
|
|
577
|
+
primitive,
|
|
578
|
+
VertexAttributeSemantic.POSITION,
|
|
579
|
+
);
|
|
580
|
+
const positionNormalized = positionAttribute.normalized ?? false;
|
|
581
|
+
const positionDatatype = positionAttribute.componentDatatype;
|
|
582
|
+
|
|
296
583
|
if (primitiveType === PrimitiveType.POINTS) {
|
|
297
584
|
collection = new BufferPointCollection({
|
|
298
585
|
primitiveCountMax: stats.pointPrimitiveCount,
|
|
586
|
+
allowPicking: true,
|
|
587
|
+
positionNormalized,
|
|
588
|
+
positionDatatype,
|
|
299
589
|
});
|
|
300
|
-
|
|
301
|
-
// @ts-expect-error Requires https://github.com/CesiumGS/cesium/pull/13203.
|
|
302
590
|
} else if (primitiveType === PrimitiveType.LINE_STRIP) {
|
|
303
591
|
collection = new BufferPolylineCollection({
|
|
304
592
|
primitiveCountMax: stats.polylinePrimitiveCount,
|
|
305
593
|
vertexCountMax: stats.polylineVertexCount,
|
|
594
|
+
allowPicking: true,
|
|
595
|
+
positionNormalized,
|
|
596
|
+
positionDatatype,
|
|
306
597
|
});
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
598
|
+
} else if (
|
|
599
|
+
primitiveType === PrimitiveType.TRIANGLES ||
|
|
600
|
+
primitiveType === PrimitiveType.LINE_LOOP
|
|
601
|
+
) {
|
|
310
602
|
collection = new BufferPolygonCollection({
|
|
311
603
|
primitiveCountMax: stats.polygonPrimitiveCount,
|
|
312
604
|
vertexCountMax: stats.polygonVertexCount,
|
|
313
605
|
holeCountMax: stats.polygonHoleCount,
|
|
314
606
|
triangleCountMax: stats.polygonTriangleCount,
|
|
607
|
+
allowPicking: true,
|
|
608
|
+
positionNormalized,
|
|
609
|
+
positionDatatype,
|
|
315
610
|
});
|
|
316
611
|
}
|
|
317
612
|
|
|
613
|
+
const featureIdComponent = primitive.featureIds?.[0];
|
|
614
|
+
const propertyTableId = featureIdComponent?.propertyTableId;
|
|
615
|
+
if (!result.featuresByTableId.has(propertyTableId)) {
|
|
616
|
+
result.featuresByTableId.set(propertyTableId, new Map());
|
|
617
|
+
}
|
|
618
|
+
|
|
318
619
|
result.collections.push(collection);
|
|
319
620
|
result.collectionLocalMatrices.push(Matrix4.clone(nodeTransform));
|
|
621
|
+
result.collectionFeatureTableIds.set(collection, propertyTableId);
|
|
320
622
|
|
|
321
|
-
appendPrimitiveToBuffers(
|
|
623
|
+
appendPrimitiveToBuffers(
|
|
624
|
+
content,
|
|
625
|
+
primitive,
|
|
626
|
+
collection,
|
|
627
|
+
result.collections.length - 1,
|
|
628
|
+
result.featuresByTableId.get(propertyTableId),
|
|
629
|
+
);
|
|
322
630
|
}
|
|
323
631
|
|
|
324
632
|
const children = node.children;
|
|
@@ -327,4 +635,57 @@ function appendNodeToBuffers(content, node, parentTransform, result) {
|
|
|
327
635
|
}
|
|
328
636
|
}
|
|
329
637
|
|
|
638
|
+
/**
|
|
639
|
+
* Given a source array and a list of indices, creates and returns a new array
|
|
640
|
+
* containing all values of the source array specified by the indices. Indices
|
|
641
|
+
* may contain "primitive restart index" values. Optionally, a 'resultIndices'
|
|
642
|
+
* parameter can be populated with a mapping from source index to result index.
|
|
643
|
+
*
|
|
644
|
+
* @param {TypedArray} array
|
|
645
|
+
* @param {TypedArray} indices
|
|
646
|
+
* @param {number} stride
|
|
647
|
+
* @param {TypedArray} [resultIndices]
|
|
648
|
+
* @returns {TypedArray}
|
|
649
|
+
* @ignore
|
|
650
|
+
*/
|
|
651
|
+
function copyArrayByIndices(array, indices, stride, resultIndices) {
|
|
652
|
+
const restartIndex = getPrimitiveRestartIndex(indices);
|
|
653
|
+
|
|
654
|
+
// Scan and count the number of non-restart indices.
|
|
655
|
+
let count = 0;
|
|
656
|
+
for (let i = 0; i < indices.length; i++) {
|
|
657
|
+
const index = indices[i];
|
|
658
|
+
if (index !== restartIndex) {
|
|
659
|
+
count++;
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
const TypedArray = /** @type {TypedArrayConstructor} */ (array.constructor);
|
|
664
|
+
const result = new TypedArray(count * stride);
|
|
665
|
+
|
|
666
|
+
// Write each result value, skipping primitive restart indices. Write source
|
|
667
|
+
// index -> result index to 'resultIndices' if provided.
|
|
668
|
+
let dstIndex = 0;
|
|
669
|
+
for (let i = 0; i < indices.length; i++) {
|
|
670
|
+
const srcIndex = indices[i];
|
|
671
|
+
|
|
672
|
+
if (resultIndices) {
|
|
673
|
+
resultIndices[srcIndex] =
|
|
674
|
+
srcIndex === restartIndex ? restartIndex : dstIndex;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
if (srcIndex === restartIndex) {
|
|
678
|
+
continue;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
for (let j = 0; j < stride; j++) {
|
|
682
|
+
result[dstIndex * stride + j] = array[srcIndex * stride + j];
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
dstIndex++;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
return result;
|
|
689
|
+
}
|
|
690
|
+
|
|
330
691
|
export default createVectorTileBuffersFromModelComponents;
|