@cesium/engine 26.2.0 → 26.3.1-wasm.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/ThirdParty/Workers/zip-web-worker.js +707 -600
- package/Build/Workers/chunk-2P3WKV6V.js +290 -0
- package/Build/Workers/{chunk-M6QKXVAU.js → chunk-2U5272QU.js} +17 -17
- package/Build/Workers/{chunk-NEFDMMLY.js → chunk-4KCOC6OZ.js} +8 -10
- package/Build/Workers/{chunk-SJYSIOEM.js → chunk-5FULJNWY.js} +11 -13
- package/Build/Workers/{chunk-NCL22ZUX.js → chunk-65ZF23AQ.js} +1 -1
- package/Build/Workers/{chunk-KP5QD7WU.js → chunk-6D5534B7.js} +10 -12
- package/Build/Workers/{chunk-FX3VEAIU.js → chunk-6GFMBHBD.js} +19 -19
- package/Build/Workers/{chunk-A62YI6S6.js → chunk-6VRGQF3D.js} +4 -4
- package/Build/Workers/{chunk-DSGLDRTI.js → chunk-6XUIECFB.js} +4 -6
- package/Build/Workers/{chunk-HDL4HOXZ.js → chunk-7KWUH6RK.js} +14 -14
- package/Build/Workers/{chunk-UAZUP4I5.js → chunk-7ZBJRQQT.js} +7 -7
- package/Build/Workers/{chunk-CRCGE4J4.js → chunk-AEHANE5A.js} +991 -5612
- package/Build/Workers/chunk-AUU74SIZ.js +2420 -0
- package/Build/Workers/{chunk-ARZICEEP.js → chunk-B6V5NMIE.js} +13 -11
- package/Build/Workers/{chunk-76FDC45O.js → chunk-BRQ52ASU.js} +15 -17
- package/Build/Workers/{chunk-SA2A2AN5.js → chunk-FVLSQBPH.js} +7 -14
- package/Build/Workers/{chunk-CUTRKXUQ.js → chunk-IFKM2GZR.js} +12 -12
- package/Build/Workers/{chunk-NSKZ6SBK.js → chunk-KF6OEWVT.js} +17 -17
- package/Build/Workers/{chunk-O3DKEX7Q.js → chunk-KOAXSU77.js} +5 -7
- package/Build/Workers/{chunk-2Z4ZLVOD.js → chunk-KRVYCMGN.js} +6 -6
- package/Build/Workers/{chunk-SXSP3JHS.js → chunk-LTZRLNQP.js} +1 -1
- package/Build/Workers/{chunk-6FZDPMTO.js → chunk-M7WEAGWT.js} +8 -8
- package/Build/Workers/{chunk-NXGQBQWE.js → chunk-MJTLGN63.js} +14 -14
- package/Build/Workers/{chunk-XCBZVTIV.js → chunk-MUNZ77KV.js} +1 -1
- package/Build/Workers/{chunk-NLLCQBX3.js → chunk-NC5BUJEF.js} +2 -2
- package/Build/Workers/chunk-NYKURYFR.js +2131 -0
- package/Build/Workers/{chunk-5LSOO2KD.js → chunk-NZAQG57U.js} +7 -7
- package/Build/Workers/{chunk-DZUFEE4L.js → chunk-O5GUOP2G.js} +5 -7
- package/Build/Workers/{chunk-D6AY775A.js → chunk-OQUOLQTN.js} +8 -10
- package/Build/Workers/{chunk-CDJDJ5LK.js → chunk-OUG5JB2K.js} +16 -14
- package/Build/Workers/{chunk-ACTVJHSP.js → chunk-P4SDLSGF.js} +13 -6
- package/Build/Workers/{chunk-MAAHFYPC.js → chunk-P6PC2OIM.js} +7 -7
- package/Build/Workers/{chunk-6YR6JBMY.js → chunk-PPRK3XQU.js} +31 -35
- package/Build/Workers/{chunk-IMBVP57H.js → chunk-QGTYLWOT.js} +2 -2
- package/Build/Workers/{chunk-FCP2QY4G.js → chunk-QHTLIQUH.js} +5 -7
- package/Build/Workers/{chunk-EZGQPOIG.js → chunk-ROHWZQZ5.js} +5 -5
- package/Build/Workers/{chunk-B3QHNA4A.js → chunk-SNUWISJO.js} +6 -8
- package/Build/Workers/{chunk-XDWCTQCZ.js → chunk-T67YY3KP.js} +4 -2
- package/Build/Workers/{chunk-IJZJMIUY.js → chunk-TF5473GK.js} +13 -13
- package/Build/Workers/{chunk-OZGPS7FB.js → chunk-THHFTMAL.js} +4 -6
- package/Build/Workers/{chunk-PRWUMCXF.js → chunk-UFCZ62WM.js} +15 -13
- package/Build/Workers/{chunk-27FWRTJI.js → chunk-UV2YC2Q5.js} +11 -11
- package/Build/Workers/{chunk-N7CCOFLX.js → chunk-V4ICCWYA.js} +1 -1
- package/Build/Workers/{chunk-GHXVQVUM.js → chunk-VC6XXI2Z.js} +9 -9
- package/Build/Workers/{chunk-I74ZH5LK.js → chunk-VXJ6P4UI.js} +10 -10
- package/Build/Workers/{chunk-KGXSYGBG.js → chunk-W2BKP7G7.js} +15 -17
- package/Build/Workers/{chunk-LDRQSYBN.js → chunk-WMVGNBSH.js} +2 -2
- package/Build/Workers/{chunk-SMTGMFBL.js → chunk-XFZMQZSZ.js} +4 -4
- package/Build/Workers/{chunk-7MM3N2VE.js → chunk-XJ532R6R.js} +20 -20
- package/Build/Workers/{chunk-NJVBJG63.js → chunk-YJNU4SM4.js} +5 -5
- package/Build/Workers/{chunk-DIGUUD6G.js → chunk-YJRDTEHQ.js} +8 -8
- package/Build/Workers/chunk-YUICDZKO.js +2660 -0
- package/Build/Workers/{chunk-O3XFXGPZ.js → chunk-Z3DEVGJV.js} +7 -7
- package/Build/Workers/{chunk-3PSS3T43.js → chunk-ZECGI7UZ.js} +4 -4
- package/Build/Workers/{chunk-QFSSCLLZ.js → chunk-ZFLPVPUJ.js} +6 -8
- package/Build/Workers/{chunk-2RGJPWQX.js → chunk-ZIM5H2DB.js} +11 -11
- package/Build/Workers/{chunk-GVA7XQI2.js → chunk-ZSQMGGSB.js} +14 -16
- package/Build/Workers/{chunk-FU4BGABC.js → chunk-ZWYRGMBK.js} +16 -18
- package/Build/Workers/{chunk-JKXV6PG5.js → chunk-ZY733NZA.js} +1 -1
- package/Build/Workers/combineGeometry.js +24 -24
- package/Build/Workers/createBoxGeometry.js +18 -18
- package/Build/Workers/createBoxOutlineGeometry.js +20 -19
- package/Build/Workers/createCircleGeometry.js +28 -27
- package/Build/Workers/createCircleOutlineGeometry.js +21 -20
- package/Build/Workers/createCoplanarPolygonGeometry.js +34 -34
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +33 -32
- package/Build/Workers/createCorridorGeometry.js +31 -31
- package/Build/Workers/createCorridorOutlineGeometry.js +30 -30
- package/Build/Workers/createCylinderGeometry.js +20 -20
- package/Build/Workers/createCylinderOutlineGeometry.js +22 -21
- 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 +27 -26
- package/Build/Workers/createGroundPolylineGeometry.js +27 -26
- package/Build/Workers/createPlaneGeometry.js +18 -17
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
- package/Build/Workers/createPolygonGeometry.js +35 -35
- package/Build/Workers/createPolygonOutlineGeometry.js +34 -34
- package/Build/Workers/createPolylineGeometry.js +28 -29
- package/Build/Workers/createPolylineVolumeGeometry.js +34 -35
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +30 -31
- package/Build/Workers/createRectangleGeometry.js +30 -30
- package/Build/Workers/createRectangleOutlineGeometry.js +23 -24
- package/Build/Workers/createSimplePolylineGeometry.js +26 -27
- 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 +17 -16
- 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 +17 -16
- package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +36 -26
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +24 -24
- package/Build/Workers/createVerticesFromHeightmap.js +24 -25
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
- package/Build/Workers/createWallGeometry.js +27 -28
- package/Build/Workers/createWallOutlineGeometry.js +26 -27
- package/Build/Workers/decodeDraco.js +16 -12
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +336 -337
- package/Build/Workers/decodeI3S.js +17 -12
- package/Build/Workers/{chunk-GXWQZBAI.js → decodeMeshopt.js} +23 -29
- package/Build/Workers/decodeSpz.js +1960 -0
- package/Build/Workers/gaussianSplatSorter.js +13 -6
- package/Build/Workers/gaussianSplatTextureGenerator.js +13 -6
- package/Build/Workers/incrementallyBuildTerrainPicker.js +9 -10
- package/Build/Workers/transcodeKTX2.js +26 -12
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +24 -24
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Source/Core/Cesium3DTilesTerrainData.js +11 -1
- package/Source/Core/Cesium3DTilesTerrainGeometryProcessor.js +33 -23
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/IonResource.js +5 -0
- package/Source/Core/IonSnapGeometryType.js +59 -0
- package/Source/Core/IonSnapHeat.js +33 -0
- package/Source/Core/IonSnapMode.js +45 -0
- package/Source/Core/IonSnapParentGeometryType.js +52 -0
- package/Source/Core/IonSnapService.js +369 -0
- package/Source/Core/KTX2Transcoder.js +99 -5
- package/Source/Core/Resource.js +2 -0
- package/Source/Core/SnapService.js +63 -0
- package/Source/Core/TaskProcessor.js +249 -129
- package/Source/Core/TrustedServers.js +34 -1
- package/Source/Core/VectorPipeline.js +139 -45
- package/Source/Core/VectorProvider.js +311 -71
- package/Source/Core/WebAssemblyWorkerInitializer.js +125 -0
- package/Source/Core/fetchWebAssemblyBinary.js +52 -0
- package/Source/Renderer/AutomaticUniforms.js +44 -2
- package/Source/Renderer/ShaderBuilder.js +1 -1
- package/Source/Renderer/UniformState.js +47 -1
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/BufferPointCollection.js +4 -7
- package/Source/Scene/BufferPolygonCollection.js +56 -27
- package/Source/Scene/BufferPolylineCollection.js +61 -8
- package/Source/Scene/BufferPolylineMaterial.js +6 -5
- package/Source/Scene/BufferPrimitiveCollection.js +199 -29
- package/Source/Scene/Cesium3DTile.js +12 -0
- package/Source/Scene/Cesium3DTileset.js +61 -8
- package/Source/Scene/Cesium3DTilesetBaseTraversal.js +15 -3
- package/Source/Scene/Cesium3DTilesetCache.js +15 -0
- package/Source/Scene/ClippingPolygon.js +154 -100
- package/Source/Scene/ClippingPolygonCollection.js +352 -694
- package/Source/Scene/CreditDisplay.js +62 -0
- package/Source/Scene/GaussianSplatPrimitive.js +153 -66
- package/Source/Scene/GeoJsonPrimitive.js +114 -24
- package/Source/Scene/GlobeSurfaceShaderSet.js +33 -54
- package/Source/Scene/GlobeSurfaceTile.js +14 -1
- package/Source/Scene/GlobeSurfaceTileProvider.js +232 -25
- package/Source/Scene/GltfBufferViewLoader.js +25 -13
- package/Source/Scene/GltfLoader.js +56 -6
- package/Source/Scene/GltfSpzLoader.js +5 -4
- package/Source/Scene/HeightReference.js +1 -1
- package/Source/Scene/MVTDataProvider.js +9 -0
- package/Source/Scene/Model/Model.js +242 -16
- package/Source/Scene/Model/Model3DTileContent.js +5 -0
- package/Source/Scene/Model/ModelClippingPolygonsPipelineStage.js +54 -19
- package/Source/Scene/Model/ModelRenderResources.js +2 -3
- package/Source/Scene/Model/ModelSceneGraph.js +10 -1
- package/Source/Scene/Model/ModelVectorLookupPipelineStage.js +205 -0
- package/Source/Scene/Model/PickingPipelineStage.js +4 -0
- package/Source/Scene/PostProcessStage.js +22 -3
- package/Source/Scene/Scene.js +56 -1
- package/Source/Scene/Snapping.js +57 -0
- package/Source/Scene/SpzDecoder.js +106 -0
- package/Source/Scene/UrlTemplate3DTilesDataProvider.js +12 -1
- package/Source/Scene/VectorGltf3DTileContent.js +10 -2
- package/Source/Scene/WebMapServiceImageryProvider.js +5 -1
- package/Source/Scene/WebMapTileServiceImageryProvider.js +6 -1
- package/Source/Scene/renderBufferPolylineCollection.js +5 -1
- package/Source/Shaders/BufferPolylineMaterialVS.glsl +14 -2
- package/Source/Shaders/BufferPolylineMaterialVS.js +14 -2
- package/Source/Shaders/Builtin/CzmBuiltins.js +2 -4
- package/Source/Shaders/Builtin/Functions/eyeToCartographicDelta.glsl +74 -0
- package/Source/Shaders/Builtin/Functions/eyeToCartographicDelta.js +76 -0
- package/Source/Shaders/GlobeFS.glsl +10 -9
- package/Source/Shaders/GlobeFS.js +11 -9
- package/Source/Shaders/GlobeVS.glsl +0 -32
- package/Source/Shaders/GlobeVS.js +0 -32
- package/Source/Shaders/Model/ModelClippingPolygonsStageFS.glsl +15 -3
- package/Source/Shaders/Model/ModelClippingPolygonsStageFS.js +15 -3
- package/Source/Shaders/Model/ModelClippingPolygonsStageVS.glsl +20 -24
- package/Source/Shaders/Model/ModelClippingPolygonsStageVS.js +20 -24
- package/Source/Shaders/Model/ModelFS.glsl +4 -0
- package/Source/Shaders/Model/ModelFS.js +4 -0
- package/Source/Shaders/Model/ModelVS.glsl +7 -2
- package/Source/Shaders/Model/ModelVS.js +7 -2
- package/Source/Shaders/Model/ModelVectorLookupStageFS.glsl +6 -0
- package/Source/Shaders/Model/ModelVectorLookupStageFS.js +8 -0
- package/Source/Shaders/Model/ModelVectorLookupStageVS.glsl +15 -0
- package/Source/Shaders/Model/ModelVectorLookupStageVS.js +17 -0
- package/Source/Shaders/Model/VerticalExaggerationStageVS.glsl +9 -10
- package/Source/Shaders/Model/VerticalExaggerationStageVS.js +9 -11
- package/Source/Shaders/VectorCommon.glsl +177 -50
- package/Source/Shaders/VectorCommon.js +251 -19
- package/Source/ThirdParty/Workers/zip-web-worker.js +1 -1
- package/Source/ThirdParty/zip-module.wasm +0 -0
- package/Source/Workers/createTaskProcessorWorker.js +2 -0
- package/Source/Workers/createVerticesFromCesium3DTilesTerrain.js +13 -1
- package/Source/Workers/decodeDraco.js +7 -3
- package/Source/Workers/decodeI3S.js +7 -3
- package/Source/Workers/decodeMeshopt.js +21 -0
- package/Source/Workers/decodeSpz.js +20 -0
- package/Source/Workers/gaussianSplatSorter.js +7 -3
- package/Source/Workers/gaussianSplatTextureGenerator.js +7 -3
- package/Source/Workers/transcodeKTX2.js +22 -5
- package/index.d.ts +649 -55
- package/index.js +23 -13
- package/package.json +6 -6
- package/Build/Workers/chunk-2EFYUSUY.js +0 -1483
- package/Build/Workers/chunk-2H5264K7.js +0 -1284
- package/Build/Workers/chunk-2H73KDBM.js +0 -511
- package/Build/Workers/chunk-2ZKH2QZB.js +0 -387
- package/Build/Workers/chunk-36NI5E6W.js +0 -3820
- package/Build/Workers/chunk-37SW7SYS.js +0 -778
- package/Build/Workers/chunk-3GHVJ3SO.js +0 -455
- package/Build/Workers/chunk-3LB4UVPU.js +0 -387
- package/Build/Workers/chunk-3PONLKEL.js +0 -778
- package/Build/Workers/chunk-3QR662HH.js +0 -3820
- package/Build/Workers/chunk-3SX2WYSO.js +0 -973
- package/Build/Workers/chunk-3UDN6LYX.js +0 -476
- package/Build/Workers/chunk-47MCBSXI.js +0 -9237
- package/Build/Workers/chunk-4E626OCE.js +0 -1067
- package/Build/Workers/chunk-4NW2MJKH.js +0 -455
- package/Build/Workers/chunk-52YK5BSN.js +0 -198
- package/Build/Workers/chunk-5RNAQZK6.js +0 -9234
- package/Build/Workers/chunk-5YPQBFRD.js +0 -519
- package/Build/Workers/chunk-6FHT43QR.js +0 -140
- package/Build/Workers/chunk-6HK6IXK2.js +0 -138
- package/Build/Workers/chunk-6R5X2GUA.js +0 -1284
- package/Build/Workers/chunk-7A2OGDHT.js +0 -305
- package/Build/Workers/chunk-7CGEQUM2.js +0 -305
- package/Build/Workers/chunk-7D2HZKH7.js +0 -455
- package/Build/Workers/chunk-7I325HV6.js +0 -1344
- package/Build/Workers/chunk-7KVKHY7O.js +0 -147
- package/Build/Workers/chunk-7TKLTCZW.js +0 -219
- package/Build/Workers/chunk-7UUKBDH6.js +0 -1054
- package/Build/Workers/chunk-7W6DUHAB.js +0 -693
- package/Build/Workers/chunk-7XM5JK5F.js +0 -162
- package/Build/Workers/chunk-7YG3ND3P.js +0 -454
- package/Build/Workers/chunk-A3O6EDBK.js +0 -73
- package/Build/Workers/chunk-A6X24AZI.js +0 -1992
- package/Build/Workers/chunk-A7TTWVTF.js +0 -2719
- package/Build/Workers/chunk-ADX3CBKD.js +0 -9234
- package/Build/Workers/chunk-AF7DTMJ7.js +0 -398
- package/Build/Workers/chunk-AHWAZRBV.js +0 -82
- package/Build/Workers/chunk-AJSFRY4U.js +0 -1344
- package/Build/Workers/chunk-B4CQSLZJ.js +0 -305
- package/Build/Workers/chunk-BKPQFCXH.js +0 -511
- package/Build/Workers/chunk-BSPCI2LO.js +0 -959
- package/Build/Workers/chunk-BUJWSX5S.js +0 -301
- package/Build/Workers/chunk-C7JQVRLM.js +0 -497
- package/Build/Workers/chunk-C7QDUNI3.js +0 -138
- package/Build/Workers/chunk-CEEZE3YZ.js +0 -476
- package/Build/Workers/chunk-CIV5DJOQ.js +0 -778
- package/Build/Workers/chunk-CLCTQVVL.js +0 -241
- package/Build/Workers/chunk-CQNFIAZU.js +0 -56
- package/Build/Workers/chunk-DBD5WWG2.js +0 -959
- package/Build/Workers/chunk-DZBQUULR.js +0 -138
- package/Build/Workers/chunk-E2NKV5YT.js +0 -3820
- package/Build/Workers/chunk-E7NZJOK7.js +0 -3792
- package/Build/Workers/chunk-EB3Y5P3A.js +0 -368
- package/Build/Workers/chunk-EHTS2YPT.js +0 -2719
- package/Build/Workers/chunk-ELE6SC2C.js +0 -837
- package/Build/Workers/chunk-ENNFMWDW.js +0 -789
- package/Build/Workers/chunk-EOWDZN5S.js +0 -288
- package/Build/Workers/chunk-ERKUET22.js +0 -3201
- package/Build/Workers/chunk-F2IMBMZY.js +0 -241
- package/Build/Workers/chunk-F4CSNRZO.js +0 -219
- package/Build/Workers/chunk-FBP4DUQJ.js +0 -693
- package/Build/Workers/chunk-FDK4K5IA.js +0 -280
- package/Build/Workers/chunk-FGQFQHN5.js +0 -1054
- package/Build/Workers/chunk-FJWZMGOQ.js +0 -1992
- package/Build/Workers/chunk-FQ42MT7M.js +0 -58
- package/Build/Workers/chunk-GGNWQWSB.js +0 -301
- package/Build/Workers/chunk-GNKXEN4C.js +0 -682
- package/Build/Workers/chunk-GSWMAFTE.js +0 -9230
- package/Build/Workers/chunk-GXDHRC4J.js +0 -1344
- package/Build/Workers/chunk-GYSYP6PC.js +0 -1067
- package/Build/Workers/chunk-H2WCFXLP.js +0 -241
- package/Build/Workers/chunk-HHV3MCGV.js +0 -162
- package/Build/Workers/chunk-HLW2ZRVK.js +0 -368
- package/Build/Workers/chunk-HS6AD4P2.js +0 -398
- package/Build/Workers/chunk-HT6FASOT.js +0 -973
- package/Build/Workers/chunk-IDVHUDZT.js +0 -352
- package/Build/Workers/chunk-IGAZBTFZ.js +0 -3201
- package/Build/Workers/chunk-ILME5BXA.js +0 -301
- package/Build/Workers/chunk-IOO7Z2AV.js +0 -57
- package/Build/Workers/chunk-IUIFLOYO.js +0 -44
- package/Build/Workers/chunk-J73T2VOY.js +0 -171
- package/Build/Workers/chunk-JALGQYDY.js +0 -288
- package/Build/Workers/chunk-JW6OZT4R.js +0 -288
- package/Build/Workers/chunk-JXYLJCTC.js +0 -124
- package/Build/Workers/chunk-K27QOAW6.js +0 -97
- package/Build/Workers/chunk-KMV25A63.js +0 -789
- package/Build/Workers/chunk-KZWFWJML.js +0 -2719
- package/Build/Workers/chunk-LCXRRALY.js +0 -387
- package/Build/Workers/chunk-LD64RPYV.js +0 -368
- package/Build/Workers/chunk-LGNDTZVX.js +0 -97
- package/Build/Workers/chunk-LNSQVXFH.js +0 -1800
- package/Build/Workers/chunk-M4JZ6TSZ.js +0 -959
- package/Build/Workers/chunk-MCJDRDJQ.js +0 -102
- package/Build/Workers/chunk-MEENMEAH.js +0 -198
- package/Build/Workers/chunk-NAWU5RF4.js +0 -162
- package/Build/Workers/chunk-NIWITKQK.js +0 -693
- package/Build/Workers/chunk-OA6MYL2C.js +0 -837
- package/Build/Workers/chunk-OBEU25PI.js +0 -1067
- package/Build/Workers/chunk-OHP4ELS7.js +0 -198
- package/Build/Workers/chunk-PCL3Y7H5.js +0 -82
- package/Build/Workers/chunk-PD4GK4EM.js +0 -57
- package/Build/Workers/chunk-PEDU33QG.js +0 -2342
- package/Build/Workers/chunk-PVTSNNVI.js +0 -288
- package/Build/Workers/chunk-QHPZH22L.js +0 -241
- package/Build/Workers/chunk-QIZDWZK6.js +0 -301
- package/Build/Workers/chunk-QV6DG2YX.js +0 -1483
- package/Build/Workers/chunk-QVLAFFJY.js +0 -56
- package/Build/Workers/chunk-R4FPNAZ2.js +0 -352
- package/Build/Workers/chunk-R4K7EHOU.js +0 -171
- package/Build/Workers/chunk-R7JGHDD6.js +0 -789
- package/Build/Workers/chunk-RASQEYD4.js +0 -1483
- package/Build/Workers/chunk-RG4F5R57.js +0 -454
- package/Build/Workers/chunk-RW6ITX7Q.js +0 -3820
- package/Build/Workers/chunk-RYSQVJR6.js +0 -398
- package/Build/Workers/chunk-S6RJU5NM.js +0 -1054
- package/Build/Workers/chunk-SDFHDNS4.js +0 -147
- package/Build/Workers/chunk-SF6K72D7.js +0 -124
- package/Build/Workers/chunk-SGRGNDOD.js +0 -682
- package/Build/Workers/chunk-SM2CDCYF.js +0 -198
- package/Build/Workers/chunk-SS5ABQGY.js +0 -102
- package/Build/Workers/chunk-T5QBPLE3.js +0 -414
- package/Build/Workers/chunk-TN35HP5B.js +0 -1067
- package/Build/Workers/chunk-TNWKJNUZ.js +0 -454
- package/Build/Workers/chunk-TOAF47AQ.js +0 -102
- package/Build/Workers/chunk-TQ4QCOXT.js +0 -2719
- package/Build/Workers/chunk-TSDSILQB.js +0 -124
- package/Build/Workers/chunk-TVZD72WJ.js +0 -778
- package/Build/Workers/chunk-U5LV3F3Z.js +0 -1054
- package/Build/Workers/chunk-UEY73NRN.js +0 -38
- package/Build/Workers/chunk-UF46SZEZ.js +0 -789
- package/Build/Workers/chunk-UNRTMCET.js +0 -398
- package/Build/Workers/chunk-UTB7U3O6.js +0 -1992
- package/Build/Workers/chunk-UVO6COT2.js +0 -352
- package/Build/Workers/chunk-V46YGZE6.js +0 -352
- package/Build/Workers/chunk-VAL7DYNR.js +0 -278
- package/Build/Workers/chunk-VDGOCROW.js +0 -57
- package/Build/Workers/chunk-VFWSSBPT.js +0 -511
- package/Build/Workers/chunk-VVYMXI3I.js +0 -1284
- package/Build/Workers/chunk-VXWHPYQM.js +0 -837
- package/Build/Workers/chunk-VXYUBRSB.js +0 -219
- package/Build/Workers/chunk-VZLDLEWI.js +0 -387
- package/Build/Workers/chunk-W5OCKMPJ.js +0 -101
- package/Build/Workers/chunk-WBSY7HDY.js +0 -837
- package/Build/Workers/chunk-WN3F4CVG.js +0 -3201
- package/Build/Workers/chunk-WPRUWXGV.js +0 -693
- package/Build/Workers/chunk-WTO2ERBP.js +0 -414
- package/Build/Workers/chunk-WVHMDVG4.js +0 -959
- package/Build/Workers/chunk-XGA23TAX.js +0 -73
- package/Build/Workers/chunk-XLQZNQ4Z.js +0 -163
- package/Build/Workers/chunk-XLXSDIP5.js +0 -973
- package/Build/Workers/chunk-XQ3SKCMM.js +0 -140
- package/Build/Workers/chunk-XQH66YJC.js +0 -147
- package/Build/Workers/chunk-XTA7BXJG.js +0 -682
- package/Build/Workers/chunk-XTIDAFRS.js +0 -476
- package/Build/Workers/chunk-XUEDWBUD.js +0 -682
- package/Build/Workers/chunk-XYFLRH3H.js +0 -124
- package/Build/Workers/chunk-Y7JRTRTO.js +0 -305
- package/Build/Workers/chunk-Y7QSMDCJ.js +0 -352
- package/Build/Workers/chunk-YCB5TYTR.js +0 -1483
- package/Build/Workers/chunk-YEYOSTJX.js +0 -219
- package/Build/Workers/chunk-YGFVAGYF.js +0 -630
- package/Build/Workers/chunk-YIIACKQO.js +0 -368
- package/Build/Workers/chunk-YJGSP6PE.js +0 -511
- package/Build/Workers/chunk-YKU2Q3A2.js +0 -1287
- package/Build/Workers/chunk-Z4LR5EHE.js +0 -454
- package/Build/Workers/chunk-Z66EVE2A.js +0 -44
- package/Build/Workers/chunk-ZHIHHHTB.js +0 -414
- package/Build/Workers/chunk-ZMBHFYOX.js +0 -1344
- package/Build/Workers/chunk-ZNWHFSLE.js +0 -171
- package/Build/Workers/chunk-ZQLZG4IN.js +0 -2342
- package/Build/Workers/chunk-ZRTSMUZ2.js +0 -414
- package/Build/Workers/chunk-ZSGUV73H.js +0 -2342
- package/Build/Workers/chunk-ZZUVT5BM.js +0 -476
- package/Source/Shaders/Builtin/Functions/clipPolygons.glsl +0 -37
- package/Source/Shaders/Builtin/Functions/clipPolygons.js +0 -39
- package/Source/Shaders/Builtin/Functions/unpackClippingExtents.glsl +0 -14
- package/Source/Shaders/Builtin/Functions/unpackClippingExtents.js +0 -15
- package/Source/Shaders/PolygonSignedDistanceFS.glsl +0 -131
- package/Source/Shaders/PolygonSignedDistanceFS.js +0 -132
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The snap modes supported by {@link IonSnapService#snap}. These follow the
|
|
3
|
+
* MicroStation snap mode semantics; see the
|
|
4
|
+
* {@link https://docs.bentley.com/LiveContent/web/MicroStation%20Help-v27/en/GUID-77D54C0B-D6FF-13DA-5EC8-3196330F5244.html|MicroStation documentation}
|
|
5
|
+
* for reference.
|
|
6
|
+
*
|
|
7
|
+
* @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
|
|
8
|
+
*
|
|
9
|
+
* @enum {number}
|
|
10
|
+
*/
|
|
11
|
+
const IonSnapMode = {
|
|
12
|
+
/**
|
|
13
|
+
* Snaps to the point on the element nearest to the cursor. When the cursor
|
|
14
|
+
* is farther than the snap aperture from an edge, tracks the surface under
|
|
15
|
+
* the cursor instead.
|
|
16
|
+
* @type {number}
|
|
17
|
+
* @constant
|
|
18
|
+
*/
|
|
19
|
+
NEAREST: 1,
|
|
20
|
+
/**
|
|
21
|
+
* Snaps to the nearest of the element's keypoints. Keypoints are defined by
|
|
22
|
+
* the element's geometry type and the snap divisor.
|
|
23
|
+
* <p>
|
|
24
|
+
* On linear elements, keypoints are regularly spaced along each segment:
|
|
25
|
+
* the number of keypoints on a segment is one greater than the snap
|
|
26
|
+
* divisor, and a segment's midpoint is a keypoint only when the divisor is
|
|
27
|
+
* even. The ion API does not currently accept a snap divisor, so the
|
|
28
|
+
* server's default divisor applies.
|
|
29
|
+
* </p>
|
|
30
|
+
* @type {number}
|
|
31
|
+
* @constant
|
|
32
|
+
*/
|
|
33
|
+
NEAREST_KEYPOINT: 2,
|
|
34
|
+
/**
|
|
35
|
+
* Snaps to the center of elements that have centers (such as circles and
|
|
36
|
+
* arcs). For other elements, may snap to the centroid.
|
|
37
|
+
* @type {number}
|
|
38
|
+
* @constant
|
|
39
|
+
*/
|
|
40
|
+
CENTER: 8,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
Object.freeze(IonSnapMode);
|
|
44
|
+
|
|
45
|
+
export default IonSnapMode;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The type of the parent geometry a snap resolved to, reported by
|
|
3
|
+
* {@link IonSnapService#snap} as {@link IonSnapService.Result} <code>parentGeometryType</code>.
|
|
4
|
+
* Values match the iTwin.js
|
|
5
|
+
* {@link https://www.itwinjs.org/reference/core-frontend/locatingelements/hitparentgeomtype/|HitParentGeomType} enum.
|
|
6
|
+
*
|
|
7
|
+
* @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
|
|
8
|
+
*
|
|
9
|
+
* @enum {number}
|
|
10
|
+
*/
|
|
11
|
+
const IonSnapParentGeometryType = {
|
|
12
|
+
/**
|
|
13
|
+
* No parent geometry type.
|
|
14
|
+
* @type {number}
|
|
15
|
+
* @constant
|
|
16
|
+
*/
|
|
17
|
+
NONE: 0,
|
|
18
|
+
/**
|
|
19
|
+
* A wire body.
|
|
20
|
+
* @type {number}
|
|
21
|
+
* @constant
|
|
22
|
+
*/
|
|
23
|
+
WIRE: 1,
|
|
24
|
+
/**
|
|
25
|
+
* A sheet body.
|
|
26
|
+
* @type {number}
|
|
27
|
+
* @constant
|
|
28
|
+
*/
|
|
29
|
+
SHEET: 2,
|
|
30
|
+
/**
|
|
31
|
+
* A solid body.
|
|
32
|
+
* @type {number}
|
|
33
|
+
* @constant
|
|
34
|
+
*/
|
|
35
|
+
SOLID: 3,
|
|
36
|
+
/**
|
|
37
|
+
* A mesh.
|
|
38
|
+
* @type {number}
|
|
39
|
+
* @constant
|
|
40
|
+
*/
|
|
41
|
+
MESH: 4,
|
|
42
|
+
/**
|
|
43
|
+
* Text.
|
|
44
|
+
* @type {number}
|
|
45
|
+
* @constant
|
|
46
|
+
*/
|
|
47
|
+
TEXT: 5,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
Object.freeze(IonSnapParentGeometryType);
|
|
51
|
+
|
|
52
|
+
export default IonSnapParentGeometryType;
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
import Cartesian3 from "./Cartesian3.js";
|
|
2
|
+
import Cartesian4 from "./Cartesian4.js";
|
|
3
|
+
import Cartographic from "./Cartographic.js";
|
|
4
|
+
import Check from "./Check.js";
|
|
5
|
+
import Frozen from "./Frozen.js";
|
|
6
|
+
import CesiumMath from "./Math.js";
|
|
7
|
+
import defined from "./defined.js";
|
|
8
|
+
import Ion from "./Ion.js";
|
|
9
|
+
import IonResource from "./IonResource.js";
|
|
10
|
+
import IonSnapMode from "./IonSnapMode.js";
|
|
11
|
+
import Matrix4 from "./Matrix4.js";
|
|
12
|
+
import Resource from "./Resource.js";
|
|
13
|
+
import RuntimeError from "./RuntimeError.js";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Convert a WGS84 degrees point object returned by the ion REST API to a
|
|
17
|
+
* Cartesian3, or undefined when absent.
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
function cartesianFromApiPoint(point) {
|
|
21
|
+
if (
|
|
22
|
+
!defined(point) ||
|
|
23
|
+
!defined(point.longitude) ||
|
|
24
|
+
!defined(point.latitude)
|
|
25
|
+
) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
return Cartesian3.fromDegrees(
|
|
29
|
+
point.longitude,
|
|
30
|
+
point.latitude,
|
|
31
|
+
point.height ?? 0.0,
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Convert a Cartesian3 (ECEF) to the WGS84 degrees object shape the ion REST
|
|
37
|
+
* API expects.
|
|
38
|
+
* @private
|
|
39
|
+
*/
|
|
40
|
+
function apiPointFromCartesian(cartesian) {
|
|
41
|
+
const carto = Cartographic.fromCartesian(cartesian);
|
|
42
|
+
return {
|
|
43
|
+
longitude: CesiumMath.toDegrees(carto.longitude),
|
|
44
|
+
latitude: CesiumMath.toDegrees(carto.latitude),
|
|
45
|
+
height: carto.height,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Convert a Matrix4 to the row-major array-of-rows shape the ion REST API
|
|
51
|
+
* expects for <code>worldToView</code>.
|
|
52
|
+
* @private
|
|
53
|
+
*/
|
|
54
|
+
function rowsFromMatrix4(matrix) {
|
|
55
|
+
const rows = [];
|
|
56
|
+
const row = new Cartesian4();
|
|
57
|
+
for (let i = 0; i < 4; i++) {
|
|
58
|
+
Matrix4.getRow(matrix, i, row);
|
|
59
|
+
rows.push([row.x, row.y, row.z, row.w]);
|
|
60
|
+
}
|
|
61
|
+
return rows;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Build the clip-space -> pixel-space (projective) viewport matrix:
|
|
66
|
+
* <pre>
|
|
67
|
+
* px = (ndcX * 0.5 + 0.5) * width
|
|
68
|
+
* py = (1 - (ndcY * 0.5 + 0.5)) * height (y-down, top-left origin)
|
|
69
|
+
* pz = ndcZ * 0.5 + 0.5 ([-1,1] -> [0,1] depth)
|
|
70
|
+
* </pre>
|
|
71
|
+
* @private
|
|
72
|
+
*/
|
|
73
|
+
function viewportMatrix(width, height, result) {
|
|
74
|
+
return Matrix4.fromRowMajorArray(
|
|
75
|
+
// prettier-ignore
|
|
76
|
+
[
|
|
77
|
+
width / 2, 0, 0, width / 2,
|
|
78
|
+
0, -height / 2, 0, height / 2,
|
|
79
|
+
0, 0, 0.5, 0.5,
|
|
80
|
+
0, 0, 0, 1,
|
|
81
|
+
],
|
|
82
|
+
result,
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const scratchViewport = new Matrix4();
|
|
87
|
+
const scratchWorldToView = new Matrix4();
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* The result of a successful {@link IonSnapService#snap}. Extends
|
|
91
|
+
* {@link SnapService.Result} with ion-specific fields.
|
|
92
|
+
*
|
|
93
|
+
* @typedef {object} IonSnapService.Result
|
|
94
|
+
* @property {Cartesian3} [snapPoint] The snapped point. This is the point to consume.
|
|
95
|
+
* @property {Cartesian3} [hitPoint] The point where the cursor hit the geometry: the nearest edge point when within the snap aperture, otherwise the surface point under the cursor.
|
|
96
|
+
* @property {IonSnapHeat} [heat] How close the snap point is to the close point in view space.
|
|
97
|
+
* @property {IonSnapGeometryType} [geometryType] The type of geometry snapped to.
|
|
98
|
+
* @property {IonSnapParentGeometryType} [parentGeometryType] The type of the parent geometry snapped to.
|
|
99
|
+
* @property {object} [normal] The surface normal at the snap point, in the model's local cartesian frame.
|
|
100
|
+
* @property {object} [curve] The curve geometry near the snap point, with points as WGS84 degrees objects.
|
|
101
|
+
*/
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Provides interactive snap-to-geometry against a Cesium ion 3D Tiles asset
|
|
105
|
+
* backed by a BIM/CAD Database model, using the ion REST API's element snap
|
|
106
|
+
* endpoint.
|
|
107
|
+
*
|
|
108
|
+
* This class handles conversions between the reference frame of a
|
|
109
|
+
* source BIM/CAD Database and the view-dependent screen space pixel
|
|
110
|
+
* coordinates. Each snap, it transforms using the ion asset's source
|
|
111
|
+
* reference frame, the camera's transform, and the canvas
|
|
112
|
+
* dimensions so that view-dependent features— such as the pixel aperture,
|
|
113
|
+
* nearest position, or surface tracking— behave correctly.
|
|
114
|
+
*
|
|
115
|
+
* This object is normally not instantiated directly, use {@link IonSnapService.fromAssetId}.
|
|
116
|
+
*
|
|
117
|
+
* @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
|
|
118
|
+
*
|
|
119
|
+
* @see Ion
|
|
120
|
+
* @see SnapService
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* const snapper = await Cesium.IonSnapService.fromAssetId(123456);
|
|
124
|
+
* const canvas = viewer.scene.canvas;
|
|
125
|
+
* const result = await snapper.snap({
|
|
126
|
+
* elementId: "0x30000000df2",
|
|
127
|
+
* testPoint: pickedPosition,
|
|
128
|
+
* camera: viewer.camera,
|
|
129
|
+
* canvasWidth: canvas.clientWidth,
|
|
130
|
+
* canvasHeight: canvas.clientHeight,
|
|
131
|
+
* });
|
|
132
|
+
* if (Cesium.defined(result)) {
|
|
133
|
+
* console.log("snapped to", result.snapPoint);
|
|
134
|
+
* }
|
|
135
|
+
*/
|
|
136
|
+
class IonSnapService {
|
|
137
|
+
/**
|
|
138
|
+
* @param {object} options Object with the following properties:
|
|
139
|
+
* @param {number} options.assetId The ion asset id.
|
|
140
|
+
* @param {Resource} options.resource The asset's ion API resource.
|
|
141
|
+
* @param {Matrix4} options.ecefTransform A 4x4 transformation matrix from the source BIM/CAD Database reference frame local to the world's fixed reference frame.
|
|
142
|
+
*/
|
|
143
|
+
constructor(options) {
|
|
144
|
+
this._assetId = options.assetId;
|
|
145
|
+
this._resource = options.resource;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* A 4x4 transformation matrix from the source BIM/CAD Database reference frame local to the world's fixed reference frame.
|
|
149
|
+
* @type {Matrix4}
|
|
150
|
+
* @readonly
|
|
151
|
+
*/
|
|
152
|
+
this.ecefTransform = options.ecefTransform;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* The ion asset id this snapper operates on.
|
|
157
|
+
* @type {number}
|
|
158
|
+
* @readonly
|
|
159
|
+
*/
|
|
160
|
+
get assetId() {
|
|
161
|
+
return this._assetId;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Creates an {@link IonSnapService} for the given ion asset, fetching
|
|
166
|
+
* the asset's ECEF transform from the ion REST API.
|
|
167
|
+
*
|
|
168
|
+
* @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
|
|
169
|
+
*
|
|
170
|
+
* @param {number} assetId The ion ID of a 3D Tiles asset backed by a BIM/CAD Database model.
|
|
171
|
+
* @param {object} [options] Object with the following properties:
|
|
172
|
+
* @param {string} [options.accessToken=Ion.defaultAccessToken] The ion access token to use.
|
|
173
|
+
* @param {string|Resource} [options.server=Ion.defaultServer] The ion API server to use.
|
|
174
|
+
* @returns {Promise<IonSnapService>} A snapper bound to the asset.
|
|
175
|
+
*
|
|
176
|
+
* @exception {RuntimeError} The asset is not geolocated, so view-correct snapping is not possible.
|
|
177
|
+
*/
|
|
178
|
+
static async fromAssetId(assetId, options) {
|
|
179
|
+
//>>includeStart('debug', pragmas.debug);
|
|
180
|
+
Check.typeOf.number("assetId", assetId);
|
|
181
|
+
//>>includeEnd('debug');
|
|
182
|
+
|
|
183
|
+
options = options ?? Frozen.EMPTY_OBJECT;
|
|
184
|
+
const accessToken = options.accessToken ?? Ion.defaultAccessToken;
|
|
185
|
+
const server = Resource.createIfNeeded(options.server ?? Ion.defaultServer);
|
|
186
|
+
server.appendForwardSlash();
|
|
187
|
+
|
|
188
|
+
const resourceOptions = {
|
|
189
|
+
// Trailing slash so derived resource urls resolve under the asset id.
|
|
190
|
+
url: `assets/${assetId}/`,
|
|
191
|
+
headers: IonResource._addClientHeaders(),
|
|
192
|
+
};
|
|
193
|
+
if (defined(accessToken)) {
|
|
194
|
+
resourceOptions.queryParameters = { access_token: accessToken };
|
|
195
|
+
}
|
|
196
|
+
const resource = server.getDerivedResource(resourceOptions);
|
|
197
|
+
|
|
198
|
+
const ecefResponse = await resource
|
|
199
|
+
.getDerivedResource({ url: "ecef" })
|
|
200
|
+
.fetchJson();
|
|
201
|
+
|
|
202
|
+
if (!defined(ecefResponse?.ecefTransform)) {
|
|
203
|
+
throw new RuntimeError(
|
|
204
|
+
`Cesium ion asset ${assetId} is not geolocated; snapping requires geolocation`,
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const ecefTransform = Matrix4.fromRowMajorArray(
|
|
209
|
+
ecefResponse.ecefTransform.flat(),
|
|
210
|
+
);
|
|
211
|
+
|
|
212
|
+
return new IonSnapService({
|
|
213
|
+
assetId: assetId,
|
|
214
|
+
resource: resource,
|
|
215
|
+
ecefTransform: ecefTransform,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Computes the world-to-view matrix the native snapper needs: a projective
|
|
221
|
+
* transform from model-world coordinates to view (CSS pixel) coordinates,
|
|
222
|
+
* composed as <code>V * P * Vm * E</code> where
|
|
223
|
+
* <ul>
|
|
224
|
+
* <li><code>E</code>: model -> ECEF (this asset's {@link IonSnapService#ecefTransform})</li>
|
|
225
|
+
* <li><code>Vm</code>: ECEF -> eye (<code>camera.viewMatrix</code>)</li>
|
|
226
|
+
* <li><code>P</code>: eye -> clip (<code>camera.frustum.projectionMatrix</code>)</li>
|
|
227
|
+
* <li><code>V</code>: clip -> pixels (y-down viewport matrix)</li>
|
|
228
|
+
* </ul>
|
|
229
|
+
* The viewport term uses CSS pixel dimensions so pixel-valued snap apertures
|
|
230
|
+
* mean CSS pixels regardless of the display's device pixel ratio.
|
|
231
|
+
*
|
|
232
|
+
* @param {Camera} camera The camera defining the view.
|
|
233
|
+
* @param {number} canvasWidth The canvas width in CSS pixels.
|
|
234
|
+
* @param {number} canvasHeight The canvas height in CSS pixels.
|
|
235
|
+
* @param {Matrix4} [result] The object onto which to store the result.
|
|
236
|
+
* @returns {Matrix4} The model-world to view (pixels) matrix.
|
|
237
|
+
*
|
|
238
|
+
* @private
|
|
239
|
+
*/
|
|
240
|
+
_computeWorldToView(camera, canvasWidth, canvasHeight, result) {
|
|
241
|
+
//>>includeStart('debug', pragmas.debug);
|
|
242
|
+
Check.defined("camera", camera);
|
|
243
|
+
Check.typeOf.number("canvasWidth", canvasWidth);
|
|
244
|
+
Check.typeOf.number("canvasHeight", canvasHeight);
|
|
245
|
+
//>>includeEnd('debug');
|
|
246
|
+
|
|
247
|
+
result = result ?? new Matrix4();
|
|
248
|
+
|
|
249
|
+
const V = viewportMatrix(canvasWidth, canvasHeight, scratchViewport);
|
|
250
|
+
|
|
251
|
+
// result = V * P * Vm * E, built up right-to-left
|
|
252
|
+
Matrix4.multiply(camera.viewMatrix, this.ecefTransform, result);
|
|
253
|
+
Matrix4.multiply(camera.frustum.projectionMatrix, result, result);
|
|
254
|
+
return Matrix4.multiply(V, result, result);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Requests a snap against an element of this asset.
|
|
259
|
+
*
|
|
260
|
+
* A view-correct world-to-view matrix is composed from
|
|
261
|
+
* <code>options.camera</code>, <code>options.canvasWidth</code>, and
|
|
262
|
+
* <code>options.canvasHeight</code> so view-dependent snapping (nearest
|
|
263
|
+
* ordering, pixel apertures, surface tracking) matches the current view.
|
|
264
|
+
*
|
|
265
|
+
* Only 3D views are supported: the camera must be viewing in
|
|
266
|
+
* {@link SceneMode.SCENE3D}.
|
|
267
|
+
*
|
|
268
|
+
* @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
|
|
269
|
+
*
|
|
270
|
+
* @param {object} options Object with the following properties:
|
|
271
|
+
* @param {string} options.elementId The element id to snap to, as a hex string, e.g. <code>"0x30000000df2"</code>.
|
|
272
|
+
* @param {Cartesian3} options.testPoint The point to snap from, typically the picked cursor position.
|
|
273
|
+
* @param {Camera} options.camera The camera defining the current view. Must be viewing in {@link SceneMode.SCENE3D}.
|
|
274
|
+
* @param {number} options.canvasWidth The canvas width in CSS pixels.
|
|
275
|
+
* @param {number} options.canvasHeight The canvas height in CSS pixels.
|
|
276
|
+
* @param {Cartesian3} [options.closePoint=options.testPoint] A reference point near the target geometry that seeds the snap search.
|
|
277
|
+
* @param {number} [options.snapAperture=IonSnapService.DEFAULT_SNAP_APERTURE] The snap tolerance in CSS pixels of the world-to-view output space.
|
|
278
|
+
* @param {IonSnapMode} [options.snapMode=IonSnapMode.NEAREST] The type of snap to perform.
|
|
279
|
+
* @returns {Promise<IonSnapService.Result|undefined>} The snap result, or <code>undefined</code> if the element was not found or no snap was possible for it.
|
|
280
|
+
*/
|
|
281
|
+
async snap(options) {
|
|
282
|
+
//>>includeStart('debug', pragmas.debug);
|
|
283
|
+
Check.defined("options", options);
|
|
284
|
+
Check.typeOf.string("options.elementId", options.elementId);
|
|
285
|
+
Check.defined("options.testPoint", options.testPoint);
|
|
286
|
+
Check.defined("options.camera", options.camera);
|
|
287
|
+
Check.typeOf.number("options.canvasWidth", options.canvasWidth);
|
|
288
|
+
Check.typeOf.number("options.canvasHeight", options.canvasHeight);
|
|
289
|
+
//>>includeEnd('debug');
|
|
290
|
+
|
|
291
|
+
const worldToView = this._computeWorldToView(
|
|
292
|
+
options.camera,
|
|
293
|
+
options.canvasWidth,
|
|
294
|
+
options.canvasHeight,
|
|
295
|
+
scratchWorldToView,
|
|
296
|
+
);
|
|
297
|
+
|
|
298
|
+
const body = {
|
|
299
|
+
testPoint: apiPointFromCartesian(options.testPoint),
|
|
300
|
+
closePoint: apiPointFromCartesian(
|
|
301
|
+
options.closePoint ?? options.testPoint,
|
|
302
|
+
),
|
|
303
|
+
snapAperture:
|
|
304
|
+
options.snapAperture ?? IonSnapService.DEFAULT_SNAP_APERTURE,
|
|
305
|
+
snapMode: options.snapMode ?? IonSnapMode.NEAREST,
|
|
306
|
+
worldToView: rowsFromMatrix4(worldToView),
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
let response;
|
|
310
|
+
try {
|
|
311
|
+
response = await this._resource
|
|
312
|
+
.getDerivedResource({
|
|
313
|
+
url: `elements/${options.elementId}/snap`,
|
|
314
|
+
})
|
|
315
|
+
.post(JSON.stringify(body), {
|
|
316
|
+
headers: {
|
|
317
|
+
"Content-Type": "application/json",
|
|
318
|
+
},
|
|
319
|
+
responseType: "json",
|
|
320
|
+
});
|
|
321
|
+
} catch (error) {
|
|
322
|
+
// The snap endpoint responds 404 when the element does not exist, and
|
|
323
|
+
// 400 with a "No snap possible" message when the element has no
|
|
324
|
+
// snappable geometry or the test point is too far from it. Treat both
|
|
325
|
+
// as "no snap".
|
|
326
|
+
if (error?.statusCode === 404) {
|
|
327
|
+
return undefined;
|
|
328
|
+
}
|
|
329
|
+
if (
|
|
330
|
+
error?.statusCode === 400 &&
|
|
331
|
+
typeof error.response?.message === "string" &&
|
|
332
|
+
error.response.message.includes("No snap possible")
|
|
333
|
+
) {
|
|
334
|
+
return undefined;
|
|
335
|
+
}
|
|
336
|
+
throw error;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
if (!defined(response)) {
|
|
340
|
+
return undefined;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
const result = {
|
|
344
|
+
heat: response.heat,
|
|
345
|
+
geometryType: response.geomType,
|
|
346
|
+
parentGeometryType: response.parentGeomType,
|
|
347
|
+
normal: response.normal,
|
|
348
|
+
curve: response.curve,
|
|
349
|
+
};
|
|
350
|
+
result.snapPoint = cartesianFromApiPoint(response.snapPoint);
|
|
351
|
+
result.hitPoint = cartesianFromApiPoint(response.hitPoint);
|
|
352
|
+
return result;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* The default snap tolerance used by {@link IonSnapService#snap} when
|
|
358
|
+
* <code>options.snapAperture</code> is not provided, in CSS pixels of the
|
|
359
|
+
* world-to-view output space. This is {@link SnapService}'s
|
|
360
|
+
* <code>DEFAULT_SNAP_APERTURE</code> for this implementation.
|
|
361
|
+
*
|
|
362
|
+
* @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
|
|
363
|
+
*
|
|
364
|
+
* @type {number}
|
|
365
|
+
* @constant
|
|
366
|
+
*/
|
|
367
|
+
IonSnapService.DEFAULT_SNAP_APERTURE = 12;
|
|
368
|
+
|
|
369
|
+
export default IonSnapService;
|
|
@@ -1,16 +1,101 @@
|
|
|
1
1
|
import Check from "./Check.js";
|
|
2
2
|
import CompressedTextureBuffer from "./CompressedTextureBuffer.js";
|
|
3
3
|
import defined from "./defined.js";
|
|
4
|
+
import DeveloperError from "./DeveloperError.js";
|
|
5
|
+
import getAbsoluteUri from "./getAbsoluteUri.js";
|
|
4
6
|
import RuntimeError from "./RuntimeError.js";
|
|
5
7
|
import TaskProcessor from "./TaskProcessor.js";
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
|
-
*
|
|
10
|
+
* Lets applications use their own Basis Universal build to decode KTX2 textures.
|
|
11
|
+
* Cesium uses its bundled build by default.
|
|
9
12
|
*
|
|
10
|
-
* @
|
|
13
|
+
* @alias KTX2Transcoder
|
|
14
|
+
* @namespace
|
|
15
|
+
* @experimental This feature is not final and is subject to change without
|
|
16
|
+
* Cesium's standard deprecation policy.
|
|
11
17
|
*/
|
|
12
18
|
function KTX2Transcoder() {}
|
|
13
19
|
|
|
20
|
+
/**
|
|
21
|
+
* The two files that make up an application-supplied Basis Universal build.
|
|
22
|
+
* Both the JavaScript wrapper and Wasm binary must come from the same build.
|
|
23
|
+
*
|
|
24
|
+
* The wrapper must be an ES module whose default export is a factory function.
|
|
25
|
+
* Cesium calls that function in its KTX2 worker with an Emscripten configuration
|
|
26
|
+
* that contains the binary bytes in <code>wasmBinary</code>.
|
|
27
|
+
* The function returns a Basis module, or a promise for that module.
|
|
28
|
+
*
|
|
29
|
+
* The module must provide <code>initializeBasis</code>, <code>KTX2File</code>,
|
|
30
|
+
* and <code>transcoder_texture_format</code>. These APIs must be compatible
|
|
31
|
+
* with Cesium's bundled Basis version.
|
|
32
|
+
*
|
|
33
|
+
* @typedef {object} KTX2Transcoder.BasisTranscoderOptions
|
|
34
|
+
* @property {string} modulePath The URL of the JavaScript wrapper.
|
|
35
|
+
* @property {string} wasmBinaryFile The URL of the matching Wasm binary.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
Object.defineProperties(KTX2Transcoder, {
|
|
39
|
+
/**
|
|
40
|
+
* Uses your own Basis Universal build to decode KTX2 textures.
|
|
41
|
+
* Leave this undefined to use Cesium's bundled build.
|
|
42
|
+
*
|
|
43
|
+
* Before the first KTX2 load, set both the JavaScript wrapper URL and the
|
|
44
|
+
* matching Wasm binary URL. Relative URLs resolve against the document URL.
|
|
45
|
+
* Cesium copies the options and rejects changes after loading starts.
|
|
46
|
+
*
|
|
47
|
+
* Cesium's existing KTX2 worker loads both files and compiles the Wasm binary.
|
|
48
|
+
* See {@link KTX2Transcoder.BasisTranscoderOptions} for the wrapper requirements.
|
|
49
|
+
*
|
|
50
|
+
* For a Content Security Policy without <code>'unsafe-eval'</code>, use a
|
|
51
|
+
* compatible Basis build that does not generate JavaScript at runtime.
|
|
52
|
+
* The worker's policy must allow the wrapper import, binary fetch, and Wasm compilation.
|
|
53
|
+
*
|
|
54
|
+
* @memberof KTX2Transcoder
|
|
55
|
+
* @type {KTX2Transcoder.BasisTranscoderOptions|undefined}
|
|
56
|
+
* @default undefined
|
|
57
|
+
* @experimental This feature is not final and is subject to change without
|
|
58
|
+
* Cesium's standard deprecation policy.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* Cesium.KTX2Transcoder.basisTranscoderOptions = {
|
|
62
|
+
* modulePath: "/decoders/basis_transcoder.js",
|
|
63
|
+
* wasmBinaryFile: "/decoders/basis_transcoder.wasm",
|
|
64
|
+
* };
|
|
65
|
+
*/
|
|
66
|
+
basisTranscoderOptions: {
|
|
67
|
+
get: function () {
|
|
68
|
+
return KTX2Transcoder._basisTranscoderOptions;
|
|
69
|
+
},
|
|
70
|
+
set: function (value) {
|
|
71
|
+
if (defined(KTX2Transcoder._readyPromise)) {
|
|
72
|
+
throw new DeveloperError(
|
|
73
|
+
"KTX2Transcoder.basisTranscoderOptions must be configured before the first KTX2 load.",
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
if (!defined(value)) {
|
|
77
|
+
KTX2Transcoder._basisTranscoderOptions = undefined;
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (
|
|
81
|
+
typeof value !== "object" ||
|
|
82
|
+
typeof value.modulePath !== "string" ||
|
|
83
|
+
value.modulePath.length === 0 ||
|
|
84
|
+
typeof value.wasmBinaryFile !== "string" ||
|
|
85
|
+
value.wasmBinaryFile.length === 0
|
|
86
|
+
) {
|
|
87
|
+
throw new DeveloperError(
|
|
88
|
+
"KTX2Transcoder.basisTranscoderOptions requires non-empty modulePath and wasmBinaryFile strings.",
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
KTX2Transcoder._basisTranscoderOptions = Object.freeze({
|
|
92
|
+
modulePath: value.modulePath,
|
|
93
|
+
wasmBinaryFile: value.wasmBinaryFile,
|
|
94
|
+
});
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
|
|
14
99
|
KTX2Transcoder._transcodeTaskProcessor = new TaskProcessor(
|
|
15
100
|
"transcodeKTX2",
|
|
16
101
|
Number.POSITIVE_INFINITY, // KTX2 transcoding is used in place of Resource.fetchImage, so it can't reject as "just soooo busy right now"
|
|
@@ -19,10 +104,15 @@ KTX2Transcoder._transcodeTaskProcessor = new TaskProcessor(
|
|
|
19
104
|
KTX2Transcoder._readyPromise = undefined;
|
|
20
105
|
|
|
21
106
|
function makeReadyPromise() {
|
|
107
|
+
const options = KTX2Transcoder._basisTranscoderOptions;
|
|
108
|
+
const wasmOptions = defined(options)
|
|
109
|
+
? {
|
|
110
|
+
modulePath: getAbsoluteUri(options.modulePath),
|
|
111
|
+
wasmBinaryFile: getAbsoluteUri(options.wasmBinaryFile),
|
|
112
|
+
}
|
|
113
|
+
: { wasmBinaryFile: "ThirdParty/basis_transcoder.wasm" };
|
|
22
114
|
const readyPromise = KTX2Transcoder._transcodeTaskProcessor
|
|
23
|
-
.initWebAssemblyModule(
|
|
24
|
-
wasmBinaryFile: "ThirdParty/basis_transcoder.wasm",
|
|
25
|
-
})
|
|
115
|
+
.initWebAssemblyModule(wasmOptions)
|
|
26
116
|
.then(function (result) {
|
|
27
117
|
if (result) {
|
|
28
118
|
return KTX2Transcoder._transcodeTaskProcessor;
|
|
@@ -33,6 +123,10 @@ function makeReadyPromise() {
|
|
|
33
123
|
KTX2Transcoder._readyPromise = readyPromise;
|
|
34
124
|
}
|
|
35
125
|
|
|
126
|
+
/**
|
|
127
|
+
* Transcodes a KTX2 buffer in the worker.
|
|
128
|
+
* @private
|
|
129
|
+
*/
|
|
36
130
|
KTX2Transcoder.transcode = function (ktx2Buffer, supportedTargetFormats) {
|
|
37
131
|
//>>includeStart('debug', pragmas.debug);
|
|
38
132
|
Check.defined("supportedTargetFormats", supportedTargetFormats);
|
package/Source/Core/Resource.js
CHANGED
|
@@ -2063,6 +2063,7 @@ function loadWithHttpRequest(
|
|
|
2063
2063
|
fetch(url, {
|
|
2064
2064
|
method,
|
|
2065
2065
|
headers,
|
|
2066
|
+
credentials: TrustedServers.contains(url) ? "include" : "same-origin",
|
|
2066
2067
|
})
|
|
2067
2068
|
.then(async (response) => {
|
|
2068
2069
|
if (!response.ok) {
|
|
@@ -2251,6 +2252,7 @@ Resource._DefaultImplementations.createImage =
|
|
|
2251
2252
|
Resource._Implementations.createImage;
|
|
2252
2253
|
Resource._DefaultImplementations.loadWithXhr =
|
|
2253
2254
|
Resource._Implementations.loadWithXhr;
|
|
2255
|
+
Resource._DefaultImplementations.loadWithHttpRequest = loadWithHttpRequest;
|
|
2254
2256
|
Resource._DefaultImplementations.loadAndExecuteScript =
|
|
2255
2257
|
Resource._Implementations.loadAndExecuteScript;
|
|
2256
2258
|
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import DeveloperError from "./DeveloperError.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The result of a successful {@link SnapService#snap}.
|
|
5
|
+
*
|
|
6
|
+
* Implementations may return additional properties beyond those listed here.
|
|
7
|
+
*
|
|
8
|
+
* @typedef {object} SnapService.Result
|
|
9
|
+
* @property {Cartesian3} [snapPoint] The snapped point. This is the point to consume.
|
|
10
|
+
* @property {Cartesian3} [hitPoint] The point where the cursor hit the geometry: the nearest edge point when within the snap aperture, otherwise the surface point under the cursor.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Provides snap-to-geometry through an external service, which snaps against
|
|
15
|
+
* source geometry hosted remotely rather than geometry loaded in the scene.
|
|
16
|
+
* This type describes an interface and is not intended to be used.
|
|
17
|
+
*
|
|
18
|
+
* @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
|
|
19
|
+
*
|
|
20
|
+
* @see IonSnapService
|
|
21
|
+
*/
|
|
22
|
+
class SnapService {
|
|
23
|
+
constructor() {
|
|
24
|
+
DeveloperError.throwInstantiationError();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Requests a snap against geometry known to the service.
|
|
29
|
+
*
|
|
30
|
+
* The camera and canvas dimensions describe the current view so the
|
|
31
|
+
* implementation can perform view-dependent snapping (nearest ordering,
|
|
32
|
+
* pixel apertures, surface tracking) correctly.
|
|
33
|
+
*
|
|
34
|
+
* Implementations may accept additional options beyond those listed here.
|
|
35
|
+
*
|
|
36
|
+
* @param {object} options Object with the following properties:
|
|
37
|
+
* @param {string} options.elementId An implementation-defined identifier of the geometry to snap to.
|
|
38
|
+
* @param {Cartesian3} options.testPoint The point to snap from, typically the picked cursor position.
|
|
39
|
+
* @param {Camera} options.camera The camera defining the current view.
|
|
40
|
+
* @param {number} options.canvasWidth The canvas width in CSS pixels.
|
|
41
|
+
* @param {number} options.canvasHeight The canvas height in CSS pixels.
|
|
42
|
+
* @param {Cartesian3} [options.closePoint=options.testPoint] A reference point near the target geometry that seeds the snap search.
|
|
43
|
+
* @param {number} [options.snapAperture=SnapService.DEFAULT_SNAP_APERTURE] The snap tolerance in CSS pixels.
|
|
44
|
+
* @returns {Promise<SnapService.Result|undefined>} The snap result, or <code>undefined</code> if no snap was possible.
|
|
45
|
+
*/
|
|
46
|
+
async snap(options) {
|
|
47
|
+
DeveloperError.throwInstantiationError();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The default snap tolerance used by {@link SnapService#snap} when
|
|
53
|
+
* <code>options.snapAperture</code> is not provided, in CSS pixels.
|
|
54
|
+
* The value is implementation-defined.
|
|
55
|
+
*
|
|
56
|
+
* @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
|
|
57
|
+
*
|
|
58
|
+
* @type {number}
|
|
59
|
+
* @constant
|
|
60
|
+
*/
|
|
61
|
+
SnapService.DEFAULT_SNAP_APERTURE = undefined;
|
|
62
|
+
|
|
63
|
+
export default SnapService;
|