@hztxi/cesium-engine 25.0.7 → 26.2.2
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-2FNKHQL3.js +754 -0
- package/Build/Workers/chunk-2NCNUVAT.js +56 -0
- package/Build/Workers/chunk-2ZYRUVVU.js +301 -0
- package/Build/Workers/chunk-36IU7N4V.js +1284 -0
- package/Build/Workers/chunk-3BDLET5S.js +198 -0
- package/Build/Workers/chunk-3JZXI44G.js +3822 -0
- package/Build/Workers/chunk-3N2UNLWJ.js +101 -0
- package/Build/Workers/chunk-3NCG2YYR.js +58 -0
- package/Build/Workers/chunk-3PRHI4KX.js +241 -0
- package/Build/Workers/chunk-3R6E2SH4.js +672 -0
- package/Build/Workers/chunk-3ZKKXEXL.js +415 -0
- package/Build/Workers/chunk-47KVKPTO.js +415 -0
- package/Build/Workers/chunk-4FFIJ7ZV.js +56 -0
- package/Build/Workers/chunk-4N227IPR.js +973 -0
- package/Build/Workers/chunk-4P6OAPBM.js +97 -0
- package/Build/Workers/chunk-4XR3K4GD.js +280 -0
- package/Build/Workers/chunk-4Z2JINRS.js +519 -0
- package/Build/Workers/chunk-4ZOLEPZK.js +519 -0
- package/Build/Workers/chunk-5EF3WWQG.js +352 -0
- package/Build/Workers/chunk-5I76476T.js +288 -0
- package/Build/Workers/chunk-5PBZKBAP.js +511 -0
- package/Build/Workers/chunk-5RVAAW26.js +82 -0
- package/Build/Workers/chunk-5VWK76PO.js +511 -0
- package/Build/Workers/chunk-6SEICASZ.js +241 -0
- package/Build/Workers/chunk-77DBX23X.js +455 -0
- package/Build/Workers/chunk-7C2D3DTI.js +959 -0
- package/Build/Workers/chunk-7GQOWCSN.js +959 -0
- package/Build/Workers/chunk-7J2ONMKC.js +198 -0
- package/Build/Workers/chunk-7MHUHXZZ.js +219 -0
- package/Build/Workers/chunk-7MQPHOAS.js +455 -0
- package/Build/Workers/chunk-7NJ5O7TP.js +387 -0
- package/Build/Workers/chunk-7T4MW2W4.js +368 -0
- package/Build/Workers/chunk-7UXZUGUZ.js +82 -0
- package/Build/Workers/chunk-7Y642MCO.js +352 -0
- package/Build/Workers/chunk-7ZFKBLUE.js +1054 -0
- package/Build/Workers/chunk-A2UHPWPL.js +38 -0
- package/Build/Workers/chunk-A7LGY5XS.js +140 -0
- package/Build/Workers/chunk-AN2NVYL6.js +1483 -0
- package/Build/Workers/chunk-AS2QC7H2.js +219 -0
- package/Build/Workers/chunk-AVOLMIGJ.js +57 -0
- package/Build/Workers/chunk-B7PT2VL5.js +630 -0
- package/Build/Workers/chunk-BHRHMUDM.js +147 -0
- package/Build/Workers/chunk-BUWAHRK5.js +672 -0
- package/Build/Workers/chunk-C5ET5HON.js +198 -0
- package/Build/Workers/chunk-C6XQGBPV.js +476 -0
- package/Build/Workers/chunk-C7B672RR.js +73 -0
- package/Build/Workers/chunk-CAEC5DA2.js +57 -0
- package/Build/Workers/chunk-CBCOHH5O.js +837 -0
- package/Build/Workers/chunk-CEMXKBQO.js +1800 -0
- package/Build/Workers/chunk-CKW3STKA.js +1067 -0
- package/Build/Workers/chunk-CV5RICKT.js +1992 -0
- package/Build/Workers/chunk-DBWSISJT.js +56 -0
- package/Build/Workers/chunk-DCMOBPLG.js +352 -0
- package/Build/Workers/chunk-DSBSPPPJ.js +1344 -0
- package/Build/Workers/chunk-DSGLDRTI.js +278 -0
- package/Build/Workers/chunk-DXD7OPSP.js +1992 -0
- package/Build/Workers/chunk-DXECZBSA.js +368 -0
- package/Build/Workers/chunk-DZIRO6ZK.js +682 -0
- package/Build/Workers/chunk-E4CRPGX5.js +140 -0
- package/Build/Workers/chunk-E4IVMEBH.js +52 -0
- package/Build/Workers/chunk-E6IPM6HP.js +56 -0
- package/Build/Workers/chunk-EB2HAHRY.js +1054 -0
- package/Build/Workers/chunk-ECDCQXCO.js +1992 -0
- package/Build/Workers/chunk-ECN3VUMA.js +73 -0
- package/Build/Workers/chunk-ECSKVHUB.js +476 -0
- package/Build/Workers/chunk-EIENGLA5.js +278 -0
- package/Build/Workers/chunk-EK5CWDW2.js +476 -0
- package/Build/Workers/chunk-EL4B5CSQ.js +162 -0
- package/Build/Workers/chunk-EUCUBIEZ.js +97 -0
- package/Build/Workers/chunk-FAYBQGKO.js +219 -0
- package/Build/Workers/chunk-FGCXPEZM.js +3201 -0
- package/Build/Workers/chunk-FHCRXPA6.js +44 -0
- package/Build/Workers/chunk-FM6EQUFX.js +1800 -0
- package/Build/Workers/chunk-FPFGGQ4X.js +301 -0
- package/Build/Workers/chunk-FQ42MT7M.js +58 -0
- package/Build/Workers/chunk-FQDYQG4P.js +1284 -0
- package/Build/Workers/chunk-FQTV6W3I.js +973 -0
- package/Build/Workers/chunk-FTCBY5HH.js +138 -0
- package/Build/Workers/chunk-GI5RWJAY.js +101 -0
- package/Build/Workers/chunk-GNLMSDRO.js +945 -0
- package/Build/Workers/chunk-GTA727KQ.js +140 -0
- package/Build/Workers/chunk-GVUJ6O3R.js +73 -0
- package/Build/Workers/chunk-GXTM7AG3.js +1483 -0
- package/Build/Workers/chunk-HAXQB2FS.js +2719 -0
- package/Build/Workers/chunk-HCGU7OCG.js +97 -0
- package/Build/Workers/chunk-HRIPVWSC.js +58 -0
- package/Build/Workers/chunk-IC3BR6SC.js +102 -0
- package/Build/Workers/chunk-IEPPOHF3.js +44 -0
- package/Build/Workers/chunk-IU3YAYPT.js +1344 -0
- package/Build/Workers/chunk-J3AXZ4WC.js +124 -0
- package/Build/Workers/chunk-J7MZR7B2.js +1483 -0
- package/Build/Workers/chunk-KBNW776Q.js +305 -0
- package/Build/Workers/chunk-KBSWXVSY.js +837 -0
- package/Build/Workers/chunk-KEYTLNVK.js +1067 -0
- package/Build/Workers/chunk-KN3RQWUA.js +3201 -0
- package/Build/Workers/chunk-KSIEJYNL.js +3822 -0
- package/Build/Workers/chunk-KT3GG7AW.js +754 -0
- package/Build/Workers/chunk-KYCEM22I.js +1800 -0
- package/Build/Workers/chunk-L2TFZKN6.js +455 -0
- package/Build/Workers/chunk-LHKE2VUR.js +945 -0
- package/Build/Workers/chunk-LJTQW46H.js +57 -0
- package/Build/Workers/chunk-LMQGYJME.js +672 -0
- package/Build/Workers/chunk-LOBYJQA4.js +76 -0
- package/Build/Workers/chunk-LOF32O7F.js +163 -0
- package/Build/Workers/chunk-LOTIJA7D.js +124 -0
- package/Build/Workers/chunk-M7Z3MPAX.js +973 -0
- package/Build/Workers/chunk-MHNLTQHO.js +3201 -0
- package/Build/Workers/chunk-MICPAD7R.js +398 -0
- package/Build/Workers/chunk-ML7OMD72.js +2342 -0
- package/Build/Workers/chunk-MPJ73WMH.js +138 -0
- package/Build/Workers/chunk-MUTHG7T7.js +171 -0
- package/Build/Workers/chunk-NBTGXEMT.js +945 -0
- package/Build/Workers/chunk-NQZC37F7.js +38 -0
- package/Build/Workers/chunk-O3X3D2Z3.js +352 -0
- package/Build/Workers/chunk-OBUIHPKF.js +352 -0
- package/Build/Workers/chunk-PAEWNYIV.js +138 -0
- package/Build/Workers/chunk-PANJ7YH6.js +102 -0
- package/Build/Workers/chunk-PCL3Y7H5.js +82 -0
- package/Build/Workers/chunk-PHUELDXQ.js +76 -0
- package/Build/Workers/chunk-PIIUGRQD.js +387 -0
- package/Build/Workers/chunk-POKD22OT.js +2719 -0
- package/Build/Workers/chunk-PQMA7MFS.js +9237 -0
- package/Build/Workers/chunk-PQZW2QZG.js +163 -0
- package/Build/Workers/chunk-PURIPUSY.js +682 -0
- package/Build/Workers/chunk-QQZPPXY4.js +3822 -0
- package/Build/Workers/chunk-QXLQLGL2.js +1067 -0
- package/Build/Workers/chunk-R2JQAAU7.js +630 -0
- package/Build/Workers/chunk-RC4YC3VU.js +278 -0
- package/Build/Workers/chunk-RGNNWVR6.js +171 -0
- package/Build/Workers/chunk-RUOETBWP.js +288 -0
- package/Build/Workers/chunk-RV4EPLBO.js +2342 -0
- package/Build/Workers/chunk-SBBIEHYT.js +44 -0
- package/Build/Workers/chunk-SBEQLEO5.js +352 -0
- package/Build/Workers/chunk-SGC2GT3Y.js +1284 -0
- package/Build/Workers/chunk-SKLK4CBL.js +162 -0
- package/Build/Workers/chunk-SWVZTU6X.js +305 -0
- package/Build/Workers/chunk-T3EUPM5A.js +454 -0
- package/Build/Workers/chunk-TA6IU2XL.js +171 -0
- package/Build/Workers/chunk-TLSGD5TR.js +280 -0
- package/Build/Workers/chunk-TNDQT5AB.js +682 -0
- package/Build/Workers/chunk-TOXDLWKZ.js +368 -0
- package/Build/Workers/chunk-TZBM6TAB.js +124 -0
- package/Build/Workers/chunk-U2OY6MX6.js +398 -0
- package/Build/Workers/chunk-UCY4B5EV.js +288 -0
- package/Build/Workers/chunk-V52FEPCV.js +754 -0
- package/Build/Workers/chunk-VBEXZBG5.js +147 -0
- package/Build/Workers/chunk-VC76B6GM.js +959 -0
- package/Build/Workers/chunk-VCUOYHWC.js +519 -0
- package/Build/Workers/chunk-VDBQVKTF.js +387 -0
- package/Build/Workers/chunk-VJIL5H6K.js +2719 -0
- package/Build/Workers/chunk-VJLDRHKN.js +511 -0
- package/Build/Workers/chunk-VMF7KOGY.js +162 -0
- package/Build/Workers/chunk-W3X2ZAEJ.js +52 -0
- package/Build/Workers/chunk-W5OCKMPJ.js +101 -0
- package/Build/Workers/chunk-X4VZ33YL.js +454 -0
- package/Build/Workers/chunk-XDM5A6C4.js +102 -0
- package/Build/Workers/chunk-XHT5SVP4.js +52 -0
- package/Build/Workers/chunk-XITBARMZ.js +2342 -0
- package/Build/Workers/chunk-XLQZNQ4Z.js +163 -0
- package/Build/Workers/chunk-XZ6HDXKM.js +76 -0
- package/Build/Workers/chunk-Y6AQK4FY.js +1344 -0
- package/Build/Workers/chunk-Y7NDFEQ3.js +398 -0
- package/Build/Workers/chunk-YBBQDYX2.js +301 -0
- package/Build/Workers/chunk-YHPYPVAB.js +837 -0
- package/Build/Workers/chunk-YJBPRW4A.js +415 -0
- package/Build/Workers/chunk-YNKK6BXY.js +454 -0
- package/Build/Workers/chunk-YRAJ74HR.js +305 -0
- package/Build/Workers/chunk-YULTZK5O.js +147 -0
- package/Build/Workers/chunk-YUNQYP3Z.js +9237 -0
- package/Build/Workers/chunk-YX2FOQMF.js +9237 -0
- package/Build/Workers/chunk-Z7BONRW2.js +241 -0
- package/Build/Workers/chunk-ZK2R3DEJ.js +1054 -0
- package/Build/Workers/combineGeometry.js +24 -24
- package/Build/Workers/createBoxGeometry.js +18 -18
- package/Build/Workers/createBoxOutlineGeometry.js +18 -18
- package/Build/Workers/createCircleGeometry.js +26 -26
- package/Build/Workers/createCircleOutlineGeometry.js +19 -19
- package/Build/Workers/createCoplanarPolygonGeometry.js +39 -39
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +33 -33
- package/Build/Workers/createCorridorGeometry.js +36 -37
- package/Build/Workers/createCorridorOutlineGeometry.js +34 -35
- package/Build/Workers/createCylinderGeometry.js +20 -20
- package/Build/Workers/createCylinderOutlineGeometry.js +20 -20
- 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 +20 -20
- package/Build/Workers/createGeometry.js +25 -24
- package/Build/Workers/createGroundPolylineGeometry.js +26 -26
- package/Build/Workers/createMvtTile.js +111 -19
- package/Build/Workers/createPlaneGeometry.js +18 -18
- package/Build/Workers/createPlaneOutlineGeometry.js +17 -17
- package/Build/Workers/createPolygonGeometry.js +36 -36
- package/Build/Workers/createPolygonOutlineGeometry.js +33 -33
- package/Build/Workers/createPolylineGeometry.js +28 -28
- package/Build/Workers/createPolylineVolumeGeometry.js +38 -36
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +32 -31
- package/Build/Workers/createRectangleGeometry.js +29 -29
- package/Build/Workers/createRectangleOutlineGeometry.js +23 -23
- package/Build/Workers/createSimplePolylineGeometry.js +26 -26
- 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 +26 -26
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +23 -23
- package/Build/Workers/createVerticesFromHeightmap.js +23 -23
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +21 -21
- package/Build/Workers/createWallGeometry.js +26 -26
- package/Build/Workers/createWallOutlineGeometry.js +26 -26
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +993 -2334
- 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 +6 -6
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +23 -23
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +26 -26
- package/Source/Core/ArcGISTiledElevationTerrainProvider.js +1 -5
- package/Source/Core/BoundingRectangle.js +6 -8
- package/Source/Core/BoundingSphere.js +0 -3
- package/Source/Core/Cartesian2.js +1 -1
- package/Source/Core/Cartesian3.js +1 -1
- package/Source/Core/Cartesian4.js +1 -1
- package/Source/Core/Cesium3DTilesTerrainGeometryProcessor.js +3 -4
- package/Source/Core/Color.js +1 -0
- package/Source/Core/ComponentDatatype.js +35 -0
- package/Source/Core/CoplanarPolygonGeometry.js +2 -2
- package/Source/Core/CorridorGeometry.js +2 -4
- package/Source/Core/CorridorOutlineGeometry.js +1 -3
- package/Source/Core/EarthOrientationParameters.js +2 -2
- package/Source/Core/EllipseGeometryLibrary.js +2 -2
- package/Source/Core/EllipsoidGeodesic.js +3 -3
- package/Source/Core/EllipsoidRhumbLine.js +1 -1
- package/Source/Core/Heap.js +1 -1
- package/Source/Core/HermitePolynomialApproximation.js +215 -179
- package/Source/Core/InterpolationAlgorithm.js +58 -50
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/JulianDate.js +1 -1
- package/Source/Core/LagrangePolynomialApproximation.js +55 -52
- package/Source/Core/LinearApproximation.js +69 -66
- package/Source/Core/MapProjection.js +1 -0
- package/Source/Core/Math.js +59 -0
- package/Source/Core/Matrix2.js +3 -3
- package/Source/Core/Matrix3.js +3 -3
- package/Source/Core/Matrix4.js +1 -1
- package/Source/Core/OrthographicFrustum.js +1 -1
- package/Source/Core/PerspectiveFrustum.js +1 -1
- package/Source/Core/PolygonGeometry.js +2 -2
- package/Source/Core/PolygonGeometryLibrary.js +1 -1
- package/Source/Core/PolygonOutlineGeometry.js +1 -1
- package/Source/Core/PolylineGeometry.js +1 -1
- package/Source/Core/PolylineVolumeGeometryLibrary.js +1 -1
- package/Source/Core/Rectangle.js +7 -1
- package/Source/Core/RectangleOutlineGeometry.js +1 -1
- package/Source/Core/Resource.js +1 -1
- package/Source/Core/ScreenSpaceEventHandler.js +51 -41
- package/Source/Core/SimplePolylineGeometry.js +1 -1
- package/Source/Core/TerrainEncoding.js +2 -2
- package/Source/Core/TerrainMesh.js +3 -3
- package/Source/Core/TerrainPicker.js +180 -168
- package/Source/Core/TimeIntervalCollection.js +1 -3
- package/Source/Core/Tipsify.js +1 -1
- package/Source/Core/Transforms.js +5 -1
- package/Source/Core/VectorPipeline.js +1117 -0
- package/Source/Core/VectorProvider.js +429 -0
- package/Source/Core/WallOutlineGeometry.js +1 -1
- package/Source/Core/createColorRamp.js +37 -0
- package/Source/Core/getTimestamp.js +4 -2
- package/Source/Core/globalTypes.js +25 -0
- package/Source/Core/writeTextToCanvas.js +1 -0
- package/Source/DataSources/CompositeEntityCollection.js +0 -1
- package/Source/DataSources/CzmlDataSource.js +14 -0
- package/Source/DataSources/DataSourceDisplay.js +1 -1
- package/Source/DataSources/GeoJsonDataSource.js +0 -1
- package/Source/DataSources/GeometryVisualizer.js +1 -1
- package/Source/DataSources/KmlDataSource.js +529 -557
- package/Source/DataSources/PathGraphics.js +8 -1
- package/Source/DataSources/PathMode.js +27 -0
- package/Source/DataSources/PathVisualizer.js +298 -1
- package/Source/DataSources/PolylineVisualizer.js +1 -1
- package/Source/DataSources/StaticOutlineGeometryBatch.js +1 -1
- package/Source/Renderer/AutomaticUniforms.js +23 -0
- package/Source/Renderer/Context.js +9 -3
- package/Source/Renderer/DrawCommand.js +22 -0
- package/Source/Renderer/Framebuffer.js +4 -0
- package/Source/Renderer/Pass.js +11 -9
- package/Source/Renderer/Texture.js +12 -1
- package/Source/Renderer/UniformState.js +7 -0
- package/Source/Renderer/VertexArray.js +1 -1
- package/Source/Renderer/createUniform.js +346 -239
- package/Source/Renderer/createUniformArray.js +494 -381
- package/Source/Scene/ArcGisMapServerImageryProvider.js +0 -5
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Billboard.js +2 -1
- package/Source/Scene/BillboardCollection.js +15 -5
- package/Source/Scene/BillboardTexture.js +5 -3
- package/Source/Scene/BufferPointCollection.js +11 -1
- package/Source/Scene/BufferPolygonCollection.js +26 -0
- package/Source/Scene/BufferPolylineCollection.js +2 -0
- package/Source/Scene/BufferPrimitiveCollection.js +105 -32
- package/Source/Scene/Camera.js +85 -9
- package/Source/Scene/CameraEventAggregator.js +30 -18
- package/Source/Scene/CameraFlightPath.js +7 -4
- package/Source/Scene/Cesium3DTile.js +102 -4
- package/Source/Scene/Cesium3DTileContent.js +195 -254
- package/Source/Scene/Cesium3DTileContentFactory.js +10 -2
- package/Source/Scene/Cesium3DTileOptimizations.js +4 -6
- package/Source/Scene/Cesium3DTileStyle.js +40 -0
- package/Source/Scene/Cesium3DTileset.js +213 -8
- package/Source/Scene/Cesium3DTilesetTraversal.js +14 -0
- package/Source/Scene/ClippingPlaneCollection.js +4 -4
- package/Source/Scene/ClippingPolygon.js +2 -0
- package/Source/Scene/ClippingPolygonCollection.js +2 -2
- package/Source/Scene/Composite3DTileContent.js +254 -292
- package/Source/Scene/Controllers/Controller.js +63 -0
- package/Source/Scene/Controllers/ControllerHost.js +78 -0
- package/Source/Scene/Controllers/HybridScreenSpacePanCameraController.js +106 -0
- package/Source/Scene/Controllers/MouseButton.js +32 -0
- package/Source/Scene/Controllers/ScreenSpaceElevatorCameraController.js +295 -0
- package/Source/Scene/Controllers/ScreenSpaceInputBindings.js +154 -0
- package/Source/Scene/Controllers/ScreenSpaceMapCameraController.js +310 -0
- package/Source/Scene/Controllers/ScreenSpaceTiltOrbitCameraController.js +642 -0
- package/Source/Scene/Controllers/ScreenSpaceZoomCameraController.js +431 -0
- package/Source/Scene/Controllers/defaultPickWorldPosition.js +84 -0
- package/Source/Scene/DerivedCommand.js +98 -0
- package/Source/Scene/EdgeDisplayMode.js +50 -0
- package/Source/Scene/EdgeFramebuffer.js +1 -5
- package/Source/Scene/Empty3DTileContent.js +100 -132
- package/Source/Scene/Expression.js +6 -8
- package/Source/Scene/FrameState.js +17 -0
- package/Source/Scene/GaussianSplat3DTileContent.js +436 -478
- package/Source/Scene/GeoJsonPrimitive.js +874 -0
- package/Source/Scene/Geometry3DTileContent.js +151 -185
- package/Source/Scene/Globe.js +22 -1
- package/Source/Scene/GlobeDepth.js +27 -1
- package/Source/Scene/GlobeSurfaceShaderSet.js +637 -540
- package/Source/Scene/GlobeSurfaceTile.js +575 -398
- package/Source/Scene/GlobeSurfaceTileProvider.js +1412 -1184
- package/Source/Scene/GltfBufferViewLoader.js +3 -3
- package/Source/Scene/GltfLoader.js +146 -3
- package/Source/Scene/GltfLoaderUtil.js +20 -4
- package/Source/Scene/GltfPipeline/forEachTextureInMaterial.js +10 -0
- package/Source/Scene/GltfPipeline/removeUnusedElements.js +21 -11
- package/Source/Scene/GltfSpzLoader.js +1 -1
- package/Source/Scene/GltfVertexBufferLoader.js +6 -3
- package/Source/Scene/I3SDataProvider.js +1 -1
- package/Source/Scene/I3SLayer.js +1 -1
- package/Source/Scene/I3SNode.js +2 -2
- package/Source/Scene/ImageryLayer.js +2 -2
- package/Source/Scene/ImageryLayerCollection.js +190 -6
- package/Source/Scene/Implicit3DTileContent.js +192 -216
- package/Source/Scene/ImplicitTileCoordinates.js +17 -0
- package/Source/Scene/IonImageryProvider.js +1 -5
- package/Source/Scene/Label.js +4 -4
- package/Source/Scene/LabelCollection.js +4 -1
- package/Source/Scene/MVTDataProvider.js +555 -0
- package/Source/Scene/Material.js +1 -0
- package/Source/Scene/Model/B3dmLoader.js +1 -2
- package/Source/Scene/Model/EdgeVisibilityPipelineStage.js +82 -312
- package/Source/Scene/Model/Extensions/Gpm/GltfGpmLoader.js +4 -0
- package/Source/Scene/Model/I3dmLoader.js +1 -1
- package/Source/Scene/Model/InstancingPipelineStage.js +4 -7
- package/Source/Scene/Model/MaterialPipelineStage.js +124 -1
- package/Source/Scene/Model/Model.js +45 -10
- package/Source/Scene/Model/Model3DTileContent.js +424 -458
- package/Source/Scene/Model/ModelClippingPlanesPipelineStage.js +28 -1
- package/Source/Scene/Model/ModelDrawCommand.js +180 -8
- package/Source/Scene/Model/ModelDrawCommands.js +4 -0
- package/Source/Scene/Model/ModelSceneGraph.js +21 -0
- package/Source/Scene/Model/ModelUtility.js +5 -0
- package/Source/Scene/Model/PickingPipelineStage.js +29 -0
- package/Source/Scene/Model/PrimitiveRenderResources.js +24 -0
- package/Source/Scene/Model/createVectorTileBuffersFromModelComponents.js +645 -153
- package/Source/Scene/ModelComponents.js +112 -0
- package/Source/Scene/Multiple3DTileContent.js +291 -334
- package/Source/Scene/MvtLabelCandidates.js +295 -0
- package/Source/Scene/MvtLabelManager.js +1069 -0
- package/Source/Scene/Picking.js +19 -3
- package/Source/Scene/PlanarFillIdFramebuffer.js +172 -0
- package/Source/Scene/PntsParser.js +1 -1
- package/Source/Scene/PolylineCollection.js +5 -3
- package/Source/Scene/PostProcessStage.js +4 -2
- package/Source/Scene/QuadtreePrimitive.js +3 -2
- package/Source/Scene/ResourceCache.js +7 -4
- package/Source/Scene/ResourceCacheKey.js +21 -18
- package/Source/Scene/Scene.js +237 -11
- package/Source/Scene/SceneTransforms.js +6 -5
- package/Source/Scene/ShadowMap.js +9 -3
- package/Source/Scene/ShadowMapShader.js +50 -2
- package/Source/Scene/SnapFramebuffer.js +121 -0
- package/Source/Scene/Snapping.js +184 -0
- package/Source/Scene/TerrainFillMesh.js +3 -2
- package/Source/Scene/Tileset3DTileContent.js +113 -146
- package/Source/Scene/UrlTemplate3DTilesDataProvider.js +543 -0
- package/Source/Scene/Vector3DTileContent.js +207 -237
- package/Source/Scene/VectorGltf3DTileContent.js +185 -45
- package/Source/Scene/View.js +10 -8
- package/Source/Scene/VoxelPrimitive.js +159 -175
- package/Source/Scene/VoxelProvider.js +64 -91
- package/Source/Scene/VoxelTraversal.js +1 -1
- package/Source/Scene/buildVectorGltfFromMVT.js +1208 -0
- package/Source/Scene/buildVoxelCustomShader.js +199 -0
- package/Source/Scene/createElevationBandMaterial.js +1 -1
- package/Source/Scene/decodeMVT.js +877 -0
- package/Source/Scene/findMeshoptExtension.js +23 -0
- package/Source/Scene/renderBufferPointCollection.js +114 -64
- package/Source/Scene/renderBufferPolygonCollection.js +245 -53
- package/Source/Scene/renderBufferPolylineCollection.js +271 -145
- package/Source/Shaders/BillboardCollectionVS.glsl +23 -25
- package/Source/Shaders/BillboardCollectionVS.js +23 -25
- 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/BufferPolygonMaterialFS.glsl +13 -0
- package/Source/Shaders/BufferPolygonMaterialFS.js +13 -0
- package/Source/Shaders/BufferPolygonMaterialVS.glsl +22 -4
- package/Source/Shaders/BufferPolygonMaterialVS.js +23 -5
- package/Source/Shaders/BufferPolylineMaterialVS.glsl +16 -2
- package/Source/Shaders/BufferPolylineMaterialVS.js +17 -3
- package/Source/Shaders/Builtin/Constants/passCesium3DTile.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTile.js +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.js +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.js +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileEdgesDirect.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passCesium3DTileEdgesDirect.js +11 -0
- package/Source/Shaders/Builtin/Constants/passCesium3DTilePlanarFillId.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passCesium3DTilePlanarFillId.js +11 -0
- package/Source/Shaders/Builtin/Constants/passClassification.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passClassification.js +1 -1
- package/Source/Shaders/Builtin/Constants/passGaussianSplats.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passGaussianSplats.js +1 -1
- package/Source/Shaders/Builtin/Constants/passOpaque.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passOpaque.js +1 -1
- package/Source/Shaders/Builtin/Constants/passOverlay.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passOverlay.js +1 -1
- package/Source/Shaders/Builtin/Constants/passTranslucent.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passTranslucent.js +1 -1
- package/Source/Shaders/Builtin/Constants/passVoxels.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passVoxels.js +1 -1
- package/Source/Shaders/Builtin/CzmBuiltins.js +4 -0
- package/Source/Shaders/GlobeFS.glsl +10 -6
- package/Source/Shaders/GlobeFS.js +10 -6
- package/Source/Shaders/Materials/PolylineGlowMaterial.glsl +1 -1
- package/Source/Shaders/Materials/PolylineGlowMaterial.js +1 -1
- package/Source/Shaders/Model/EdgeVisibilityStageVS.glsl +0 -1
- package/Source/Shaders/Model/EdgeVisibilityStageVS.js +0 -1
- package/Source/Shaders/Model/MaterialStageFS.glsl +8 -2
- package/Source/Shaders/Model/MaterialStageFS.js +8 -2
- package/Source/Shaders/Model/ModelFS.glsl +105 -0
- package/Source/Shaders/Model/ModelFS.js +105 -0
- package/Source/Shaders/VectorCommon.glsl +178 -0
- package/Source/Shaders/VectorCommon.js +180 -0
- package/Source/ThirdParty/zip-module.wasm +0 -0
- package/Source/Widget/CesiumWidget.js +30 -0
- package/Source/Workers/createMvtTile.js +39 -0
- package/Source/Workers/decodeGoogleEarthEnterprisePacket.js +2 -2
- package/Source/Workers/incrementallyBuildTerrainPicker.js +2 -0
- package/index.js +214 -184
- package/package.json +13 -13
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
3
|
import Cartesian3 from "../../Core/Cartesian3.js";
|
|
4
|
-
import
|
|
4
|
+
import CesiumMath from "../../Core/Math.js";
|
|
5
5
|
import defined from "../../Core/defined.js";
|
|
6
6
|
import Matrix4 from "../../Core/Matrix4.js";
|
|
7
7
|
import PrimitiveType from "../../Core/PrimitiveType.js";
|
|
@@ -16,13 +16,16 @@ import VertexAttributeSemantic from "../VertexAttributeSemantic.js";
|
|
|
16
16
|
import ModelReader from "./ModelReader.js";
|
|
17
17
|
import ModelUtility from "./ModelUtility.js";
|
|
18
18
|
import ModelComponents from "../ModelComponents.js";
|
|
19
|
+
import SceneMode from "../SceneMode.js";
|
|
20
|
+
import SceneTransforms from "../SceneTransforms.js";
|
|
19
21
|
import Cesium3DTileVectorFeature from "../Cesium3DTileVectorFeature.js";
|
|
20
22
|
|
|
21
|
-
/** @import { TypedArray } from "../../Core/globalTypes.js"; */
|
|
23
|
+
/** @import { TypedArray, TypedArrayConstructor } from "../../Core/globalTypes.js"; */
|
|
22
24
|
/** @import BufferPrimitive from "../BufferPrimitive.js"; */
|
|
23
25
|
/** @import BufferPrimitiveCollection from "../BufferPrimitiveCollection.js"; */
|
|
24
26
|
/** @import VectorGltf3DTileContent from "../VectorGltf3DTileContent.js"; */
|
|
25
|
-
/** @import
|
|
27
|
+
/** @import FrameState from "../FrameState.js"; */
|
|
28
|
+
/** @import {Attribute, Components, Node, Polygon, Primitive, Vector} from "../ModelComponents.js"; */
|
|
26
29
|
|
|
27
30
|
/**
|
|
28
31
|
* @typedef {object} VectorTileResult
|
|
@@ -34,6 +37,12 @@ import Cesium3DTileVectorFeature from "../Cesium3DTileVectorFeature.js";
|
|
|
34
37
|
*/
|
|
35
38
|
|
|
36
39
|
const scratchPosition = new Cartesian3();
|
|
40
|
+
const scratchWorldPosition = new Cartesian3();
|
|
41
|
+
const scratchProjectedPosition = new Cartesian3();
|
|
42
|
+
const scratchReferenceWorldPosition = new Cartesian3();
|
|
43
|
+
const scratchReferenceProjectedPosition = new Cartesian3();
|
|
44
|
+
const scratchProjectedMinimum = new Cartesian3();
|
|
45
|
+
const scratchProjectedMaximum = new Cartesian3();
|
|
37
46
|
const scratchPoint = new BufferPoint();
|
|
38
47
|
const scratchPolyline = new BufferPolyline();
|
|
39
48
|
const scratchPolygon = new BufferPolygon();
|
|
@@ -43,12 +52,22 @@ const scratchPolygon = new BufferPolygon();
|
|
|
43
52
|
*
|
|
44
53
|
* @param {VectorGltf3DTileContent} content
|
|
45
54
|
* @param {Components} components
|
|
55
|
+
* @param {FrameState} frameState
|
|
46
56
|
* @returns {VectorTileResult}
|
|
47
57
|
*
|
|
48
58
|
* @ignore
|
|
49
59
|
*/
|
|
50
|
-
function createVectorTileBuffersFromModelComponents(
|
|
60
|
+
function createVectorTileBuffersFromModelComponents(
|
|
61
|
+
content,
|
|
62
|
+
components,
|
|
63
|
+
frameState,
|
|
64
|
+
) {
|
|
51
65
|
const rootNodes = components.scene.nodes;
|
|
66
|
+
const tileModelMatrix = Matrix4.multiplyTransformation(
|
|
67
|
+
content._tile.computedTransform,
|
|
68
|
+
content._modelMatrix,
|
|
69
|
+
new Matrix4(),
|
|
70
|
+
);
|
|
52
71
|
|
|
53
72
|
/** @type {VectorTileResult} */
|
|
54
73
|
const result = {
|
|
@@ -59,7 +78,14 @@ function createVectorTileBuffersFromModelComponents(content, components) {
|
|
|
59
78
|
};
|
|
60
79
|
|
|
61
80
|
for (let i = 0; i < rootNodes.length; i++) {
|
|
62
|
-
appendNodeToBuffers(
|
|
81
|
+
appendNodeToBuffers(
|
|
82
|
+
content,
|
|
83
|
+
rootNodes[i],
|
|
84
|
+
Matrix4.IDENTITY,
|
|
85
|
+
tileModelMatrix,
|
|
86
|
+
frameState,
|
|
87
|
+
result,
|
|
88
|
+
);
|
|
63
89
|
}
|
|
64
90
|
|
|
65
91
|
return result;
|
|
@@ -74,25 +100,6 @@ function getPrimitiveRestartIndex(indices) {
|
|
|
74
100
|
return Math.pow(2, bits) - 1;
|
|
75
101
|
}
|
|
76
102
|
|
|
77
|
-
/**
|
|
78
|
-
* @param {TypedArray} indices
|
|
79
|
-
* @param {Function} callback
|
|
80
|
-
* @ignore
|
|
81
|
-
*/
|
|
82
|
-
function forEachLineStripSegment(indices, callback) {
|
|
83
|
-
const restart = getPrimitiveRestartIndex(indices);
|
|
84
|
-
let segmentStart = 0;
|
|
85
|
-
for (let i = 0; i <= indices.length; i++) {
|
|
86
|
-
if (i === indices.length || indices[i] === restart) {
|
|
87
|
-
const segmentCount = i - segmentStart;
|
|
88
|
-
if (segmentCount > 0) {
|
|
89
|
-
callback(segmentStart, segmentCount);
|
|
90
|
-
}
|
|
91
|
-
segmentStart = i + 1;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
103
|
/**
|
|
97
104
|
* @param {Primitive} primitive
|
|
98
105
|
* @ignore
|
|
@@ -110,6 +117,7 @@ function gatherPrimitiveStats(primitive) {
|
|
|
110
117
|
};
|
|
111
118
|
|
|
112
119
|
const vector = primitive.vector;
|
|
120
|
+
const polygon = primitive.polygon;
|
|
113
121
|
const primitiveType = primitive.primitiveType;
|
|
114
122
|
const positionAttribute = ModelUtility.getAttributeBySemantic(
|
|
115
123
|
primitive,
|
|
@@ -122,29 +130,33 @@ function gatherPrimitiveStats(primitive) {
|
|
|
122
130
|
: undefined;
|
|
123
131
|
|
|
124
132
|
if (primitiveType === PrimitiveType.POINTS) {
|
|
125
|
-
stats.pointPrimitiveCount +=
|
|
126
|
-
stats.pointVertexCount +=
|
|
133
|
+
stats.pointPrimitiveCount += positionCount;
|
|
134
|
+
stats.pointVertexCount += positionCount;
|
|
127
135
|
} else if (primitiveType === PrimitiveType.LINE_STRIP) {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
for (let i = 0; i < polygonHoleCounts.length; i++) {
|
|
146
|
-
stats.polygonHoleCount += polygonHoleCounts[i];
|
|
136
|
+
const stripCount = vector ? vector.count : getPrimitiveCount(indices);
|
|
137
|
+
stats.polylinePrimitiveCount += stripCount;
|
|
138
|
+
stats.polylineVertexCount += indices.length - stripCount + 1;
|
|
139
|
+
} else if (
|
|
140
|
+
primitiveType === PrimitiveType.TRIANGLES ||
|
|
141
|
+
primitiveType === PrimitiveType.LINE_LOOP
|
|
142
|
+
) {
|
|
143
|
+
if (vector) {
|
|
144
|
+
stats.polygonPrimitiveCount += vector.count;
|
|
145
|
+
stats.polygonVertexCount += positionCount;
|
|
146
|
+
stats.polygonTriangleCount += indices.length / 3;
|
|
147
|
+
|
|
148
|
+
const polygonHoleCounts = vector.polygonHoleCounts;
|
|
149
|
+
if (polygonHoleCounts) {
|
|
150
|
+
for (let i = 0; i < polygonHoleCounts.length; i++) {
|
|
151
|
+
stats.polygonHoleCount += polygonHoleCounts[i];
|
|
152
|
+
}
|
|
147
153
|
}
|
|
154
|
+
} else {
|
|
155
|
+
const loopCount = getPrimitiveCount(polygon.loopIndices);
|
|
156
|
+
stats.polygonPrimitiveCount += polygon.count;
|
|
157
|
+
stats.polygonVertexCount += polygon.loopIndices.length - loopCount + 1;
|
|
158
|
+
stats.polygonTriangleCount += polygon.triangleIndices.length;
|
|
159
|
+
stats.polygonHoleCount += loopCount - polygon.count;
|
|
148
160
|
}
|
|
149
161
|
} else {
|
|
150
162
|
throw new RuntimeError(`Unexpected primitive type: ${primitiveType}`);
|
|
@@ -153,12 +165,35 @@ function gatherPrimitiveStats(primitive) {
|
|
|
153
165
|
return stats;
|
|
154
166
|
}
|
|
155
167
|
|
|
168
|
+
/**
|
|
169
|
+
* Returns the number of GL primitives, separated by primitive restart index
|
|
170
|
+
* values, defined in the given index list.
|
|
171
|
+
*
|
|
172
|
+
* @param {TypedArray} indices
|
|
173
|
+
* @ignore
|
|
174
|
+
*/
|
|
175
|
+
function getPrimitiveCount(indices) {
|
|
176
|
+
const restart = getPrimitiveRestartIndex(indices);
|
|
177
|
+
|
|
178
|
+
let count = 0;
|
|
179
|
+
|
|
180
|
+
for (let i = 0; i < indices.length; i++) {
|
|
181
|
+
if (indices[i] === restart && i + 1 < indices.length) {
|
|
182
|
+
count++;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return count + 1;
|
|
187
|
+
}
|
|
188
|
+
|
|
156
189
|
/**
|
|
157
190
|
* @param {VectorGltf3DTileContent} content
|
|
158
191
|
* @param {Primitive} primitive
|
|
159
192
|
* @param {BufferPrimitiveCollection<BufferPrimitive>} collection
|
|
160
193
|
* @param {number} collectionIndex
|
|
161
194
|
* @param {Map<number, Cesium3DTileVectorFeature>} features
|
|
195
|
+
* @param {Matrix4} modelMatrix
|
|
196
|
+
* @param {FrameState} frameState
|
|
162
197
|
* @ignore
|
|
163
198
|
*/
|
|
164
199
|
function appendPrimitiveToBuffers(
|
|
@@ -167,8 +202,9 @@ function appendPrimitiveToBuffers(
|
|
|
167
202
|
collection,
|
|
168
203
|
collectionIndex,
|
|
169
204
|
features,
|
|
205
|
+
modelMatrix,
|
|
206
|
+
frameState,
|
|
170
207
|
) {
|
|
171
|
-
const vector = primitive.vector;
|
|
172
208
|
const positionAttribute = ModelUtility.getAttributeBySemantic(
|
|
173
209
|
primitive,
|
|
174
210
|
VertexAttributeSemantic.POSITION,
|
|
@@ -176,134 +212,499 @@ function appendPrimitiveToBuffers(
|
|
|
176
212
|
/** @type {TypedArray} */
|
|
177
213
|
const collectionPositions =
|
|
178
214
|
positionAttribute.typedArray ??
|
|
179
|
-
|
|
180
|
-
|
|
215
|
+
(collection.positionNormalized
|
|
216
|
+
? ModelReader.readAttributeAsRawCompactTypedArray(positionAttribute)
|
|
217
|
+
: ModelReader.readAttributeAsTypedArray(positionAttribute));
|
|
218
|
+
|
|
219
|
+
const projection =
|
|
220
|
+
frameState.mode === SceneMode.SCENE3D
|
|
221
|
+
? undefined
|
|
222
|
+
: projectPositionsFor2D(collectionPositions, modelMatrix, frameState);
|
|
223
|
+
const collectionPositionsToAppend =
|
|
224
|
+
projection?.positions ?? collectionPositions;
|
|
181
225
|
|
|
182
226
|
/** @type {TypedArray} */
|
|
183
227
|
const indices = primitive.indices
|
|
184
228
|
? ModelReader.readIndicesAsTypedArray(primitive.indices)
|
|
185
229
|
: undefined;
|
|
186
230
|
|
|
187
|
-
const
|
|
231
|
+
const getFeature = createFeatureFactoryFn(content, primitive, features);
|
|
232
|
+
|
|
233
|
+
if (collection instanceof BufferPointCollection) {
|
|
234
|
+
appendBufferPoints(
|
|
235
|
+
collection,
|
|
236
|
+
collectionIndex,
|
|
237
|
+
collectionPositionsToAppend,
|
|
238
|
+
indices,
|
|
239
|
+
getFeature,
|
|
240
|
+
);
|
|
241
|
+
} else if (collection instanceof BufferPolylineCollection) {
|
|
242
|
+
appendBufferPolylines(
|
|
243
|
+
collection,
|
|
244
|
+
collectionIndex,
|
|
245
|
+
collectionPositionsToAppend,
|
|
246
|
+
indices,
|
|
247
|
+
getFeature,
|
|
248
|
+
);
|
|
249
|
+
} else if (collection instanceof BufferPolygonCollection) {
|
|
250
|
+
if (defined(primitive.vector)) {
|
|
251
|
+
appendBufferPolygonsDeprecated(
|
|
252
|
+
collection,
|
|
253
|
+
collectionIndex,
|
|
254
|
+
collectionPositionsToAppend,
|
|
255
|
+
indices,
|
|
256
|
+
getFeature,
|
|
257
|
+
primitive.vector,
|
|
258
|
+
);
|
|
259
|
+
} else {
|
|
260
|
+
appendBufferPolygons(
|
|
261
|
+
collection,
|
|
262
|
+
collectionIndex,
|
|
263
|
+
collectionPositionsToAppend,
|
|
264
|
+
getFeature,
|
|
265
|
+
primitive.polygon,
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return projection?.referencePoint;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* @param {TypedArray} positions
|
|
275
|
+
* @param {Matrix4} modelMatrix
|
|
276
|
+
* @param {FrameState} frameState
|
|
277
|
+
* @returns {{positions: TypedArray, referencePoint: Cartesian3}}
|
|
278
|
+
* @ignore
|
|
279
|
+
*/
|
|
280
|
+
function projectPositionsFor2D(positions, modelMatrix, frameState) {
|
|
281
|
+
const projectedPositions = positions.slice();
|
|
282
|
+
const mode = frameState.mode;
|
|
283
|
+
const worldWidth =
|
|
284
|
+
CesiumMath.TWO_PI * frameState.mapProjection.ellipsoid.maximumRadius;
|
|
285
|
+
|
|
286
|
+
// Use the model origin as the reference longitude. Vertices exactly on the
|
|
287
|
+
// antimeridian can be converted to either -PI or PI depending on tiny
|
|
288
|
+
// floating-point differences. Without a shared reference, those vertices
|
|
289
|
+
// produce triangles that span the entire width of the map in 2D.
|
|
290
|
+
let referenceEasting;
|
|
291
|
+
if (mode === SceneMode.COLUMBUS_VIEW || mode === SceneMode.SCENE2D) {
|
|
292
|
+
Matrix4.getTranslation(modelMatrix, scratchReferenceWorldPosition);
|
|
293
|
+
const referenceProjected = SceneTransforms.computeActualEllipsoidPosition(
|
|
294
|
+
frameState,
|
|
295
|
+
scratchReferenceWorldPosition,
|
|
296
|
+
scratchReferenceProjectedPosition,
|
|
297
|
+
);
|
|
298
|
+
if (defined(referenceProjected)) {
|
|
299
|
+
referenceEasting = referenceProjected.y;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
const minimum = Cartesian3.fromElements(
|
|
304
|
+
Number.POSITIVE_INFINITY,
|
|
305
|
+
Number.POSITIVE_INFINITY,
|
|
306
|
+
Number.POSITIVE_INFINITY,
|
|
307
|
+
scratchProjectedMinimum,
|
|
308
|
+
);
|
|
309
|
+
const maximum = Cartesian3.fromElements(
|
|
310
|
+
Number.NEGATIVE_INFINITY,
|
|
311
|
+
Number.NEGATIVE_INFINITY,
|
|
312
|
+
Number.NEGATIVE_INFINITY,
|
|
313
|
+
scratchProjectedMaximum,
|
|
314
|
+
);
|
|
315
|
+
let projectedCount = 0;
|
|
316
|
+
|
|
317
|
+
for (let i = 0; i < positions.length; i += 3) {
|
|
318
|
+
// @ts-expect-error https://github.com/CesiumGS/cesium/pull/13302
|
|
319
|
+
Cartesian3.fromArray(projectedPositions, i, scratchPosition);
|
|
320
|
+
Matrix4.multiplyByPoint(modelMatrix, scratchPosition, scratchWorldPosition);
|
|
321
|
+
const projected = SceneTransforms.computeActualEllipsoidPosition(
|
|
322
|
+
frameState,
|
|
323
|
+
scratchWorldPosition,
|
|
324
|
+
scratchProjectedPosition,
|
|
325
|
+
);
|
|
326
|
+
if (!defined(projected)) {
|
|
327
|
+
continue;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
if (defined(referenceEasting)) {
|
|
331
|
+
const eastingOffset = projected.y - referenceEasting;
|
|
332
|
+
projected.y -=
|
|
333
|
+
getWorldCopyOffset(eastingOffset / worldWidth) * worldWidth;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
Cartesian3.minimumByComponent(projected, minimum, minimum);
|
|
337
|
+
Cartesian3.maximumByComponent(projected, maximum, maximum);
|
|
338
|
+
projectedCount++;
|
|
339
|
+
projectedPositions[i] = projected.x;
|
|
340
|
+
projectedPositions[i + 1] = projected.y;
|
|
341
|
+
projectedPositions[i + 2] = projected.z;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
if (projectedCount === 0) {
|
|
345
|
+
throw new RuntimeError(
|
|
346
|
+
"Failed to project vector tile positions to the current scene mode.",
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
const referencePoint = Cartesian3.add(minimum, maximum, new Cartesian3());
|
|
351
|
+
Cartesian3.multiplyByScalar(referencePoint, 0.5, referencePoint);
|
|
352
|
+
|
|
353
|
+
for (let i = 0; i < positions.length; i += 3) {
|
|
354
|
+
projectedPositions[i] -= referencePoint.x;
|
|
355
|
+
projectedPositions[i + 1] -= referencePoint.y;
|
|
356
|
+
projectedPositions[i + 2] -= referencePoint.z;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
return {
|
|
360
|
+
positions: projectedPositions,
|
|
361
|
+
referencePoint,
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Selects the world copy nearest to the collection reference. Exact half-world
|
|
367
|
+
* offsets are kept in the current copy instead of being rounded outward.
|
|
368
|
+
* Otherwise a vertex exactly at +180 degrees can be shifted to the -180 degree
|
|
369
|
+
* copy while the rest of its ring remains on the east side, producing
|
|
370
|
+
* triangles that span the entire map in 2D.
|
|
371
|
+
*
|
|
372
|
+
* @param {number} value Offset from the reference in world widths.
|
|
373
|
+
* @returns {number} The selected world copy.
|
|
374
|
+
* @ignore
|
|
375
|
+
*/
|
|
376
|
+
function getWorldCopyOffset(value) {
|
|
377
|
+
const nearest = Math.round(value);
|
|
378
|
+
if (Math.abs(value - nearest) === 0.5) {
|
|
379
|
+
return Math.trunc(value);
|
|
380
|
+
}
|
|
381
|
+
return nearest;
|
|
382
|
+
}
|
|
188
383
|
|
|
189
|
-
|
|
190
|
-
|
|
384
|
+
/**
|
|
385
|
+
* @callback FeatureFactoryFn
|
|
386
|
+
* @param {number} vertexOffset
|
|
387
|
+
* @returns {Cesium3DTileVectorFeature|undefined}
|
|
388
|
+
* @ignore
|
|
389
|
+
*/
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Returns a factory function that, given a vertex offset, returns the
|
|
393
|
+
* Cesium3DTileVectorFeature instance associated with the vertex.
|
|
394
|
+
*
|
|
395
|
+
* @param {VectorGltf3DTileContent} content
|
|
396
|
+
* @param {Primitive} primitive
|
|
397
|
+
* @param {Map<number, Cesium3DTileVectorFeature>} features
|
|
398
|
+
* @returns {FeatureFactoryFn}
|
|
399
|
+
* @ignore
|
|
400
|
+
*/
|
|
401
|
+
function createFeatureFactoryFn(content, primitive, features) {
|
|
402
|
+
// @ts-expect-error Missing types.
|
|
403
|
+
const label = content.tileset.featureIdLabel;
|
|
404
|
+
const featureIdComponent = ModelUtility.getFeatureIdsByLabel(
|
|
405
|
+
primitive.featureIds,
|
|
406
|
+
label,
|
|
407
|
+
);
|
|
408
|
+
|
|
409
|
+
if (!(featureIdComponent instanceof ModelComponents.FeatureIdAttribute)) {
|
|
410
|
+
return () => undefined;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
const featureIdAttribute = ModelUtility.getAttributeBySemantic(
|
|
414
|
+
primitive,
|
|
415
|
+
VertexAttributeSemantic.FEATURE_ID,
|
|
416
|
+
featureIdComponent.setIndex,
|
|
417
|
+
);
|
|
191
418
|
|
|
192
419
|
/** @type {TypedArray} */
|
|
193
|
-
|
|
420
|
+
const featureIdArray =
|
|
421
|
+
featureIdAttribute.typedArray ??
|
|
422
|
+
ModelReader.readAttributeAsTypedArray(featureIdAttribute);
|
|
423
|
+
|
|
424
|
+
for (let i = 0; i < featureIdArray.length; i++) {
|
|
425
|
+
const featureId = featureIdArray[i];
|
|
426
|
+
if (!features.has(featureId)) {
|
|
427
|
+
const feature = new Cesium3DTileVectorFeature(
|
|
428
|
+
content,
|
|
429
|
+
featureId,
|
|
430
|
+
featureIdComponent.propertyTableId,
|
|
431
|
+
);
|
|
432
|
+
features.set(featureId, feature);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
194
435
|
|
|
195
|
-
/**
|
|
196
|
-
|
|
197
|
-
* @returns {Cesium3DTileVectorFeature}
|
|
198
|
-
*/
|
|
199
|
-
function getFeature(vertexOffset) {
|
|
436
|
+
/** @type {FeatureFactoryFn} */
|
|
437
|
+
return function getFeature(vertexOffset) {
|
|
200
438
|
const featureId = featureIdArray[vertexOffset];
|
|
201
439
|
if (featureId !== featureIdComponent.nullFeatureId) {
|
|
202
440
|
return features.get(featureId);
|
|
203
441
|
}
|
|
204
|
-
}
|
|
442
|
+
};
|
|
443
|
+
}
|
|
205
444
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
445
|
+
/**
|
|
446
|
+
* @param {BufferPointCollection} collection
|
|
447
|
+
* @param {number} collectionIndex
|
|
448
|
+
* @param {TypedArray} collectionPositions
|
|
449
|
+
* @param {TypedArray} indices
|
|
450
|
+
* @param {FeatureFactoryFn} getFeature
|
|
451
|
+
* @ignore
|
|
452
|
+
*/
|
|
453
|
+
function appendBufferPoints(
|
|
454
|
+
collection,
|
|
455
|
+
collectionIndex,
|
|
456
|
+
collectionPositions,
|
|
457
|
+
indices,
|
|
458
|
+
getFeature,
|
|
459
|
+
) {
|
|
460
|
+
const vertexCount = collectionPositions.length / 3;
|
|
461
|
+
|
|
462
|
+
for (let i = 0, il = indices ? indices.length : vertexCount; i < il; i++) {
|
|
463
|
+
const vertexOffset = indices ? indices[i] : i;
|
|
464
|
+
Cartesian3.fromArray(
|
|
465
|
+
// @ts-expect-error https://github.com/CesiumGS/cesium/pull/13302
|
|
466
|
+
collectionPositions,
|
|
467
|
+
vertexOffset * 3,
|
|
468
|
+
scratchPosition,
|
|
211
469
|
);
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
for (let i = 0; i < featureIdArray.length; i++) {
|
|
217
|
-
const featureId = featureIdArray[i];
|
|
218
|
-
if (!features.has(featureId)) {
|
|
219
|
-
const feature = new Cesium3DTileVectorFeature(
|
|
220
|
-
content,
|
|
221
|
-
featureId,
|
|
222
|
-
featureIdComponent.propertyTableId,
|
|
223
|
-
);
|
|
224
|
-
features.set(featureId, feature);
|
|
225
|
-
}
|
|
470
|
+
|
|
471
|
+
const feature = getFeature(vertexOffset);
|
|
472
|
+
if (feature) {
|
|
473
|
+
feature.addPrimitiveByCollection(collectionIndex, i);
|
|
226
474
|
}
|
|
475
|
+
|
|
476
|
+
collection.add(
|
|
477
|
+
{
|
|
478
|
+
position: scratchPosition,
|
|
479
|
+
pickObject: feature,
|
|
480
|
+
featureId: feature?.featureId,
|
|
481
|
+
},
|
|
482
|
+
scratchPoint,
|
|
483
|
+
);
|
|
227
484
|
}
|
|
485
|
+
}
|
|
228
486
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
487
|
+
/**
|
|
488
|
+
* @param {BufferPolylineCollection} collection
|
|
489
|
+
* @param {number} collectionIndex
|
|
490
|
+
* @param {TypedArray} collectionPositions
|
|
491
|
+
* @param {TypedArray} indices
|
|
492
|
+
* @param {FeatureFactoryFn} getFeature
|
|
493
|
+
* @ignore
|
|
494
|
+
*/
|
|
495
|
+
function appendBufferPolylines(
|
|
496
|
+
collection,
|
|
497
|
+
collectionIndex,
|
|
498
|
+
collectionPositions,
|
|
499
|
+
indices,
|
|
500
|
+
getFeature,
|
|
501
|
+
) {
|
|
502
|
+
const restartIndex = getPrimitiveRestartIndex(indices);
|
|
503
|
+
|
|
504
|
+
let lineIndexStart = 0;
|
|
505
|
+
let lineIndexCount = 0;
|
|
506
|
+
let primitiveIndex = 0;
|
|
507
|
+
|
|
508
|
+
for (let i = 0; i < indices.length; i++) {
|
|
509
|
+
// Iteration has reached the end of a line strip primitive if the current
|
|
510
|
+
// index is a "restart index", or the next index is out of bounds.
|
|
511
|
+
const index = indices[i];
|
|
512
|
+
if (index === restartIndex) {
|
|
513
|
+
lineIndexCount = i - lineIndexStart;
|
|
514
|
+
} else if (i + 1 === indices.length) {
|
|
515
|
+
lineIndexCount = i + 1 - lineIndexStart;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
if (lineIndexCount === 0) {
|
|
519
|
+
continue;
|
|
520
|
+
}
|
|
238
521
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
522
|
+
const lineIndexEnd = lineIndexStart + lineIndexCount;
|
|
523
|
+
const lineIndices = indices.subarray(lineIndexStart, lineIndexEnd);
|
|
524
|
+
const positions = copyArrayByIndices(collectionPositions, lineIndices, 3);
|
|
242
525
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
);
|
|
526
|
+
const feature = getFeature(indices[lineIndexStart]);
|
|
527
|
+
if (feature) {
|
|
528
|
+
feature.addPrimitiveByCollection(collectionIndex, primitiveIndex);
|
|
247
529
|
}
|
|
248
|
-
} else if (collection instanceof BufferPolylineCollection) {
|
|
249
|
-
// @ts-expect-error TODO
|
|
250
|
-
forEachLineStripSegment(indices, (indexOffset, indexCount) => {
|
|
251
|
-
const i = collection.primitiveCount;
|
|
252
|
-
const vertexOffset = indices[indexOffset];
|
|
253
|
-
const positions = collectionPositions.subarray(
|
|
254
|
-
vertexOffset * 3,
|
|
255
|
-
(vertexOffset + indexCount) * 3,
|
|
256
|
-
);
|
|
257
530
|
|
|
258
|
-
|
|
259
|
-
pickObject
|
|
260
|
-
|
|
531
|
+
collection.add(
|
|
532
|
+
{ positions, pickObject: feature, featureId: feature?.featureId },
|
|
533
|
+
scratchPolyline,
|
|
534
|
+
);
|
|
261
535
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
const polygonHoleCounts = vector.polygonHoleCounts;
|
|
268
|
-
const polygonHoleOffsets = vector.polygonHoleOffsets;
|
|
269
|
-
|
|
270
|
-
const polygonCount = polygonAttributeOffsets.length;
|
|
271
|
-
for (let i = 0; i < polygonCount; i++) {
|
|
272
|
-
const polygonVertexStart = polygonAttributeOffsets[i];
|
|
273
|
-
const polygonVertexEnd =
|
|
274
|
-
i + 1 < polygonCount ? polygonAttributeOffsets[i + 1] : vertexCount;
|
|
275
|
-
|
|
276
|
-
const positions = collectionPositions.subarray(
|
|
277
|
-
polygonVertexStart * 3,
|
|
278
|
-
polygonVertexEnd * 3,
|
|
279
|
-
);
|
|
536
|
+
lineIndexStart = i + 1;
|
|
537
|
+
lineIndexCount = 0;
|
|
538
|
+
primitiveIndex++;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
280
541
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
542
|
+
/**
|
|
543
|
+
* @param {BufferPolygonCollection} collection
|
|
544
|
+
* @param {number} collectionIndex
|
|
545
|
+
* @param {TypedArray} collectionPositions
|
|
546
|
+
* @param {TypedArray} indices
|
|
547
|
+
* @param {FeatureFactoryFn} getFeature
|
|
548
|
+
* @param {Vector} vector
|
|
549
|
+
* @deprecated To be removed after v1.142 release.
|
|
550
|
+
* @ignore
|
|
551
|
+
*/
|
|
552
|
+
function appendBufferPolygonsDeprecated(
|
|
553
|
+
collection,
|
|
554
|
+
collectionIndex,
|
|
555
|
+
collectionPositions,
|
|
556
|
+
indices,
|
|
557
|
+
getFeature,
|
|
558
|
+
vector,
|
|
559
|
+
) {
|
|
560
|
+
const polygonAttributeOffsets = vector.polygonAttributeOffsets;
|
|
561
|
+
const polygonIndicesOffsets = vector.polygonIndicesOffsets;
|
|
562
|
+
const polygonHoleCounts = vector.polygonHoleCounts;
|
|
563
|
+
const polygonHoleOffsets = vector.polygonHoleOffsets;
|
|
564
|
+
collection._polygonTileBoundaryFlags = vector.polygonTileBoundaryFlags;
|
|
289
565
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
566
|
+
const vertexCount = collectionPositions.length / 3;
|
|
567
|
+
const polygonCount = polygonAttributeOffsets.length;
|
|
568
|
+
let polygonHoleOffset = 0;
|
|
569
|
+
for (let i = 0; i < polygonCount; i++) {
|
|
570
|
+
const polygonVertexStart = polygonAttributeOffsets[i];
|
|
571
|
+
const polygonVertexEnd =
|
|
572
|
+
i + 1 < polygonCount ? polygonAttributeOffsets[i + 1] : vertexCount;
|
|
573
|
+
|
|
574
|
+
const positions = collectionPositions.subarray(
|
|
575
|
+
polygonVertexStart * 3,
|
|
576
|
+
polygonVertexEnd * 3,
|
|
577
|
+
);
|
|
578
|
+
|
|
579
|
+
let holes;
|
|
580
|
+
if (defined(polygonHoleCounts) && polygonHoleCounts[i] > 0) {
|
|
581
|
+
const holeCount = polygonHoleCounts[i];
|
|
582
|
+
holes = polygonHoleOffsets.slice(
|
|
583
|
+
polygonHoleOffset,
|
|
584
|
+
polygonHoleOffset + holeCount,
|
|
585
|
+
);
|
|
586
|
+
for (let h = 0; h < holeCount; h++) {
|
|
587
|
+
holes[h] -= polygonVertexStart;
|
|
296
588
|
}
|
|
589
|
+
polygonHoleOffset += holeCount;
|
|
590
|
+
}
|
|
297
591
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
592
|
+
const triangleIndexStart = polygonIndicesOffsets[i];
|
|
593
|
+
const triangleIndexEnd =
|
|
594
|
+
i + 1 < polygonCount ? polygonIndicesOffsets[i + 1] : indices.length;
|
|
595
|
+
const triangles = indices.slice(triangleIndexStart, triangleIndexEnd);
|
|
596
|
+
for (let t = 0; t < triangles.length; t++) {
|
|
597
|
+
triangles[t] -= polygonVertexStart;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
const feature = getFeature(polygonVertexStart);
|
|
601
|
+
if (feature) {
|
|
602
|
+
feature.addPrimitiveByCollection(collectionIndex, i);
|
|
603
|
+
}
|
|
301
604
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
605
|
+
collection.add(
|
|
606
|
+
{
|
|
607
|
+
positions,
|
|
608
|
+
triangles,
|
|
609
|
+
holes,
|
|
610
|
+
pickObject: feature,
|
|
611
|
+
featureId: feature?.featureId,
|
|
612
|
+
},
|
|
613
|
+
scratchPolygon,
|
|
614
|
+
);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
/**
|
|
619
|
+
* @param {BufferPolygonCollection} collection
|
|
620
|
+
* @param {number} collectionIndex
|
|
621
|
+
* @param {TypedArray} collectionPositions
|
|
622
|
+
* @param {FeatureFactoryFn} getFeature
|
|
623
|
+
* @param {Polygon} polygon
|
|
624
|
+
* @ignore
|
|
625
|
+
*/
|
|
626
|
+
function appendBufferPolygons(
|
|
627
|
+
collection,
|
|
628
|
+
collectionIndex,
|
|
629
|
+
collectionPositions,
|
|
630
|
+
getFeature,
|
|
631
|
+
polygon,
|
|
632
|
+
) {
|
|
633
|
+
// Create mapping from vertex index in the source glTF primitive, to result
|
|
634
|
+
// vertex index in the extracted vector primitive.
|
|
635
|
+
const TypedArray = /** @type {TypedArrayConstructor} */ (
|
|
636
|
+
polygon.loopIndices.constructor
|
|
637
|
+
);
|
|
638
|
+
const resultLoopIndices = new TypedArray(polygon.loopIndices.length);
|
|
639
|
+
|
|
640
|
+
const loopRestartIndex = getPrimitiveRestartIndex(polygon.loopIndices);
|
|
641
|
+
|
|
642
|
+
for (let i = 0; i < polygon.count; i++) {
|
|
643
|
+
const isLastPolygon = i + 1 === polygon.count;
|
|
644
|
+
|
|
645
|
+
// Extract vertex loops, exterior loops followed by interior ("holes").
|
|
646
|
+
const loopIndicesStart = polygon.loopIndicesOffsets[i];
|
|
647
|
+
const loopIndicesEnd = isLastPolygon
|
|
648
|
+
? polygon.loopIndices.length
|
|
649
|
+
: polygon.loopIndicesOffsets[i + 1];
|
|
650
|
+
const loopIndices = polygon.loopIndices.subarray(
|
|
651
|
+
loopIndicesStart,
|
|
652
|
+
loopIndicesEnd,
|
|
653
|
+
);
|
|
654
|
+
const positions = copyArrayByIndices(
|
|
655
|
+
collectionPositions,
|
|
656
|
+
loopIndices,
|
|
657
|
+
3,
|
|
658
|
+
resultLoopIndices,
|
|
659
|
+
);
|
|
660
|
+
|
|
661
|
+
// List start indices of interior loops ("holes").
|
|
662
|
+
const holesArray = [];
|
|
663
|
+
let resultVertexOffset = 0;
|
|
664
|
+
for (let j = 0; j < loopIndices.length; j++) {
|
|
665
|
+
const isLastIndex = j + 1 === loopIndices.length;
|
|
666
|
+
if (loopIndices[j] === loopRestartIndex && !isLastIndex) {
|
|
667
|
+
holesArray.push(resultVertexOffset);
|
|
668
|
+
} else {
|
|
669
|
+
resultVertexOffset++;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
const holes = new TypedArray(holesArray);
|
|
673
|
+
|
|
674
|
+
// Extract or tessellate triangle indices.
|
|
675
|
+
let triangles;
|
|
676
|
+
if (defined(polygon.triangleIndices)) {
|
|
677
|
+
const triangleIndicesStart = polygon.triangleIndicesOffsets[i];
|
|
678
|
+
const triangleIndicesEnd = isLastPolygon
|
|
679
|
+
? polygon.triangleIndices.length
|
|
680
|
+
: polygon.triangleIndicesOffsets[i + 1];
|
|
681
|
+
triangles = polygon.triangleIndices.subarray(
|
|
682
|
+
triangleIndicesStart,
|
|
683
|
+
triangleIndicesEnd,
|
|
305
684
|
);
|
|
685
|
+
// Rewrite collection-local indices to polygon-local indices.
|
|
686
|
+
for (let j = 0; j < triangles.length; j++) {
|
|
687
|
+
triangles[j] = resultLoopIndices[triangles[j]];
|
|
688
|
+
}
|
|
689
|
+
} else {
|
|
690
|
+
throw new Error("Runtime triangulation not yet supported.");
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
const feature = getFeature(loopIndices[0]);
|
|
694
|
+
if (feature) {
|
|
695
|
+
feature.addPrimitiveByCollection(collectionIndex, i);
|
|
306
696
|
}
|
|
697
|
+
|
|
698
|
+
collection.add(
|
|
699
|
+
{
|
|
700
|
+
positions,
|
|
701
|
+
triangles,
|
|
702
|
+
holes,
|
|
703
|
+
pickObject: feature,
|
|
704
|
+
featureId: feature?.featureId,
|
|
705
|
+
},
|
|
706
|
+
scratchPolygon,
|
|
707
|
+
);
|
|
307
708
|
}
|
|
308
709
|
}
|
|
309
710
|
|
|
@@ -311,10 +712,19 @@ function appendPrimitiveToBuffers(
|
|
|
311
712
|
* @param {VectorGltf3DTileContent} content
|
|
312
713
|
* @param {Node} node
|
|
313
714
|
* @param {Matrix4} parentTransform
|
|
715
|
+
* @param {Matrix4} tileModelMatrix
|
|
716
|
+
* @param {FrameState} frameState
|
|
314
717
|
* @param {VectorTileResult} result
|
|
315
718
|
* @ignore
|
|
316
719
|
*/
|
|
317
|
-
function appendNodeToBuffers(
|
|
720
|
+
function appendNodeToBuffers(
|
|
721
|
+
content,
|
|
722
|
+
node,
|
|
723
|
+
parentTransform,
|
|
724
|
+
tileModelMatrix,
|
|
725
|
+
frameState,
|
|
726
|
+
result,
|
|
727
|
+
) {
|
|
318
728
|
const localTransform = ModelUtility.getNodeTransform(node);
|
|
319
729
|
const nodeTransform = Matrix4.multiplyTransformation(
|
|
320
730
|
parentTransform,
|
|
@@ -326,33 +736,46 @@ function appendNodeToBuffers(content, node, parentTransform, result) {
|
|
|
326
736
|
for (let i = 0; i < primitives.length; i++) {
|
|
327
737
|
const primitive = primitives[i];
|
|
328
738
|
const primitiveType = primitive.primitiveType;
|
|
329
|
-
if (!primitive.vector) {
|
|
330
|
-
continue;
|
|
331
|
-
}
|
|
332
739
|
|
|
333
740
|
/** @type {BufferPrimitiveCollection<BufferPrimitive>} */
|
|
334
741
|
let collection;
|
|
335
742
|
|
|
336
743
|
const stats = gatherPrimitiveStats(primitive);
|
|
337
744
|
|
|
745
|
+
const positionAttribute = ModelUtility.getAttributeBySemantic(
|
|
746
|
+
primitive,
|
|
747
|
+
VertexAttributeSemantic.POSITION,
|
|
748
|
+
);
|
|
749
|
+
const positionNormalized = positionAttribute.normalized ?? false;
|
|
750
|
+
const positionDatatype = positionAttribute.componentDatatype;
|
|
751
|
+
|
|
338
752
|
if (primitiveType === PrimitiveType.POINTS) {
|
|
339
753
|
collection = new BufferPointCollection({
|
|
340
754
|
primitiveCountMax: stats.pointPrimitiveCount,
|
|
341
755
|
allowPicking: true,
|
|
756
|
+
positionNormalized,
|
|
757
|
+
positionDatatype,
|
|
342
758
|
});
|
|
343
759
|
} else if (primitiveType === PrimitiveType.LINE_STRIP) {
|
|
344
760
|
collection = new BufferPolylineCollection({
|
|
345
761
|
primitiveCountMax: stats.polylinePrimitiveCount,
|
|
346
762
|
vertexCountMax: stats.polylineVertexCount,
|
|
347
763
|
allowPicking: true,
|
|
764
|
+
positionNormalized,
|
|
765
|
+
positionDatatype,
|
|
348
766
|
});
|
|
349
|
-
} else if (
|
|
767
|
+
} else if (
|
|
768
|
+
primitiveType === PrimitiveType.TRIANGLES ||
|
|
769
|
+
primitiveType === PrimitiveType.LINE_LOOP
|
|
770
|
+
) {
|
|
350
771
|
collection = new BufferPolygonCollection({
|
|
351
772
|
primitiveCountMax: stats.polygonPrimitiveCount,
|
|
352
773
|
vertexCountMax: stats.polygonVertexCount,
|
|
353
774
|
holeCountMax: stats.polygonHoleCount,
|
|
354
775
|
triangleCountMax: stats.polygonTriangleCount,
|
|
355
776
|
allowPicking: true,
|
|
777
|
+
positionNormalized,
|
|
778
|
+
positionDatatype,
|
|
356
779
|
});
|
|
357
780
|
}
|
|
358
781
|
|
|
@@ -363,22 +786,91 @@ function appendNodeToBuffers(content, node, parentTransform, result) {
|
|
|
363
786
|
}
|
|
364
787
|
|
|
365
788
|
result.collections.push(collection);
|
|
366
|
-
|
|
367
|
-
result.collectionFeatureTableIds.set(collection, propertyTableId);
|
|
368
|
-
|
|
369
|
-
appendPrimitiveToBuffers(
|
|
789
|
+
const referencePoint = appendPrimitiveToBuffers(
|
|
370
790
|
content,
|
|
371
791
|
primitive,
|
|
372
792
|
collection,
|
|
373
793
|
result.collections.length - 1,
|
|
374
794
|
result.featuresByTableId.get(propertyTableId),
|
|
795
|
+
Matrix4.multiplyTransformation(
|
|
796
|
+
tileModelMatrix,
|
|
797
|
+
nodeTransform,
|
|
798
|
+
new Matrix4(),
|
|
799
|
+
),
|
|
800
|
+
frameState,
|
|
801
|
+
);
|
|
802
|
+
result.collectionLocalMatrices.push(
|
|
803
|
+
defined(referencePoint)
|
|
804
|
+
? Matrix4.fromTranslation(referencePoint, new Matrix4())
|
|
805
|
+
: Matrix4.clone(nodeTransform),
|
|
375
806
|
);
|
|
807
|
+
result.collectionFeatureTableIds.set(collection, propertyTableId);
|
|
376
808
|
}
|
|
377
809
|
|
|
378
810
|
const children = node.children;
|
|
379
811
|
for (let i = 0; i < children.length; i++) {
|
|
380
|
-
appendNodeToBuffers(
|
|
812
|
+
appendNodeToBuffers(
|
|
813
|
+
content,
|
|
814
|
+
children[i],
|
|
815
|
+
nodeTransform,
|
|
816
|
+
tileModelMatrix,
|
|
817
|
+
frameState,
|
|
818
|
+
result,
|
|
819
|
+
);
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* Given a source array and a list of indices, creates and returns a new array
|
|
825
|
+
* containing all values of the source array specified by the indices. Indices
|
|
826
|
+
* may contain "primitive restart index" values. Optionally, a 'resultIndices'
|
|
827
|
+
* parameter can be populated with a mapping from source index to result index.
|
|
828
|
+
*
|
|
829
|
+
* @param {TypedArray} array
|
|
830
|
+
* @param {TypedArray} indices
|
|
831
|
+
* @param {number} stride
|
|
832
|
+
* @param {TypedArray} [resultIndices]
|
|
833
|
+
* @returns {TypedArray}
|
|
834
|
+
* @ignore
|
|
835
|
+
*/
|
|
836
|
+
function copyArrayByIndices(array, indices, stride, resultIndices) {
|
|
837
|
+
const restartIndex = getPrimitiveRestartIndex(indices);
|
|
838
|
+
|
|
839
|
+
// Scan and count the number of non-restart indices.
|
|
840
|
+
let count = 0;
|
|
841
|
+
for (let i = 0; i < indices.length; i++) {
|
|
842
|
+
const index = indices[i];
|
|
843
|
+
if (index !== restartIndex) {
|
|
844
|
+
count++;
|
|
845
|
+
}
|
|
381
846
|
}
|
|
847
|
+
|
|
848
|
+
const TypedArray = /** @type {TypedArrayConstructor} */ (array.constructor);
|
|
849
|
+
const result = new TypedArray(count * stride);
|
|
850
|
+
|
|
851
|
+
// Write each result value, skipping primitive restart indices. Write source
|
|
852
|
+
// index -> result index to 'resultIndices' if provided.
|
|
853
|
+
let dstIndex = 0;
|
|
854
|
+
for (let i = 0; i < indices.length; i++) {
|
|
855
|
+
const srcIndex = indices[i];
|
|
856
|
+
|
|
857
|
+
if (resultIndices) {
|
|
858
|
+
resultIndices[srcIndex] =
|
|
859
|
+
srcIndex === restartIndex ? restartIndex : dstIndex;
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
if (srcIndex === restartIndex) {
|
|
863
|
+
continue;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
for (let j = 0; j < stride; j++) {
|
|
867
|
+
result[dstIndex * stride + j] = array[srcIndex * stride + j];
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
dstIndex++;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
return result;
|
|
382
874
|
}
|
|
383
875
|
|
|
384
876
|
export default createVectorTileBuffersFromModelComponents;
|