gm-builds 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -0
- package/dist/gm.min.css +1 -0
- package/dist/gm.min.js +16269 -0
- package/dist/gm.module.js +32 -0
- package/dist/index.js +16267 -0
- package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_0.json +1 -0
- package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_1.json +1 -0
- package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_10.json +1 -0
- package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_11.json +1 -0
- package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_12.json +1 -0
- package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_13.json +1 -0
- package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_14.json +1 -0
- package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_15.json +1 -0
- package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_16.json +1 -0
- package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_17.json +1 -0
- package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_18.json +1 -0
- package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_19.json +1 -0
- package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_2.json +1 -0
- package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_20.json +1 -0
- package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_21.json +1 -0
- package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_22.json +1 -0
- package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_23.json +1 -0
- package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_24.json +1 -0
- package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_25.json +1 -0
- package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_26.json +1 -0
- package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_27.json +1 -0
- package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_3.json +1 -0
- package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_4.json +1 -0
- package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_5.json +1 -0
- package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_6.json +1 -0
- package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_7.json +1 -0
- package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_8.json +1 -0
- package/dist/resources/Assets/IAU2006_XYS/IAU2006_XYS_9.json +1 -0
- package/dist/resources/Assets/Images/bing_maps_credit.png +0 -0
- package/dist/resources/Assets/Images/cesium_credit.png +0 -0
- package/dist/resources/Assets/Images/google_earth_credit.png +0 -0
- package/dist/resources/Assets/Images/ion-credit.png +0 -0
- package/dist/resources/Assets/Textures/LensFlare/DirtMask.jpg +0 -0
- package/dist/resources/Assets/Textures/LensFlare/StarBurst.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/0/0/0.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/0/1/0.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/1/0/0.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/1/0/1.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/1/1/0.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/1/1/1.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/1/2/0.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/1/2/1.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/1/3/0.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/1/3/1.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/0/0.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/0/1.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/0/2.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/0/3.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/1/0.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/1/1.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/1/2.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/1/3.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/2/0.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/2/1.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/2/2.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/2/3.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/3/0.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/3/1.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/3/2.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/3/3.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/4/0.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/4/1.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/4/2.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/4/3.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/5/0.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/5/1.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/5/2.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/5/3.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/6/0.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/6/1.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/6/2.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/6/3.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/7/0.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/7/1.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/7/2.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/2/7/3.jpg +0 -0
- package/dist/resources/Assets/Textures/NaturalEarthII/tilemapresource.xml +14 -0
- package/dist/resources/Assets/Textures/SkyBox/tycho2t3_80_mx.jpg +0 -0
- package/dist/resources/Assets/Textures/SkyBox/tycho2t3_80_my.jpg +0 -0
- package/dist/resources/Assets/Textures/SkyBox/tycho2t3_80_mz.jpg +0 -0
- package/dist/resources/Assets/Textures/SkyBox/tycho2t3_80_px.jpg +0 -0
- package/dist/resources/Assets/Textures/SkyBox/tycho2t3_80_py.jpg +0 -0
- package/dist/resources/Assets/Textures/SkyBox/tycho2t3_80_pz.jpg +0 -0
- package/dist/resources/Assets/Textures/maki/airfield.png +0 -0
- package/dist/resources/Assets/Textures/maki/airport.png +0 -0
- package/dist/resources/Assets/Textures/maki/alcohol-shop.png +0 -0
- package/dist/resources/Assets/Textures/maki/america-football.png +0 -0
- package/dist/resources/Assets/Textures/maki/art-gallery.png +0 -0
- package/dist/resources/Assets/Textures/maki/bakery.png +0 -0
- package/dist/resources/Assets/Textures/maki/bank.png +0 -0
- package/dist/resources/Assets/Textures/maki/bar.png +0 -0
- package/dist/resources/Assets/Textures/maki/baseball.png +0 -0
- package/dist/resources/Assets/Textures/maki/basketball.png +0 -0
- package/dist/resources/Assets/Textures/maki/beer.png +0 -0
- package/dist/resources/Assets/Textures/maki/bicycle.png +0 -0
- package/dist/resources/Assets/Textures/maki/building.png +0 -0
- package/dist/resources/Assets/Textures/maki/bus.png +0 -0
- package/dist/resources/Assets/Textures/maki/cafe.png +0 -0
- package/dist/resources/Assets/Textures/maki/camera.png +0 -0
- package/dist/resources/Assets/Textures/maki/campsite.png +0 -0
- package/dist/resources/Assets/Textures/maki/car.png +0 -0
- package/dist/resources/Assets/Textures/maki/cemetery.png +0 -0
- package/dist/resources/Assets/Textures/maki/cesium.png +0 -0
- package/dist/resources/Assets/Textures/maki/chemist.png +0 -0
- package/dist/resources/Assets/Textures/maki/cinema.png +0 -0
- package/dist/resources/Assets/Textures/maki/circle-stroked.png +0 -0
- package/dist/resources/Assets/Textures/maki/circle.png +0 -0
- package/dist/resources/Assets/Textures/maki/city.png +0 -0
- package/dist/resources/Assets/Textures/maki/clothing-store.png +0 -0
- package/dist/resources/Assets/Textures/maki/college.png +0 -0
- package/dist/resources/Assets/Textures/maki/commercial.png +0 -0
- package/dist/resources/Assets/Textures/maki/cricket.png +0 -0
- package/dist/resources/Assets/Textures/maki/cross.png +0 -0
- package/dist/resources/Assets/Textures/maki/dam.png +0 -0
- package/dist/resources/Assets/Textures/maki/danger.png +0 -0
- package/dist/resources/Assets/Textures/maki/disability.png +0 -0
- package/dist/resources/Assets/Textures/maki/dog-park.png +0 -0
- package/dist/resources/Assets/Textures/maki/embassy.png +0 -0
- package/dist/resources/Assets/Textures/maki/emergency-telephone.png +0 -0
- package/dist/resources/Assets/Textures/maki/entrance.png +0 -0
- package/dist/resources/Assets/Textures/maki/farm.png +0 -0
- package/dist/resources/Assets/Textures/maki/fast-food.png +0 -0
- package/dist/resources/Assets/Textures/maki/ferry.png +0 -0
- package/dist/resources/Assets/Textures/maki/fire-station.png +0 -0
- package/dist/resources/Assets/Textures/maki/fuel.png +0 -0
- package/dist/resources/Assets/Textures/maki/garden.png +0 -0
- package/dist/resources/Assets/Textures/maki/gift.png +0 -0
- package/dist/resources/Assets/Textures/maki/golf.png +0 -0
- package/dist/resources/Assets/Textures/maki/grocery.png +0 -0
- package/dist/resources/Assets/Textures/maki/hairdresser.png +0 -0
- package/dist/resources/Assets/Textures/maki/harbor.png +0 -0
- package/dist/resources/Assets/Textures/maki/heart.png +0 -0
- package/dist/resources/Assets/Textures/maki/heliport.png +0 -0
- package/dist/resources/Assets/Textures/maki/hospital.png +0 -0
- package/dist/resources/Assets/Textures/maki/ice-cream.png +0 -0
- package/dist/resources/Assets/Textures/maki/industrial.png +0 -0
- package/dist/resources/Assets/Textures/maki/land-use.png +0 -0
- package/dist/resources/Assets/Textures/maki/laundry.png +0 -0
- package/dist/resources/Assets/Textures/maki/library.png +0 -0
- package/dist/resources/Assets/Textures/maki/lighthouse.png +0 -0
- package/dist/resources/Assets/Textures/maki/lodging.png +0 -0
- package/dist/resources/Assets/Textures/maki/logging.png +0 -0
- package/dist/resources/Assets/Textures/maki/london-underground.png +0 -0
- package/dist/resources/Assets/Textures/maki/marker-stroked.png +0 -0
- package/dist/resources/Assets/Textures/maki/marker.png +0 -0
- package/dist/resources/Assets/Textures/maki/minefield.png +0 -0
- package/dist/resources/Assets/Textures/maki/mobilephone.png +0 -0
- package/dist/resources/Assets/Textures/maki/monument.png +0 -0
- package/dist/resources/Assets/Textures/maki/museum.png +0 -0
- package/dist/resources/Assets/Textures/maki/music.png +0 -0
- package/dist/resources/Assets/Textures/maki/oil-well.png +0 -0
- package/dist/resources/Assets/Textures/maki/park.png +0 -0
- package/dist/resources/Assets/Textures/maki/park2.png +0 -0
- package/dist/resources/Assets/Textures/maki/parking-garage.png +0 -0
- package/dist/resources/Assets/Textures/maki/parking.png +0 -0
- package/dist/resources/Assets/Textures/maki/pharmacy.png +0 -0
- package/dist/resources/Assets/Textures/maki/pitch.png +0 -0
- package/dist/resources/Assets/Textures/maki/place-of-worship.png +0 -0
- package/dist/resources/Assets/Textures/maki/playground.png +0 -0
- package/dist/resources/Assets/Textures/maki/police.png +0 -0
- package/dist/resources/Assets/Textures/maki/polling-place.png +0 -0
- package/dist/resources/Assets/Textures/maki/post.png +0 -0
- package/dist/resources/Assets/Textures/maki/prison.png +0 -0
- package/dist/resources/Assets/Textures/maki/rail-above.png +0 -0
- package/dist/resources/Assets/Textures/maki/rail-light.png +0 -0
- package/dist/resources/Assets/Textures/maki/rail-metro.png +0 -0
- package/dist/resources/Assets/Textures/maki/rail-underground.png +0 -0
- package/dist/resources/Assets/Textures/maki/rail.png +0 -0
- package/dist/resources/Assets/Textures/maki/religious-christian.png +0 -0
- package/dist/resources/Assets/Textures/maki/religious-jewish.png +0 -0
- package/dist/resources/Assets/Textures/maki/religious-muslim.png +0 -0
- package/dist/resources/Assets/Textures/maki/restaurant.png +0 -0
- package/dist/resources/Assets/Textures/maki/roadblock.png +0 -0
- package/dist/resources/Assets/Textures/maki/rocket.png +0 -0
- package/dist/resources/Assets/Textures/maki/school.png +0 -0
- package/dist/resources/Assets/Textures/maki/scooter.png +0 -0
- package/dist/resources/Assets/Textures/maki/shop.png +0 -0
- package/dist/resources/Assets/Textures/maki/skiing.png +0 -0
- package/dist/resources/Assets/Textures/maki/slaughterhouse.png +0 -0
- package/dist/resources/Assets/Textures/maki/soccer.png +0 -0
- package/dist/resources/Assets/Textures/maki/square-stroked.png +0 -0
- package/dist/resources/Assets/Textures/maki/square.png +0 -0
- package/dist/resources/Assets/Textures/maki/star-stroked.png +0 -0
- package/dist/resources/Assets/Textures/maki/star.png +0 -0
- package/dist/resources/Assets/Textures/maki/suitcase.png +0 -0
- package/dist/resources/Assets/Textures/maki/swimming.png +0 -0
- package/dist/resources/Assets/Textures/maki/telephone.png +0 -0
- package/dist/resources/Assets/Textures/maki/tennis.png +0 -0
- package/dist/resources/Assets/Textures/maki/theatre.png +0 -0
- package/dist/resources/Assets/Textures/maki/toilets.png +0 -0
- package/dist/resources/Assets/Textures/maki/town-hall.png +0 -0
- package/dist/resources/Assets/Textures/maki/town.png +0 -0
- package/dist/resources/Assets/Textures/maki/triangle-stroked.png +0 -0
- package/dist/resources/Assets/Textures/maki/triangle.png +0 -0
- package/dist/resources/Assets/Textures/maki/village.png +0 -0
- package/dist/resources/Assets/Textures/maki/warehouse.png +0 -0
- package/dist/resources/Assets/Textures/maki/waste-basket.png +0 -0
- package/dist/resources/Assets/Textures/maki/water.png +0 -0
- package/dist/resources/Assets/Textures/maki/wetland.png +0 -0
- package/dist/resources/Assets/Textures/maki/zoo.png +0 -0
- package/dist/resources/Assets/Textures/moonSmall.jpg +0 -0
- package/dist/resources/Assets/Textures/pin.svg +1 -0
- package/dist/resources/Assets/Textures/waterNormals.jpg +0 -0
- package/dist/resources/Assets/Textures/waterNormalsSmall.jpg +0 -0
- package/dist/resources/Assets/approximateTerrainHeights.json +1 -0
- package/dist/resources/ThirdParty/Workers/basis_transcoder.js +21 -0
- package/dist/resources/ThirdParty/Workers/package.json +1 -0
- package/dist/resources/ThirdParty/Workers/pako_deflate.min.js +2 -0
- package/dist/resources/ThirdParty/Workers/pako_inflate.min.js +2 -0
- package/dist/resources/ThirdParty/Workers/z-worker-pako.js +1 -0
- package/dist/resources/ThirdParty/basis_transcoder.wasm +0 -0
- package/dist/resources/ThirdParty/draco_decoder.wasm +0 -0
- package/dist/resources/ThirdParty/google-earth-dbroot-parser.js +8337 -0
- package/dist/resources/Workers/chunk-3JBEPBPL.js +390 -0
- package/dist/resources/Workers/chunk-3LYROPON.js +781 -0
- package/dist/resources/Workers/chunk-3PIZQT3I.js +305 -0
- package/dist/resources/Workers/chunk-3QLSKXKF.js +456 -0
- package/dist/resources/Workers/chunk-4CHMVQTQ.js +138 -0
- package/dist/resources/Workers/chunk-5KWRW7YL.js +58 -0
- package/dist/resources/Workers/chunk-5S5OOA6U.js +37 -0
- package/dist/resources/Workers/chunk-77XPS7ZA.js +758 -0
- package/dist/resources/Workers/chunk-7EO56M5R.js +1800 -0
- package/dist/resources/Workers/chunk-7UHKH6M3.js +634 -0
- package/dist/resources/Workers/chunk-7ZB2RVIQ.js +834 -0
- package/dist/resources/Workers/chunk-B4GSRXE3.js +157 -0
- package/dist/resources/Workers/chunk-CI2HEJFC.js +1481 -0
- package/dist/resources/Workers/chunk-D7ZBZPHV.js +139 -0
- package/dist/resources/Workers/chunk-DT5NFR5C.js +239 -0
- package/dist/resources/Workers/chunk-ED6GLQTK.js +629 -0
- package/dist/resources/Workers/chunk-EWDGNOJE.js +1258 -0
- package/dist/resources/Workers/chunk-F4CUH4MR.js +500 -0
- package/dist/resources/Workers/chunk-FFBJDW4A.js +196 -0
- package/dist/resources/Workers/chunk-FX4R4MTH.js +115 -0
- package/dist/resources/Workers/chunk-FYGLNDKG.js +963 -0
- package/dist/resources/Workers/chunk-G3BVMPWG.js +101 -0
- package/dist/resources/Workers/chunk-HEZHXDYB.js +55 -0
- package/dist/resources/Workers/chunk-HKHQ3EDR.js +102 -0
- package/dist/resources/Workers/chunk-HUFQVUMY.js +300 -0
- package/dist/resources/Workers/chunk-J7IH4EYI.js +220 -0
- package/dist/resources/Workers/chunk-JHBPC4LK.js +435 -0
- package/dist/resources/Workers/chunk-JPDKYBLF.js +511 -0
- package/dist/resources/Workers/chunk-K4AH3TDT.js +959 -0
- package/dist/resources/Workers/chunk-KHWLAQVA.js +75 -0
- package/dist/resources/Workers/chunk-KM6MITPF.js +2857 -0
- package/dist/resources/Workers/chunk-KSYBJA4M.js +262 -0
- package/dist/resources/Workers/chunk-LJBJM6VI.js +171 -0
- package/dist/resources/Workers/chunk-LNSWJ43X.js +421 -0
- package/dist/resources/Workers/chunk-LOZ4NKY3.js +684 -0
- package/dist/resources/Workers/chunk-LS3KVHYY.js +353 -0
- package/dist/resources/Workers/chunk-MVM4JV5U.js +691 -0
- package/dist/resources/Workers/chunk-N2XAJBC6.js +368 -0
- package/dist/resources/Workers/chunk-OMXHEJTK.js +163 -0
- package/dist/resources/Workers/chunk-PWF4EY5P.js +122 -0
- package/dist/resources/Workers/chunk-Q4ZVWJXX.js +59 -0
- package/dist/resources/Workers/chunk-SDIDRZDG.js +476 -0
- package/dist/resources/Workers/chunk-TVL3F7IU.js +39 -0
- package/dist/resources/Workers/chunk-TY4DKOWR.js +44 -0
- package/dist/resources/Workers/chunk-VCNOFQYH.js +287 -0
- package/dist/resources/Workers/chunk-WEHZP4SE.js +10357 -0
- package/dist/resources/Workers/chunk-WVNLSTOF.js +73 -0
- package/dist/resources/Workers/chunk-XK4OP6VA.js +1073 -0
- package/dist/resources/Workers/chunk-YJX7X577.js +2717 -0
- package/dist/resources/Workers/chunk-Z3QWTHI7.js +398 -0
- package/dist/resources/Workers/chunk-ZGFIT57T.js +1048 -0
- package/dist/resources/Workers/chunk-ZMNLEL6W.js +100 -0
- package/dist/resources/Workers/combineGeometry.js +64 -0
- package/dist/resources/Workers/createBoxGeometry.js +56 -0
- package/dist/resources/Workers/createBoxOutlineGeometry.js +233 -0
- package/dist/resources/Workers/createCircleGeometry.js +199 -0
- package/dist/resources/Workers/createCircleOutlineGeometry.js +145 -0
- package/dist/resources/Workers/createCoplanarPolygonGeometry.js +505 -0
- package/dist/resources/Workers/createCoplanarPolygonOutlineGeometry.js +223 -0
- package/dist/resources/Workers/createCorridorGeometry.js +1261 -0
- package/dist/resources/Workers/createCorridorOutlineGeometry.js +566 -0
- package/dist/resources/Workers/createCylinderGeometry.js +58 -0
- package/dist/resources/Workers/createCylinderOutlineGeometry.js +229 -0
- package/dist/resources/Workers/createEllipseGeometry.js +69 -0
- package/dist/resources/Workers/createEllipseOutlineGeometry.js +62 -0
- package/dist/resources/Workers/createEllipsoidGeometry.js +57 -0
- package/dist/resources/Workers/createEllipsoidOutlineGeometry.js +59 -0
- package/dist/resources/Workers/createFrustumGeometry.js +56 -0
- package/dist/resources/Workers/createFrustumOutlineGeometry.js +234 -0
- package/dist/resources/Workers/createGeometry.js +168 -0
- package/dist/resources/Workers/createGroundPolylineGeometry.js +1606 -0
- package/dist/resources/Workers/createPlaneGeometry.js +222 -0
- package/dist/resources/Workers/createPlaneOutlineGeometry.js +122 -0
- package/dist/resources/Workers/createPolygonGeometry.js +1405 -0
- package/dist/resources/Workers/createPolygonOutlineGeometry.js +533 -0
- package/dist/resources/Workers/createPolylineGeometry.js +494 -0
- package/dist/resources/Workers/createPolylineVolumeGeometry.js +377 -0
- package/dist/resources/Workers/createPolylineVolumeOutlineGeometry.js +275 -0
- package/dist/resources/Workers/createRectangleGeometry.js +1270 -0
- package/dist/resources/Workers/createRectangleOutlineGeometry.js +477 -0
- package/dist/resources/Workers/createSimplePolylineGeometry.js +398 -0
- package/dist/resources/Workers/createSphereGeometry.js +116 -0
- package/dist/resources/Workers/createSphereOutlineGeometry.js +116 -0
- package/dist/resources/Workers/createTaskProcessorWorker.js +32 -0
- package/dist/resources/Workers/createVectorTileClampedPolylines.js +490 -0
- package/dist/resources/Workers/createVectorTileGeometries.js +385 -0
- package/dist/resources/Workers/createVectorTilePoints.js +112 -0
- package/dist/resources/Workers/createVectorTilePolygons.js +383 -0
- package/dist/resources/Workers/createVectorTilePolylines.js +260 -0
- package/dist/resources/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +563 -0
- package/dist/resources/Workers/createVerticesFromHeightmap.js +2276 -0
- package/dist/resources/Workers/createVerticesFromQuantizedTerrainMesh.js +753 -0
- package/dist/resources/Workers/createWallGeometry.js +488 -0
- package/dist/resources/Workers/createWallOutlineGeometry.js +336 -0
- package/dist/resources/Workers/decodeDraco.js +370 -0
- package/dist/resources/Workers/decodeGoogleEarthEnterprisePacket.js +2666 -0
- package/dist/resources/Workers/decodeI3S.js +1343 -0
- package/dist/resources/Workers/transcodeKTX2.js +3387 -0
- package/dist/resources/Workers/transferTypedArrayTest.js +41 -0
- package/dist/resources/Workers/upsampleQuantizedTerrainMesh.js +817 -0
- package/package.json +22 -0
|
@@ -0,0 +1,1343 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Cesium - https://github.com/CesiumGS/cesium
|
|
4
|
+
* Version 1.126
|
|
5
|
+
*
|
|
6
|
+
* Copyright 2011-2022 Cesium Contributors
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*
|
|
20
|
+
* Columbus View (Pat. Pend.)
|
|
21
|
+
*
|
|
22
|
+
* Portions licensed separately.
|
|
23
|
+
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import {
|
|
27
|
+
require_draco_decoder_nodejs
|
|
28
|
+
} from "./chunk-7EO56M5R.js";
|
|
29
|
+
import {
|
|
30
|
+
Color_default
|
|
31
|
+
} from "./chunk-7UHKH6M3.js";
|
|
32
|
+
import {
|
|
33
|
+
createTaskProcessorWorker_default
|
|
34
|
+
} from "./chunk-G3BVMPWG.js";
|
|
35
|
+
import {
|
|
36
|
+
WebMercatorProjection_default
|
|
37
|
+
} from "./chunk-FX4R4MTH.js";
|
|
38
|
+
import {
|
|
39
|
+
Cartesian3_default,
|
|
40
|
+
Cartographic_default,
|
|
41
|
+
Ellipsoid_default,
|
|
42
|
+
Matrix3_default
|
|
43
|
+
} from "./chunk-KM6MITPF.js";
|
|
44
|
+
import {
|
|
45
|
+
Math_default
|
|
46
|
+
} from "./chunk-F4CUH4MR.js";
|
|
47
|
+
import {
|
|
48
|
+
defaultValue_default
|
|
49
|
+
} from "./chunk-TVL3F7IU.js";
|
|
50
|
+
import {
|
|
51
|
+
Check_default
|
|
52
|
+
} from "./chunk-OMXHEJTK.js";
|
|
53
|
+
import {
|
|
54
|
+
__toESM,
|
|
55
|
+
defined_default
|
|
56
|
+
} from "./chunk-KHWLAQVA.js";
|
|
57
|
+
|
|
58
|
+
// packages/engine/Source/Workers/decodeI3S.js
|
|
59
|
+
var import_draco_decoder_nodejs = __toESM(require_draco_decoder_nodejs(), 1);
|
|
60
|
+
|
|
61
|
+
// packages/engine/Source/Core/srgbToLinear.js
|
|
62
|
+
function srgbToLinear(value) {
|
|
63
|
+
Check_default.defined("value", value);
|
|
64
|
+
if (value <= 0.04045) {
|
|
65
|
+
return value * 0.07739938080495357;
|
|
66
|
+
}
|
|
67
|
+
return Math.pow(
|
|
68
|
+
// eslint-disable-next-line no-loss-of-precision
|
|
69
|
+
(value + 0.055) * 0.9478672985781991,
|
|
70
|
+
2.4
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
var srgbToLinear_default = srgbToLinear;
|
|
74
|
+
|
|
75
|
+
// packages/engine/Source/Workers/decodeI3S.js
|
|
76
|
+
var draco;
|
|
77
|
+
function bilinearInterpolate(tx, ty, h00, h10, h01, h11) {
|
|
78
|
+
const a = h00 * (1 - tx) + h10 * tx;
|
|
79
|
+
const b = h01 * (1 - tx) + h11 * tx;
|
|
80
|
+
return a * (1 - ty) + b * ty;
|
|
81
|
+
}
|
|
82
|
+
function sampleMap(u, v, width, data) {
|
|
83
|
+
const address = u + v * width;
|
|
84
|
+
return data[address];
|
|
85
|
+
}
|
|
86
|
+
function sampleGeoid(sampleX, sampleY, geoidData) {
|
|
87
|
+
const extent = geoidData.nativeExtent;
|
|
88
|
+
let x = (sampleX - extent.west) / (extent.east - extent.west) * (geoidData.width - 1);
|
|
89
|
+
let y = (sampleY - extent.south) / (extent.north - extent.south) * (geoidData.height - 1);
|
|
90
|
+
const xi = Math.floor(x);
|
|
91
|
+
let yi = Math.floor(y);
|
|
92
|
+
x -= xi;
|
|
93
|
+
y -= yi;
|
|
94
|
+
const xNext = xi < geoidData.width ? xi + 1 : xi;
|
|
95
|
+
let yNext = yi < geoidData.height ? yi + 1 : yi;
|
|
96
|
+
yi = geoidData.height - 1 - yi;
|
|
97
|
+
yNext = geoidData.height - 1 - yNext;
|
|
98
|
+
const h00 = sampleMap(xi, yi, geoidData.width, geoidData.buffer);
|
|
99
|
+
const h10 = sampleMap(xNext, yi, geoidData.width, geoidData.buffer);
|
|
100
|
+
const h01 = sampleMap(xi, yNext, geoidData.width, geoidData.buffer);
|
|
101
|
+
const h11 = sampleMap(xNext, yNext, geoidData.width, geoidData.buffer);
|
|
102
|
+
let finalHeight = bilinearInterpolate(x, y, h00, h10, h01, h11);
|
|
103
|
+
finalHeight = finalHeight * geoidData.scale + geoidData.offset;
|
|
104
|
+
return finalHeight;
|
|
105
|
+
}
|
|
106
|
+
function sampleGeoidFromList(lon, lat, geoidDataList) {
|
|
107
|
+
for (let i = 0; i < geoidDataList.length; i++) {
|
|
108
|
+
const localExtent = geoidDataList[i].nativeExtent;
|
|
109
|
+
let localPt = new Cartesian3_default();
|
|
110
|
+
if (geoidDataList[i].projectionType === "WebMercator") {
|
|
111
|
+
const radii = geoidDataList[i].projection._ellipsoid._radii;
|
|
112
|
+
const webMercatorProj = new WebMercatorProjection_default(
|
|
113
|
+
new Ellipsoid_default(radii.x, radii.y, radii.z)
|
|
114
|
+
);
|
|
115
|
+
localPt = webMercatorProj.project(new Cartographic_default(lon, lat, 0));
|
|
116
|
+
} else {
|
|
117
|
+
localPt.x = lon;
|
|
118
|
+
localPt.y = lat;
|
|
119
|
+
}
|
|
120
|
+
if (localPt.x > localExtent.west && localPt.x < localExtent.east && localPt.y > localExtent.south && localPt.y < localExtent.north) {
|
|
121
|
+
return sampleGeoid(localPt.x, localPt.y, geoidDataList[i]);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return 0;
|
|
125
|
+
}
|
|
126
|
+
function orthometricToEllipsoidal(vertexCount, position, scale_x, scale_y, center, geoidDataList, fast) {
|
|
127
|
+
if (fast) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const centerHeight = sampleGeoidFromList(
|
|
131
|
+
center.longitude,
|
|
132
|
+
center.latitude,
|
|
133
|
+
geoidDataList
|
|
134
|
+
);
|
|
135
|
+
for (let i = 0; i < vertexCount; ++i) {
|
|
136
|
+
const height = sampleGeoidFromList(
|
|
137
|
+
center.longitude + Math_default.toRadians(scale_x * position[i * 3]),
|
|
138
|
+
center.latitude + Math_default.toRadians(scale_y * position[i * 3 + 1]),
|
|
139
|
+
geoidDataList
|
|
140
|
+
);
|
|
141
|
+
position[i * 3 + 2] += height - centerHeight;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function transformToLocal(vertexCount, positions, normals, cartographicCenter, cartesianCenter, parentRotation, ellipsoidRadiiSquare, scale_x, scale_y) {
|
|
145
|
+
if (vertexCount === 0 || !defined_default(positions) || positions.length === 0) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const ellipsoid = new Ellipsoid_default(
|
|
149
|
+
Math.sqrt(ellipsoidRadiiSquare.x),
|
|
150
|
+
Math.sqrt(ellipsoidRadiiSquare.y),
|
|
151
|
+
Math.sqrt(ellipsoidRadiiSquare.z)
|
|
152
|
+
);
|
|
153
|
+
for (let i = 0; i < vertexCount; ++i) {
|
|
154
|
+
const indexOffset = i * 3;
|
|
155
|
+
const indexOffset1 = indexOffset + 1;
|
|
156
|
+
const indexOffset2 = indexOffset + 2;
|
|
157
|
+
const cartographic = new Cartographic_default();
|
|
158
|
+
cartographic.longitude = cartographicCenter.longitude + Math_default.toRadians(scale_x * positions[indexOffset]);
|
|
159
|
+
cartographic.latitude = cartographicCenter.latitude + Math_default.toRadians(scale_y * positions[indexOffset1]);
|
|
160
|
+
cartographic.height = cartographicCenter.height + positions[indexOffset2];
|
|
161
|
+
const position = {};
|
|
162
|
+
ellipsoid.cartographicToCartesian(cartographic, position);
|
|
163
|
+
position.x -= cartesianCenter.x;
|
|
164
|
+
position.y -= cartesianCenter.y;
|
|
165
|
+
position.z -= cartesianCenter.z;
|
|
166
|
+
const rotatedPosition = {};
|
|
167
|
+
Matrix3_default.multiplyByVector(parentRotation, position, rotatedPosition);
|
|
168
|
+
positions[indexOffset] = rotatedPosition.x;
|
|
169
|
+
positions[indexOffset1] = rotatedPosition.y;
|
|
170
|
+
positions[indexOffset2] = rotatedPosition.z;
|
|
171
|
+
if (defined_default(normals)) {
|
|
172
|
+
const normal = new Cartesian3_default(
|
|
173
|
+
normals[indexOffset],
|
|
174
|
+
normals[indexOffset1],
|
|
175
|
+
normals[indexOffset2]
|
|
176
|
+
);
|
|
177
|
+
const rotatedNormal = {};
|
|
178
|
+
Matrix3_default.multiplyByVector(parentRotation, normal, rotatedNormal);
|
|
179
|
+
normals[indexOffset] = rotatedNormal.x;
|
|
180
|
+
normals[indexOffset1] = rotatedNormal.y;
|
|
181
|
+
normals[indexOffset2] = rotatedNormal.z;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
function cropUVs(vertexCount, uv0s, uvRegions) {
|
|
186
|
+
for (let vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex) {
|
|
187
|
+
const minU = uvRegions[vertexIndex * 4] / 65535;
|
|
188
|
+
const minV = uvRegions[vertexIndex * 4 + 1] / 65535;
|
|
189
|
+
const scaleU = (uvRegions[vertexIndex * 4 + 2] - uvRegions[vertexIndex * 4]) / 65535;
|
|
190
|
+
const scaleV = (uvRegions[vertexIndex * 4 + 3] - uvRegions[vertexIndex * 4 + 1]) / 65535;
|
|
191
|
+
uv0s[vertexIndex * 2] *= scaleU;
|
|
192
|
+
uv0s[vertexIndex * 2] += minU;
|
|
193
|
+
uv0s[vertexIndex * 2 + 1] *= scaleV;
|
|
194
|
+
uv0s[vertexIndex * 2 + 1] += minV;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
function generateIndexArray(vertexCount, indices, colors, splitGeometryByColorTransparency) {
|
|
198
|
+
const indexArray = new Uint32Array(vertexCount);
|
|
199
|
+
const vertexIndexFn = defined_default(indices) ? (vertexIndex) => indices[vertexIndex] : (vertexIndex) => vertexIndex;
|
|
200
|
+
let transparentVertexOffset = 0;
|
|
201
|
+
if (splitGeometryByColorTransparency && defined_default(colors)) {
|
|
202
|
+
const isVertexTransparentFn = (vertexIndex) => colors[vertexIndexFn(vertexIndex) * 4 + 3] < 255;
|
|
203
|
+
for (let vertexIndex = 0; vertexIndex < vertexCount; vertexIndex += 3) {
|
|
204
|
+
if (!isVertexTransparentFn(vertexIndex) && !isVertexTransparentFn(vertexIndex + 1) && !isVertexTransparentFn(vertexIndex + 2)) {
|
|
205
|
+
indexArray[transparentVertexOffset++] = vertexIndexFn(vertexIndex);
|
|
206
|
+
indexArray[transparentVertexOffset++] = vertexIndexFn(vertexIndex + 1);
|
|
207
|
+
indexArray[transparentVertexOffset++] = vertexIndexFn(vertexIndex + 2);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
if (transparentVertexOffset > 0) {
|
|
211
|
+
let offset = transparentVertexOffset;
|
|
212
|
+
for (let vertexIndex = 0; vertexIndex < vertexCount; vertexIndex += 3) {
|
|
213
|
+
if (isVertexTransparentFn(vertexIndex) || isVertexTransparentFn(vertexIndex + 1) || isVertexTransparentFn(vertexIndex + 2)) {
|
|
214
|
+
indexArray[offset++] = vertexIndexFn(vertexIndex);
|
|
215
|
+
indexArray[offset++] = vertexIndexFn(vertexIndex + 1);
|
|
216
|
+
indexArray[offset++] = vertexIndexFn(vertexIndex + 2);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
} else {
|
|
220
|
+
for (let vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex) {
|
|
221
|
+
indexArray[vertexIndex] = vertexIndexFn(vertexIndex);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
} else {
|
|
225
|
+
transparentVertexOffset = vertexCount;
|
|
226
|
+
for (let vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex) {
|
|
227
|
+
indexArray[vertexIndex] = vertexIndexFn(vertexIndex);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return {
|
|
231
|
+
indexArray,
|
|
232
|
+
transparentVertexOffset
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
function getFeatureHash(symbologyData, outlinesHash, featureIndex) {
|
|
236
|
+
const featureHash = outlinesHash[featureIndex];
|
|
237
|
+
if (defined_default(featureHash)) {
|
|
238
|
+
return featureHash;
|
|
239
|
+
}
|
|
240
|
+
const newFeatureHash = outlinesHash[featureIndex] = {
|
|
241
|
+
positions: {},
|
|
242
|
+
indices: {},
|
|
243
|
+
edges: {}
|
|
244
|
+
};
|
|
245
|
+
const featureSymbology = defaultValue_default(
|
|
246
|
+
symbologyData[featureIndex],
|
|
247
|
+
symbologyData.default
|
|
248
|
+
);
|
|
249
|
+
newFeatureHash.hasOutline = defined_default(featureSymbology?.edges);
|
|
250
|
+
return newFeatureHash;
|
|
251
|
+
}
|
|
252
|
+
function addVertexToHash(indexHash, positionHash, vertexIndex, positions) {
|
|
253
|
+
if (!defined_default(indexHash[vertexIndex])) {
|
|
254
|
+
const startPositionIndex = vertexIndex * 3;
|
|
255
|
+
let coordinateHash = positionHash;
|
|
256
|
+
for (let index = 0; index < 3; index++) {
|
|
257
|
+
const coordinate = positions[startPositionIndex + index];
|
|
258
|
+
if (!defined_default(coordinateHash[coordinate])) {
|
|
259
|
+
coordinateHash[coordinate] = {};
|
|
260
|
+
}
|
|
261
|
+
coordinateHash = coordinateHash[coordinate];
|
|
262
|
+
}
|
|
263
|
+
if (!defined_default(coordinateHash.index)) {
|
|
264
|
+
coordinateHash.index = vertexIndex;
|
|
265
|
+
}
|
|
266
|
+
indexHash[vertexIndex] = coordinateHash.index;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
function addEdgeToHash(edgeHash, vertexAIndex, vertexBIndex, vertexAIndexUnique, vertexBIndexUnique, normalIndex) {
|
|
270
|
+
let startVertexIndex;
|
|
271
|
+
let endVertexIndex;
|
|
272
|
+
if (vertexAIndexUnique < vertexBIndexUnique) {
|
|
273
|
+
startVertexIndex = vertexAIndexUnique;
|
|
274
|
+
endVertexIndex = vertexBIndexUnique;
|
|
275
|
+
} else {
|
|
276
|
+
startVertexIndex = vertexBIndexUnique;
|
|
277
|
+
endVertexIndex = vertexAIndexUnique;
|
|
278
|
+
}
|
|
279
|
+
let edgeStart = edgeHash[startVertexIndex];
|
|
280
|
+
if (!defined_default(edgeStart)) {
|
|
281
|
+
edgeStart = edgeHash[startVertexIndex] = {};
|
|
282
|
+
}
|
|
283
|
+
let edgeEnd = edgeStart[endVertexIndex];
|
|
284
|
+
if (!defined_default(edgeEnd)) {
|
|
285
|
+
edgeEnd = edgeStart[endVertexIndex] = {
|
|
286
|
+
normalsIndex: [],
|
|
287
|
+
outlines: []
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
edgeEnd.normalsIndex.push(normalIndex);
|
|
291
|
+
if (edgeEnd.outlines.length === 0 || vertexAIndex !== vertexAIndexUnique || vertexBIndex !== vertexBIndexUnique) {
|
|
292
|
+
edgeEnd.outlines.push(vertexAIndex, vertexBIndex);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
function generateOutlinesHash(symbologyData, featureIndexArray, indexArray, positions) {
|
|
296
|
+
const outlinesHash = [];
|
|
297
|
+
for (let i = 0; i < indexArray.length; i += 3) {
|
|
298
|
+
const featureIndex = defined_default(featureIndexArray) ? featureIndexArray[indexArray[i]] : "default";
|
|
299
|
+
const featureHash = getFeatureHash(
|
|
300
|
+
symbologyData,
|
|
301
|
+
outlinesHash,
|
|
302
|
+
featureIndex
|
|
303
|
+
);
|
|
304
|
+
if (!featureHash.hasOutline) {
|
|
305
|
+
continue;
|
|
306
|
+
}
|
|
307
|
+
const indexHash = featureHash.indices;
|
|
308
|
+
const positionHash = featureHash.positions;
|
|
309
|
+
for (let vertex = 0; vertex < 3; vertex++) {
|
|
310
|
+
const vertexIndex = indexArray[i + vertex];
|
|
311
|
+
addVertexToHash(indexHash, positionHash, vertexIndex, positions);
|
|
312
|
+
}
|
|
313
|
+
const edgeHash = featureHash.edges;
|
|
314
|
+
for (let vertex = 0; vertex < 3; vertex++) {
|
|
315
|
+
const vertexIndex = indexArray[i + vertex];
|
|
316
|
+
const nextVertexIndex = indexArray[i + (vertex + 1) % 3];
|
|
317
|
+
const uniqueVertexIndex = indexHash[vertexIndex];
|
|
318
|
+
const uniqueNextVertexIndex = indexHash[nextVertexIndex];
|
|
319
|
+
addEdgeToHash(
|
|
320
|
+
edgeHash,
|
|
321
|
+
vertexIndex,
|
|
322
|
+
nextVertexIndex,
|
|
323
|
+
uniqueVertexIndex,
|
|
324
|
+
uniqueNextVertexIndex,
|
|
325
|
+
i
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
return outlinesHash;
|
|
330
|
+
}
|
|
331
|
+
var calculateFaceNormalA = new Cartesian3_default();
|
|
332
|
+
var calculateFaceNormalB = new Cartesian3_default();
|
|
333
|
+
var calculateFaceNormalC = new Cartesian3_default();
|
|
334
|
+
function calculateFaceNormal(normals, vertexAIndex, indexArray, positions) {
|
|
335
|
+
const positionAIndex = indexArray[vertexAIndex] * 3;
|
|
336
|
+
const positionBIndex = indexArray[vertexAIndex + 1] * 3;
|
|
337
|
+
const positionCIndex = indexArray[vertexAIndex + 2] * 3;
|
|
338
|
+
Cartesian3_default.fromArray(positions, positionAIndex, calculateFaceNormalA);
|
|
339
|
+
Cartesian3_default.fromArray(positions, positionBIndex, calculateFaceNormalB);
|
|
340
|
+
Cartesian3_default.fromArray(positions, positionCIndex, calculateFaceNormalC);
|
|
341
|
+
Cartesian3_default.subtract(
|
|
342
|
+
calculateFaceNormalB,
|
|
343
|
+
calculateFaceNormalA,
|
|
344
|
+
calculateFaceNormalB
|
|
345
|
+
);
|
|
346
|
+
Cartesian3_default.subtract(
|
|
347
|
+
calculateFaceNormalC,
|
|
348
|
+
calculateFaceNormalA,
|
|
349
|
+
calculateFaceNormalC
|
|
350
|
+
);
|
|
351
|
+
Cartesian3_default.cross(
|
|
352
|
+
calculateFaceNormalB,
|
|
353
|
+
calculateFaceNormalC,
|
|
354
|
+
calculateFaceNormalA
|
|
355
|
+
);
|
|
356
|
+
const magnitude = Cartesian3_default.magnitude(calculateFaceNormalA);
|
|
357
|
+
if (magnitude !== 0) {
|
|
358
|
+
Cartesian3_default.divideByScalar(
|
|
359
|
+
calculateFaceNormalA,
|
|
360
|
+
magnitude,
|
|
361
|
+
calculateFaceNormalA
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
const normalAIndex = vertexAIndex * 3;
|
|
365
|
+
const normalBIndex = (vertexAIndex + 1) * 3;
|
|
366
|
+
const normalCIndex = (vertexAIndex + 2) * 3;
|
|
367
|
+
Cartesian3_default.pack(calculateFaceNormalA, normals, normalAIndex);
|
|
368
|
+
Cartesian3_default.pack(calculateFaceNormalA, normals, normalBIndex);
|
|
369
|
+
Cartesian3_default.pack(calculateFaceNormalA, normals, normalCIndex);
|
|
370
|
+
}
|
|
371
|
+
var isEdgeSmoothA = new Cartesian3_default();
|
|
372
|
+
var isEdgeSmoothB = new Cartesian3_default();
|
|
373
|
+
function isEdgeSmooth(normals, normalAIndex, normalBIndex) {
|
|
374
|
+
Cartesian3_default.fromArray(normals, normalAIndex, isEdgeSmoothA);
|
|
375
|
+
Cartesian3_default.fromArray(normals, normalBIndex, isEdgeSmoothB);
|
|
376
|
+
const cosine = Cartesian3_default.dot(isEdgeSmoothA, isEdgeSmoothB);
|
|
377
|
+
const sine = Cartesian3_default.magnitude(
|
|
378
|
+
Cartesian3_default.cross(isEdgeSmoothA, isEdgeSmoothB, isEdgeSmoothA)
|
|
379
|
+
);
|
|
380
|
+
return Math.atan2(sine, cosine) < 0.25;
|
|
381
|
+
}
|
|
382
|
+
function addOutlinesForEdge(outlines, edgeData, indexArray, positions, normals) {
|
|
383
|
+
if (edgeData.normalsIndex.length > 1) {
|
|
384
|
+
const normalsByIndex = positions.length === normals.length;
|
|
385
|
+
for (let indexA = 0; indexA < edgeData.normalsIndex.length; indexA++) {
|
|
386
|
+
const vertexAIndex = edgeData.normalsIndex[indexA];
|
|
387
|
+
if (!defined_default(normals[vertexAIndex * 3])) {
|
|
388
|
+
calculateFaceNormal(normals, vertexAIndex, indexArray, positions);
|
|
389
|
+
}
|
|
390
|
+
if (indexA === 0) {
|
|
391
|
+
continue;
|
|
392
|
+
}
|
|
393
|
+
for (let indexB = 0; indexB < indexA; indexB++) {
|
|
394
|
+
const vertexBIndex = edgeData.normalsIndex[indexB];
|
|
395
|
+
const normalAIndex = normalsByIndex ? indexArray[vertexAIndex] * 3 : vertexAIndex * 3;
|
|
396
|
+
const normalBIndex = normalsByIndex ? indexArray[vertexBIndex] * 3 : vertexBIndex * 3;
|
|
397
|
+
if (isEdgeSmooth(normals, normalAIndex, normalBIndex)) {
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
outlines.push(...edgeData.outlines);
|
|
404
|
+
}
|
|
405
|
+
function addOutlinesForFeature(outlines, edgeHash, indexArray, positions, normals) {
|
|
406
|
+
const edgeStartKeys = Object.keys(edgeHash);
|
|
407
|
+
for (let startIndex = 0; startIndex < edgeStartKeys.length; startIndex++) {
|
|
408
|
+
const edgeEnds = edgeHash[edgeStartKeys[startIndex]];
|
|
409
|
+
const edgeEndKeys = Object.keys(edgeEnds);
|
|
410
|
+
for (let endIndex = 0; endIndex < edgeEndKeys.length; endIndex++) {
|
|
411
|
+
const edgeData = edgeEnds[edgeEndKeys[endIndex]];
|
|
412
|
+
addOutlinesForEdge(outlines, edgeData, indexArray, positions, normals);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
function generateOutlinesFromHash(outlinesHash, indexArray, positions, normals) {
|
|
417
|
+
const outlines = [];
|
|
418
|
+
const features = Object.keys(outlinesHash);
|
|
419
|
+
for (let featureIndex = 0; featureIndex < features.length; featureIndex++) {
|
|
420
|
+
const edgeHash = outlinesHash[features[featureIndex]].edges;
|
|
421
|
+
addOutlinesForFeature(outlines, edgeHash, indexArray, positions, normals);
|
|
422
|
+
}
|
|
423
|
+
return outlines;
|
|
424
|
+
}
|
|
425
|
+
function generateOutlinesIndexArray(symbologyData, featureIndexArray, indexArray, positions, normals) {
|
|
426
|
+
if (!defined_default(symbologyData) || Object.keys(symbologyData).length === 0) {
|
|
427
|
+
return void 0;
|
|
428
|
+
}
|
|
429
|
+
const outlinesHash = generateOutlinesHash(
|
|
430
|
+
symbologyData,
|
|
431
|
+
featureIndexArray,
|
|
432
|
+
indexArray,
|
|
433
|
+
positions
|
|
434
|
+
);
|
|
435
|
+
if (!defined_default(normals) || indexArray.length * 3 !== normals.length) {
|
|
436
|
+
normals = [];
|
|
437
|
+
}
|
|
438
|
+
const outlines = generateOutlinesFromHash(
|
|
439
|
+
outlinesHash,
|
|
440
|
+
indexArray,
|
|
441
|
+
positions,
|
|
442
|
+
normals
|
|
443
|
+
);
|
|
444
|
+
const outlinesIndexArray = outlines.length > 0 ? new Uint32Array(outlines) : void 0;
|
|
445
|
+
return outlinesIndexArray;
|
|
446
|
+
}
|
|
447
|
+
function convertColorsArray(colors) {
|
|
448
|
+
const colorsArray = new Float32Array(colors.length);
|
|
449
|
+
for (let index = 0; index < colors.length; index += 4) {
|
|
450
|
+
colorsArray[index] = srgbToLinear_default(Color_default.byteToFloat(colors[index]));
|
|
451
|
+
colorsArray[index + 1] = srgbToLinear_default(Color_default.byteToFloat(colors[index + 1]));
|
|
452
|
+
colorsArray[index + 2] = srgbToLinear_default(Color_default.byteToFloat(colors[index + 2]));
|
|
453
|
+
colorsArray[index + 3] = Color_default.byteToFloat(colors[index + 3]);
|
|
454
|
+
}
|
|
455
|
+
return colorsArray;
|
|
456
|
+
}
|
|
457
|
+
function generateNormals(vertexCount, indices, positions, normals, uv0s, colors, featureIndex) {
|
|
458
|
+
const result = {
|
|
459
|
+
normals: void 0,
|
|
460
|
+
positions: void 0,
|
|
461
|
+
uv0s: void 0,
|
|
462
|
+
colors: void 0,
|
|
463
|
+
featureIndex: void 0,
|
|
464
|
+
vertexCount: void 0
|
|
465
|
+
};
|
|
466
|
+
if (vertexCount === 0 || !defined_default(positions) || positions.length === 0 || defined_default(normals)) {
|
|
467
|
+
return result;
|
|
468
|
+
}
|
|
469
|
+
if (defined_default(indices)) {
|
|
470
|
+
result.vertexCount = indices.length;
|
|
471
|
+
result.positions = new Float32Array(indices.length * 3);
|
|
472
|
+
result.uv0s = defined_default(uv0s) ? new Float32Array(indices.length * 2) : void 0;
|
|
473
|
+
result.colors = defined_default(colors) ? new Uint8Array(indices.length * 4) : void 0;
|
|
474
|
+
result.featureIndex = defined_default(featureIndex) ? new Array(indices.length) : void 0;
|
|
475
|
+
for (let i = 0; i < indices.length; i++) {
|
|
476
|
+
const index = indices[i];
|
|
477
|
+
result.positions[i * 3] = positions[index * 3];
|
|
478
|
+
result.positions[i * 3 + 1] = positions[index * 3 + 1];
|
|
479
|
+
result.positions[i * 3 + 2] = positions[index * 3 + 2];
|
|
480
|
+
if (defined_default(result.uv0s)) {
|
|
481
|
+
result.uv0s[i * 2] = uv0s[index * 2];
|
|
482
|
+
result.uv0s[i * 2 + 1] = uv0s[index * 2 + 1];
|
|
483
|
+
}
|
|
484
|
+
if (defined_default(result.colors)) {
|
|
485
|
+
result.colors[i * 4] = colors[index * 4];
|
|
486
|
+
result.colors[i * 4 + 1] = colors[index * 4 + 1];
|
|
487
|
+
result.colors[i * 4 + 2] = colors[index * 4 + 2];
|
|
488
|
+
result.colors[i * 4 + 3] = colors[index * 4 + 3];
|
|
489
|
+
}
|
|
490
|
+
if (defined_default(result.featureIndex)) {
|
|
491
|
+
result.featureIndex[i] = featureIndex[index];
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
vertexCount = indices.length;
|
|
495
|
+
positions = result.positions;
|
|
496
|
+
}
|
|
497
|
+
indices = new Array(vertexCount);
|
|
498
|
+
for (let i = 0; i < vertexCount; i++) {
|
|
499
|
+
indices[i] = i;
|
|
500
|
+
}
|
|
501
|
+
result.normals = new Float32Array(indices.length * 3);
|
|
502
|
+
for (let i = 0; i < indices.length; i += 3) {
|
|
503
|
+
calculateFaceNormal(result.normals, i, indices, positions);
|
|
504
|
+
}
|
|
505
|
+
return result;
|
|
506
|
+
}
|
|
507
|
+
function generateGltfBuffer(vertexCount, indices, positions, normals, uv0s, colors, featureIndex, parameters) {
|
|
508
|
+
if (vertexCount === 0 || !defined_default(positions) || positions.length === 0) {
|
|
509
|
+
return {
|
|
510
|
+
buffers: [],
|
|
511
|
+
bufferViews: [],
|
|
512
|
+
accessors: [],
|
|
513
|
+
meshes: [],
|
|
514
|
+
nodes: [],
|
|
515
|
+
nodesInScene: []
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
const buffers = [];
|
|
519
|
+
const bufferViews = [];
|
|
520
|
+
const accessors = [];
|
|
521
|
+
const meshes = [];
|
|
522
|
+
const nodes = [];
|
|
523
|
+
const nodesInScene = [];
|
|
524
|
+
const rootExtensions = {};
|
|
525
|
+
const extensionsUsed = [];
|
|
526
|
+
if (defined_default(indices)) {
|
|
527
|
+
vertexCount = indices.length;
|
|
528
|
+
}
|
|
529
|
+
const { indexArray, transparentVertexOffset } = generateIndexArray(
|
|
530
|
+
vertexCount,
|
|
531
|
+
indices,
|
|
532
|
+
colors,
|
|
533
|
+
parameters.splitGeometryByColorTransparency
|
|
534
|
+
);
|
|
535
|
+
const indicesBlob = new Blob([indexArray], { type: "application/binary" });
|
|
536
|
+
const indicesURL = URL.createObjectURL(indicesBlob);
|
|
537
|
+
const endIndex = vertexCount;
|
|
538
|
+
const featureIndexArray = parameters.enableFeatures && defined_default(featureIndex) ? new Float32Array(featureIndex.length) : void 0;
|
|
539
|
+
let featureCount = 0;
|
|
540
|
+
if (defined_default(featureIndexArray)) {
|
|
541
|
+
for (let index = 0; index < featureIndex.length; ++index) {
|
|
542
|
+
featureIndexArray[index] = featureIndex[index];
|
|
543
|
+
const countByIndex = featureIndex[index] + 1;
|
|
544
|
+
if (featureCount < countByIndex) {
|
|
545
|
+
featureCount = countByIndex;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
let outlinesIndicesURL;
|
|
550
|
+
const outlinesIndexArray = generateOutlinesIndexArray(
|
|
551
|
+
parameters.symbologyData,
|
|
552
|
+
featureIndex,
|
|
553
|
+
indexArray,
|
|
554
|
+
positions,
|
|
555
|
+
normals
|
|
556
|
+
);
|
|
557
|
+
if (defined_default(outlinesIndexArray)) {
|
|
558
|
+
const outlinesIndicesBlob = new Blob([outlinesIndexArray], {
|
|
559
|
+
type: "application/binary"
|
|
560
|
+
});
|
|
561
|
+
outlinesIndicesURL = URL.createObjectURL(outlinesIndicesBlob);
|
|
562
|
+
}
|
|
563
|
+
const meshPositions = positions.subarray(0, endIndex * 3);
|
|
564
|
+
const positionsBlob = new Blob([meshPositions], {
|
|
565
|
+
type: "application/binary"
|
|
566
|
+
});
|
|
567
|
+
const positionsURL = URL.createObjectURL(positionsBlob);
|
|
568
|
+
let minX = Number.POSITIVE_INFINITY;
|
|
569
|
+
let maxX = Number.NEGATIVE_INFINITY;
|
|
570
|
+
let minY = Number.POSITIVE_INFINITY;
|
|
571
|
+
let maxY = Number.NEGATIVE_INFINITY;
|
|
572
|
+
let minZ = Number.POSITIVE_INFINITY;
|
|
573
|
+
let maxZ = Number.NEGATIVE_INFINITY;
|
|
574
|
+
for (let i = 0; i < meshPositions.length / 3; i++) {
|
|
575
|
+
minX = Math.min(minX, meshPositions[i * 3 + 0]);
|
|
576
|
+
maxX = Math.max(maxX, meshPositions[i * 3 + 0]);
|
|
577
|
+
minY = Math.min(minY, meshPositions[i * 3 + 1]);
|
|
578
|
+
maxY = Math.max(maxY, meshPositions[i * 3 + 1]);
|
|
579
|
+
minZ = Math.min(minZ, meshPositions[i * 3 + 2]);
|
|
580
|
+
maxZ = Math.max(maxZ, meshPositions[i * 3 + 2]);
|
|
581
|
+
}
|
|
582
|
+
const meshNormals = normals ? normals.subarray(0, endIndex * 3) : void 0;
|
|
583
|
+
let normalsURL;
|
|
584
|
+
if (defined_default(meshNormals)) {
|
|
585
|
+
const normalsBlob = new Blob([meshNormals], {
|
|
586
|
+
type: "application/binary"
|
|
587
|
+
});
|
|
588
|
+
normalsURL = URL.createObjectURL(normalsBlob);
|
|
589
|
+
}
|
|
590
|
+
const meshUv0s = uv0s ? uv0s.subarray(0, endIndex * 2) : void 0;
|
|
591
|
+
let uv0URL;
|
|
592
|
+
if (defined_default(meshUv0s)) {
|
|
593
|
+
const uv0Blob = new Blob([meshUv0s], { type: "application/binary" });
|
|
594
|
+
uv0URL = URL.createObjectURL(uv0Blob);
|
|
595
|
+
}
|
|
596
|
+
const meshColorsInBytes = defined_default(colors) ? convertColorsArray(colors.subarray(0, endIndex * 4)) : void 0;
|
|
597
|
+
let colorsURL;
|
|
598
|
+
if (defined_default(meshColorsInBytes)) {
|
|
599
|
+
const colorsBlob = new Blob([meshColorsInBytes], {
|
|
600
|
+
type: "application/binary"
|
|
601
|
+
});
|
|
602
|
+
colorsURL = URL.createObjectURL(colorsBlob);
|
|
603
|
+
}
|
|
604
|
+
const meshFeatureId0 = defined_default(featureIndexArray) ? featureIndexArray.subarray(0, endIndex) : void 0;
|
|
605
|
+
let featureId0URL;
|
|
606
|
+
if (defined_default(meshFeatureId0)) {
|
|
607
|
+
const featureId0Blob = new Blob([meshFeatureId0], {
|
|
608
|
+
type: "application/binary"
|
|
609
|
+
});
|
|
610
|
+
featureId0URL = URL.createObjectURL(featureId0Blob);
|
|
611
|
+
}
|
|
612
|
+
const meshPropertyTable0 = defined_default(featureIndexArray) ? new Float32Array(featureCount) : void 0;
|
|
613
|
+
let propertyTable0URL;
|
|
614
|
+
if (defined_default(meshPropertyTable0)) {
|
|
615
|
+
for (let index = 0; index < meshPropertyTable0.length; ++index) {
|
|
616
|
+
meshPropertyTable0[index] = index;
|
|
617
|
+
}
|
|
618
|
+
const propertyTable0Blob = new Blob([meshPropertyTable0], {
|
|
619
|
+
type: "application/binary"
|
|
620
|
+
});
|
|
621
|
+
propertyTable0URL = URL.createObjectURL(propertyTable0Blob);
|
|
622
|
+
}
|
|
623
|
+
const attributes = {};
|
|
624
|
+
const extensions = {};
|
|
625
|
+
attributes.POSITION = accessors.length;
|
|
626
|
+
buffers.push({
|
|
627
|
+
uri: positionsURL,
|
|
628
|
+
byteLength: meshPositions.byteLength
|
|
629
|
+
});
|
|
630
|
+
bufferViews.push({
|
|
631
|
+
buffer: buffers.length - 1,
|
|
632
|
+
byteOffset: 0,
|
|
633
|
+
byteLength: meshPositions.byteLength,
|
|
634
|
+
target: 34962
|
|
635
|
+
});
|
|
636
|
+
accessors.push({
|
|
637
|
+
bufferView: bufferViews.length - 1,
|
|
638
|
+
byteOffset: 0,
|
|
639
|
+
componentType: 5126,
|
|
640
|
+
count: meshPositions.length / 3,
|
|
641
|
+
type: "VEC3",
|
|
642
|
+
max: [minX, minY, minZ],
|
|
643
|
+
min: [maxX, maxY, maxZ]
|
|
644
|
+
});
|
|
645
|
+
if (defined_default(normalsURL)) {
|
|
646
|
+
attributes.NORMAL = accessors.length;
|
|
647
|
+
buffers.push({
|
|
648
|
+
uri: normalsURL,
|
|
649
|
+
byteLength: meshNormals.byteLength
|
|
650
|
+
});
|
|
651
|
+
bufferViews.push({
|
|
652
|
+
buffer: buffers.length - 1,
|
|
653
|
+
byteOffset: 0,
|
|
654
|
+
byteLength: meshNormals.byteLength,
|
|
655
|
+
target: 34962
|
|
656
|
+
});
|
|
657
|
+
accessors.push({
|
|
658
|
+
bufferView: bufferViews.length - 1,
|
|
659
|
+
byteOffset: 0,
|
|
660
|
+
componentType: 5126,
|
|
661
|
+
count: meshNormals.length / 3,
|
|
662
|
+
type: "VEC3"
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
if (defined_default(uv0URL)) {
|
|
666
|
+
attributes.TEXCOORD_0 = accessors.length;
|
|
667
|
+
buffers.push({
|
|
668
|
+
uri: uv0URL,
|
|
669
|
+
byteLength: meshUv0s.byteLength
|
|
670
|
+
});
|
|
671
|
+
bufferViews.push({
|
|
672
|
+
buffer: buffers.length - 1,
|
|
673
|
+
byteOffset: 0,
|
|
674
|
+
byteLength: meshUv0s.byteLength,
|
|
675
|
+
target: 34962
|
|
676
|
+
});
|
|
677
|
+
accessors.push({
|
|
678
|
+
bufferView: bufferViews.length - 1,
|
|
679
|
+
byteOffset: 0,
|
|
680
|
+
componentType: 5126,
|
|
681
|
+
count: meshUv0s.length / 2,
|
|
682
|
+
type: "VEC2"
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
if (defined_default(colorsURL)) {
|
|
686
|
+
attributes.COLOR_0 = accessors.length;
|
|
687
|
+
buffers.push({
|
|
688
|
+
uri: colorsURL,
|
|
689
|
+
byteLength: meshColorsInBytes.byteLength
|
|
690
|
+
});
|
|
691
|
+
bufferViews.push({
|
|
692
|
+
buffer: buffers.length - 1,
|
|
693
|
+
byteOffset: 0,
|
|
694
|
+
byteLength: meshColorsInBytes.byteLength,
|
|
695
|
+
target: 34962
|
|
696
|
+
});
|
|
697
|
+
accessors.push({
|
|
698
|
+
bufferView: bufferViews.length - 1,
|
|
699
|
+
byteOffset: 0,
|
|
700
|
+
componentType: 5126,
|
|
701
|
+
count: meshColorsInBytes.length / 4,
|
|
702
|
+
type: "VEC4"
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
if (defined_default(featureId0URL)) {
|
|
706
|
+
attributes._FEATURE_ID_0 = accessors.length;
|
|
707
|
+
buffers.push({
|
|
708
|
+
uri: featureId0URL,
|
|
709
|
+
byteLength: meshFeatureId0.byteLength
|
|
710
|
+
});
|
|
711
|
+
bufferViews.push({
|
|
712
|
+
buffer: buffers.length - 1,
|
|
713
|
+
byteOffset: 0,
|
|
714
|
+
byteLength: meshFeatureId0.byteLength,
|
|
715
|
+
target: 34963
|
|
716
|
+
});
|
|
717
|
+
accessors.push({
|
|
718
|
+
bufferView: bufferViews.length - 1,
|
|
719
|
+
byteOffset: 0,
|
|
720
|
+
componentType: 5126,
|
|
721
|
+
count: meshFeatureId0.length,
|
|
722
|
+
type: "SCALAR"
|
|
723
|
+
});
|
|
724
|
+
extensions.EXT_mesh_features = {
|
|
725
|
+
featureIds: [
|
|
726
|
+
{
|
|
727
|
+
attribute: 0,
|
|
728
|
+
propertyTable: 0,
|
|
729
|
+
featureCount
|
|
730
|
+
}
|
|
731
|
+
]
|
|
732
|
+
};
|
|
733
|
+
extensionsUsed.push("EXT_mesh_features");
|
|
734
|
+
}
|
|
735
|
+
if (defined_default(propertyTable0URL)) {
|
|
736
|
+
buffers.push({
|
|
737
|
+
uri: propertyTable0URL,
|
|
738
|
+
byteLength: meshPropertyTable0.byteLength
|
|
739
|
+
});
|
|
740
|
+
bufferViews.push({
|
|
741
|
+
buffer: buffers.length - 1,
|
|
742
|
+
byteOffset: 0,
|
|
743
|
+
byteLength: meshPropertyTable0.byteLength,
|
|
744
|
+
target: 34963
|
|
745
|
+
});
|
|
746
|
+
rootExtensions.EXT_structural_metadata = {
|
|
747
|
+
schema: {
|
|
748
|
+
id: "i3s-metadata-schema-001",
|
|
749
|
+
name: "I3S metadata schema 001",
|
|
750
|
+
description: "The schema for I3S metadata",
|
|
751
|
+
version: "1.0",
|
|
752
|
+
classes: {
|
|
753
|
+
feature: {
|
|
754
|
+
name: "feature",
|
|
755
|
+
description: "Feature metadata",
|
|
756
|
+
properties: {
|
|
757
|
+
index: {
|
|
758
|
+
description: "The feature index",
|
|
759
|
+
type: "SCALAR",
|
|
760
|
+
componentType: "FLOAT32",
|
|
761
|
+
required: true
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
},
|
|
767
|
+
propertyTables: [
|
|
768
|
+
{
|
|
769
|
+
name: "feature-indices-mapping",
|
|
770
|
+
class: "feature",
|
|
771
|
+
count: featureCount,
|
|
772
|
+
properties: {
|
|
773
|
+
index: {
|
|
774
|
+
values: bufferViews.length - 1
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
]
|
|
779
|
+
};
|
|
780
|
+
extensionsUsed.push("EXT_structural_metadata");
|
|
781
|
+
}
|
|
782
|
+
if (defined_default(outlinesIndicesURL)) {
|
|
783
|
+
buffers.push({
|
|
784
|
+
uri: outlinesIndicesURL,
|
|
785
|
+
byteLength: outlinesIndexArray.byteLength
|
|
786
|
+
});
|
|
787
|
+
bufferViews.push({
|
|
788
|
+
buffer: buffers.length - 1,
|
|
789
|
+
byteOffset: 0,
|
|
790
|
+
byteLength: outlinesIndexArray.byteLength,
|
|
791
|
+
target: 34963
|
|
792
|
+
});
|
|
793
|
+
accessors.push({
|
|
794
|
+
bufferView: bufferViews.length - 1,
|
|
795
|
+
byteOffset: 0,
|
|
796
|
+
componentType: 5125,
|
|
797
|
+
count: outlinesIndexArray.length,
|
|
798
|
+
type: "SCALAR"
|
|
799
|
+
});
|
|
800
|
+
extensions.CESIUM_primitive_outline = {
|
|
801
|
+
indices: accessors.length - 1
|
|
802
|
+
};
|
|
803
|
+
extensionsUsed.push("CESIUM_primitive_outline");
|
|
804
|
+
}
|
|
805
|
+
buffers.push({
|
|
806
|
+
uri: indicesURL,
|
|
807
|
+
byteLength: indexArray.byteLength
|
|
808
|
+
});
|
|
809
|
+
bufferViews.push({
|
|
810
|
+
buffer: buffers.length - 1,
|
|
811
|
+
byteOffset: 0,
|
|
812
|
+
byteLength: indexArray.byteLength,
|
|
813
|
+
target: 34963
|
|
814
|
+
});
|
|
815
|
+
const meshPrimitives = [];
|
|
816
|
+
if (transparentVertexOffset > 0) {
|
|
817
|
+
accessors.push({
|
|
818
|
+
bufferView: bufferViews.length - 1,
|
|
819
|
+
byteOffset: 0,
|
|
820
|
+
componentType: 5125,
|
|
821
|
+
count: transparentVertexOffset,
|
|
822
|
+
type: "SCALAR"
|
|
823
|
+
});
|
|
824
|
+
meshPrimitives.push({
|
|
825
|
+
attributes,
|
|
826
|
+
indices: accessors.length - 1,
|
|
827
|
+
material: meshPrimitives.length,
|
|
828
|
+
extensions
|
|
829
|
+
});
|
|
830
|
+
}
|
|
831
|
+
if (transparentVertexOffset < vertexCount) {
|
|
832
|
+
accessors.push({
|
|
833
|
+
bufferView: bufferViews.length - 1,
|
|
834
|
+
byteOffset: 4 * transparentVertexOffset,
|
|
835
|
+
// skip 4 bytes for each opaque vertex
|
|
836
|
+
componentType: 5125,
|
|
837
|
+
count: vertexCount - transparentVertexOffset,
|
|
838
|
+
type: "SCALAR"
|
|
839
|
+
});
|
|
840
|
+
meshPrimitives.push({
|
|
841
|
+
attributes,
|
|
842
|
+
indices: accessors.length - 1,
|
|
843
|
+
material: meshPrimitives.length,
|
|
844
|
+
extensions,
|
|
845
|
+
extra: {
|
|
846
|
+
isTransparent: true
|
|
847
|
+
}
|
|
848
|
+
});
|
|
849
|
+
}
|
|
850
|
+
meshes.push({
|
|
851
|
+
primitives: meshPrimitives
|
|
852
|
+
});
|
|
853
|
+
nodesInScene.push(0);
|
|
854
|
+
nodes.push({ mesh: 0 });
|
|
855
|
+
return {
|
|
856
|
+
buffers,
|
|
857
|
+
bufferViews,
|
|
858
|
+
accessors,
|
|
859
|
+
meshes,
|
|
860
|
+
nodes,
|
|
861
|
+
nodesInScene,
|
|
862
|
+
rootExtensions,
|
|
863
|
+
extensionsUsed
|
|
864
|
+
};
|
|
865
|
+
}
|
|
866
|
+
function decode(data, schema, bufferInfo, featureData) {
|
|
867
|
+
const magicNumber = new Uint8Array(data, 0, 5);
|
|
868
|
+
if (magicNumber[0] === "D".charCodeAt() && magicNumber[1] === "R".charCodeAt() && magicNumber[2] === "A".charCodeAt() && magicNumber[3] === "C".charCodeAt() && magicNumber[4] === "O".charCodeAt()) {
|
|
869
|
+
return decodeDracoEncodedGeometry(data, bufferInfo);
|
|
870
|
+
}
|
|
871
|
+
return decodeBinaryGeometry(data, schema, bufferInfo, featureData);
|
|
872
|
+
}
|
|
873
|
+
function decodeDracoEncodedGeometry(data) {
|
|
874
|
+
const dracoDecoderModule = draco;
|
|
875
|
+
const buffer = new dracoDecoderModule.DecoderBuffer();
|
|
876
|
+
const byteArray = new Uint8Array(data);
|
|
877
|
+
buffer.Init(byteArray, byteArray.length);
|
|
878
|
+
const dracoDecoder = new dracoDecoderModule.Decoder();
|
|
879
|
+
const geometryType = dracoDecoder.GetEncodedGeometryType(buffer);
|
|
880
|
+
const metadataQuerier = new dracoDecoderModule.MetadataQuerier();
|
|
881
|
+
let dracoGeometry;
|
|
882
|
+
let status;
|
|
883
|
+
if (geometryType === dracoDecoderModule.TRIANGULAR_MESH) {
|
|
884
|
+
dracoGeometry = new dracoDecoderModule.Mesh();
|
|
885
|
+
status = dracoDecoder.DecodeBufferToMesh(buffer, dracoGeometry);
|
|
886
|
+
}
|
|
887
|
+
const decodedGeometry = {
|
|
888
|
+
vertexCount: [0],
|
|
889
|
+
featureCount: 0
|
|
890
|
+
};
|
|
891
|
+
if (defined_default(status) && status.ok() && dracoGeometry.ptr !== 0) {
|
|
892
|
+
const faceCount = dracoGeometry.num_faces();
|
|
893
|
+
const attributesCount = dracoGeometry.num_attributes();
|
|
894
|
+
const vertexCount = dracoGeometry.num_points();
|
|
895
|
+
decodedGeometry.indices = new Uint32Array(faceCount * 3);
|
|
896
|
+
const faces = decodedGeometry.indices;
|
|
897
|
+
decodedGeometry.vertexCount[0] = vertexCount;
|
|
898
|
+
decodedGeometry.scale_x = 1;
|
|
899
|
+
decodedGeometry.scale_y = 1;
|
|
900
|
+
const face = new dracoDecoderModule.DracoInt32Array(3);
|
|
901
|
+
for (let faceIndex = 0; faceIndex < faceCount; ++faceIndex) {
|
|
902
|
+
dracoDecoder.GetFaceFromMesh(dracoGeometry, faceIndex, face);
|
|
903
|
+
faces[faceIndex * 3] = face.GetValue(0);
|
|
904
|
+
faces[faceIndex * 3 + 1] = face.GetValue(1);
|
|
905
|
+
faces[faceIndex * 3 + 2] = face.GetValue(2);
|
|
906
|
+
}
|
|
907
|
+
dracoDecoderModule.destroy(face);
|
|
908
|
+
for (let attrIndex = 0; attrIndex < attributesCount; ++attrIndex) {
|
|
909
|
+
const dracoAttribute = dracoDecoder.GetAttribute(
|
|
910
|
+
dracoGeometry,
|
|
911
|
+
attrIndex
|
|
912
|
+
);
|
|
913
|
+
const attributeData = decodeDracoAttribute(
|
|
914
|
+
dracoDecoderModule,
|
|
915
|
+
dracoDecoder,
|
|
916
|
+
dracoGeometry,
|
|
917
|
+
dracoAttribute,
|
|
918
|
+
vertexCount
|
|
919
|
+
);
|
|
920
|
+
const dracoAttributeType = dracoAttribute.attribute_type();
|
|
921
|
+
let attributei3sName = "unknown";
|
|
922
|
+
if (dracoAttributeType === dracoDecoderModule.POSITION) {
|
|
923
|
+
attributei3sName = "positions";
|
|
924
|
+
} else if (dracoAttributeType === dracoDecoderModule.NORMAL) {
|
|
925
|
+
attributei3sName = "normals";
|
|
926
|
+
} else if (dracoAttributeType === dracoDecoderModule.COLOR) {
|
|
927
|
+
attributei3sName = "colors";
|
|
928
|
+
} else if (dracoAttributeType === dracoDecoderModule.TEX_COORD) {
|
|
929
|
+
attributei3sName = "uv0s";
|
|
930
|
+
}
|
|
931
|
+
const metadata = dracoDecoder.GetAttributeMetadata(
|
|
932
|
+
dracoGeometry,
|
|
933
|
+
attrIndex
|
|
934
|
+
);
|
|
935
|
+
if (metadata.ptr !== 0) {
|
|
936
|
+
const numEntries = metadataQuerier.NumEntries(metadata);
|
|
937
|
+
for (let entry = 0; entry < numEntries; ++entry) {
|
|
938
|
+
const entryName = metadataQuerier.GetEntryName(metadata, entry);
|
|
939
|
+
if (entryName === "i3s-scale_x") {
|
|
940
|
+
decodedGeometry.scale_x = metadataQuerier.GetDoubleEntry(
|
|
941
|
+
metadata,
|
|
942
|
+
"i3s-scale_x"
|
|
943
|
+
);
|
|
944
|
+
} else if (entryName === "i3s-scale_y") {
|
|
945
|
+
decodedGeometry.scale_y = metadataQuerier.GetDoubleEntry(
|
|
946
|
+
metadata,
|
|
947
|
+
"i3s-scale_y"
|
|
948
|
+
);
|
|
949
|
+
} else if (entryName === "i3s-attribute-type") {
|
|
950
|
+
attributei3sName = metadataQuerier.GetStringEntry(
|
|
951
|
+
metadata,
|
|
952
|
+
"i3s-attribute-type"
|
|
953
|
+
);
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
if (defined_default(decodedGeometry[attributei3sName])) {
|
|
958
|
+
console.log("Attribute already exists", attributei3sName);
|
|
959
|
+
}
|
|
960
|
+
decodedGeometry[attributei3sName] = attributeData;
|
|
961
|
+
if (attributei3sName === "feature-index") {
|
|
962
|
+
decodedGeometry.featureCount++;
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
dracoDecoderModule.destroy(dracoGeometry);
|
|
966
|
+
}
|
|
967
|
+
dracoDecoderModule.destroy(metadataQuerier);
|
|
968
|
+
dracoDecoderModule.destroy(dracoDecoder);
|
|
969
|
+
return decodedGeometry;
|
|
970
|
+
}
|
|
971
|
+
function decodeDracoAttribute(dracoDecoderModule, dracoDecoder, dracoGeometry, dracoAttribute, vertexCount) {
|
|
972
|
+
const bufferSize = dracoAttribute.num_components() * vertexCount;
|
|
973
|
+
let dracoAttributeData;
|
|
974
|
+
const handlers = [
|
|
975
|
+
function() {
|
|
976
|
+
},
|
|
977
|
+
// DT_INVALID - 0
|
|
978
|
+
function() {
|
|
979
|
+
dracoAttributeData = new dracoDecoderModule.DracoInt8Array(bufferSize);
|
|
980
|
+
const success = dracoDecoder.GetAttributeInt8ForAllPoints(
|
|
981
|
+
dracoGeometry,
|
|
982
|
+
dracoAttribute,
|
|
983
|
+
dracoAttributeData
|
|
984
|
+
);
|
|
985
|
+
if (!success) {
|
|
986
|
+
console.error("Bad stream");
|
|
987
|
+
}
|
|
988
|
+
const attributeData2 = new Int8Array(bufferSize);
|
|
989
|
+
for (let i = 0; i < bufferSize; ++i) {
|
|
990
|
+
attributeData2[i] = dracoAttributeData.GetValue(i);
|
|
991
|
+
}
|
|
992
|
+
return attributeData2;
|
|
993
|
+
},
|
|
994
|
+
function() {
|
|
995
|
+
dracoAttributeData = new dracoDecoderModule.DracoInt8Array(bufferSize);
|
|
996
|
+
const success = dracoDecoder.GetAttributeUInt8ForAllPoints(
|
|
997
|
+
dracoGeometry,
|
|
998
|
+
dracoAttribute,
|
|
999
|
+
dracoAttributeData
|
|
1000
|
+
);
|
|
1001
|
+
if (!success) {
|
|
1002
|
+
console.error("Bad stream");
|
|
1003
|
+
}
|
|
1004
|
+
const attributeData2 = new Uint8Array(bufferSize);
|
|
1005
|
+
for (let i = 0; i < bufferSize; ++i) {
|
|
1006
|
+
attributeData2[i] = dracoAttributeData.GetValue(i);
|
|
1007
|
+
}
|
|
1008
|
+
return attributeData2;
|
|
1009
|
+
},
|
|
1010
|
+
function() {
|
|
1011
|
+
dracoAttributeData = new dracoDecoderModule.DracoInt16Array(bufferSize);
|
|
1012
|
+
const success = dracoDecoder.GetAttributeInt16ForAllPoints(
|
|
1013
|
+
dracoGeometry,
|
|
1014
|
+
dracoAttribute,
|
|
1015
|
+
dracoAttributeData
|
|
1016
|
+
);
|
|
1017
|
+
if (!success) {
|
|
1018
|
+
console.error("Bad stream");
|
|
1019
|
+
}
|
|
1020
|
+
const attributeData2 = new Int16Array(bufferSize);
|
|
1021
|
+
for (let i = 0; i < bufferSize; ++i) {
|
|
1022
|
+
attributeData2[i] = dracoAttributeData.GetValue(i);
|
|
1023
|
+
}
|
|
1024
|
+
return attributeData2;
|
|
1025
|
+
},
|
|
1026
|
+
function() {
|
|
1027
|
+
dracoAttributeData = new dracoDecoderModule.DracoInt16Array(bufferSize);
|
|
1028
|
+
const success = dracoDecoder.GetAttributeUInt16ForAllPoints(
|
|
1029
|
+
dracoGeometry,
|
|
1030
|
+
dracoAttribute,
|
|
1031
|
+
dracoAttributeData
|
|
1032
|
+
);
|
|
1033
|
+
if (!success) {
|
|
1034
|
+
console.error("Bad stream");
|
|
1035
|
+
}
|
|
1036
|
+
const attributeData2 = new Uint16Array(bufferSize);
|
|
1037
|
+
for (let i = 0; i < bufferSize; ++i) {
|
|
1038
|
+
attributeData2[i] = dracoAttributeData.GetValue(i);
|
|
1039
|
+
}
|
|
1040
|
+
return attributeData2;
|
|
1041
|
+
},
|
|
1042
|
+
function() {
|
|
1043
|
+
dracoAttributeData = new dracoDecoderModule.DracoInt32Array(bufferSize);
|
|
1044
|
+
const success = dracoDecoder.GetAttributeInt32ForAllPoints(
|
|
1045
|
+
dracoGeometry,
|
|
1046
|
+
dracoAttribute,
|
|
1047
|
+
dracoAttributeData
|
|
1048
|
+
);
|
|
1049
|
+
if (!success) {
|
|
1050
|
+
console.error("Bad stream");
|
|
1051
|
+
}
|
|
1052
|
+
const attributeData2 = new Int32Array(bufferSize);
|
|
1053
|
+
for (let i = 0; i < bufferSize; ++i) {
|
|
1054
|
+
attributeData2[i] = dracoAttributeData.GetValue(i);
|
|
1055
|
+
}
|
|
1056
|
+
return attributeData2;
|
|
1057
|
+
},
|
|
1058
|
+
function() {
|
|
1059
|
+
dracoAttributeData = new dracoDecoderModule.DracoInt32Array(bufferSize);
|
|
1060
|
+
const success = dracoDecoder.GetAttributeUInt32ForAllPoints(
|
|
1061
|
+
dracoGeometry,
|
|
1062
|
+
dracoAttribute,
|
|
1063
|
+
dracoAttributeData
|
|
1064
|
+
);
|
|
1065
|
+
if (!success) {
|
|
1066
|
+
console.error("Bad stream");
|
|
1067
|
+
}
|
|
1068
|
+
const attributeData2 = new Uint32Array(bufferSize);
|
|
1069
|
+
for (let i = 0; i < bufferSize; ++i) {
|
|
1070
|
+
attributeData2[i] = dracoAttributeData.GetValue(i);
|
|
1071
|
+
}
|
|
1072
|
+
return attributeData2;
|
|
1073
|
+
},
|
|
1074
|
+
function() {
|
|
1075
|
+
},
|
|
1076
|
+
function() {
|
|
1077
|
+
},
|
|
1078
|
+
function() {
|
|
1079
|
+
dracoAttributeData = new dracoDecoderModule.DracoFloat32Array(bufferSize);
|
|
1080
|
+
const success = dracoDecoder.GetAttributeFloatForAllPoints(
|
|
1081
|
+
dracoGeometry,
|
|
1082
|
+
dracoAttribute,
|
|
1083
|
+
dracoAttributeData
|
|
1084
|
+
);
|
|
1085
|
+
if (!success) {
|
|
1086
|
+
console.error("Bad stream");
|
|
1087
|
+
}
|
|
1088
|
+
const attributeData2 = new Float32Array(bufferSize);
|
|
1089
|
+
for (let i = 0; i < bufferSize; ++i) {
|
|
1090
|
+
attributeData2[i] = dracoAttributeData.GetValue(i);
|
|
1091
|
+
}
|
|
1092
|
+
return attributeData2;
|
|
1093
|
+
},
|
|
1094
|
+
function() {
|
|
1095
|
+
},
|
|
1096
|
+
function() {
|
|
1097
|
+
dracoAttributeData = new dracoDecoderModule.DracoUInt8Array(bufferSize);
|
|
1098
|
+
const success = dracoDecoder.GetAttributeUInt8ForAllPoints(
|
|
1099
|
+
dracoGeometry,
|
|
1100
|
+
dracoAttribute,
|
|
1101
|
+
dracoAttributeData
|
|
1102
|
+
);
|
|
1103
|
+
if (!success) {
|
|
1104
|
+
console.error("Bad stream");
|
|
1105
|
+
}
|
|
1106
|
+
const attributeData2 = new Uint8Array(bufferSize);
|
|
1107
|
+
for (let i = 0; i < bufferSize; ++i) {
|
|
1108
|
+
attributeData2[i] = dracoAttributeData.GetValue(i);
|
|
1109
|
+
}
|
|
1110
|
+
return attributeData2;
|
|
1111
|
+
}
|
|
1112
|
+
];
|
|
1113
|
+
const attributeData = handlers[dracoAttribute.data_type()]();
|
|
1114
|
+
if (defined_default(dracoAttributeData)) {
|
|
1115
|
+
dracoDecoderModule.destroy(dracoAttributeData);
|
|
1116
|
+
}
|
|
1117
|
+
return attributeData;
|
|
1118
|
+
}
|
|
1119
|
+
var binaryAttributeDecoders = {
|
|
1120
|
+
position: function(decodedGeometry, data, offset) {
|
|
1121
|
+
const count = decodedGeometry.vertexCount * 3;
|
|
1122
|
+
decodedGeometry.positions = new Float32Array(data, offset, count);
|
|
1123
|
+
offset += count * 4;
|
|
1124
|
+
return offset;
|
|
1125
|
+
},
|
|
1126
|
+
normal: function(decodedGeometry, data, offset) {
|
|
1127
|
+
const count = decodedGeometry.vertexCount * 3;
|
|
1128
|
+
decodedGeometry.normals = new Float32Array(data, offset, count);
|
|
1129
|
+
offset += count * 4;
|
|
1130
|
+
return offset;
|
|
1131
|
+
},
|
|
1132
|
+
uv0: function(decodedGeometry, data, offset) {
|
|
1133
|
+
const count = decodedGeometry.vertexCount * 2;
|
|
1134
|
+
decodedGeometry.uv0s = new Float32Array(data, offset, count);
|
|
1135
|
+
offset += count * 4;
|
|
1136
|
+
return offset;
|
|
1137
|
+
},
|
|
1138
|
+
color: function(decodedGeometry, data, offset) {
|
|
1139
|
+
const count = decodedGeometry.vertexCount * 4;
|
|
1140
|
+
decodedGeometry.colors = new Uint8Array(data, offset, count);
|
|
1141
|
+
offset += count;
|
|
1142
|
+
return offset;
|
|
1143
|
+
},
|
|
1144
|
+
featureId: function(decodedGeometry, data, offset) {
|
|
1145
|
+
const count = decodedGeometry.featureCount;
|
|
1146
|
+
offset += count * 8;
|
|
1147
|
+
return offset;
|
|
1148
|
+
},
|
|
1149
|
+
id: function(decodedGeometry, data, offset) {
|
|
1150
|
+
const count = decodedGeometry.featureCount;
|
|
1151
|
+
offset += count * 8;
|
|
1152
|
+
return offset;
|
|
1153
|
+
},
|
|
1154
|
+
faceRange: function(decodedGeometry, data, offset) {
|
|
1155
|
+
const count = decodedGeometry.featureCount * 2;
|
|
1156
|
+
decodedGeometry.faceRange = new Uint32Array(data, offset, count);
|
|
1157
|
+
offset += count * 4;
|
|
1158
|
+
return offset;
|
|
1159
|
+
},
|
|
1160
|
+
uvRegion: function(decodedGeometry, data, offset) {
|
|
1161
|
+
const count = decodedGeometry.vertexCount * 4;
|
|
1162
|
+
decodedGeometry["uv-region"] = new Uint16Array(data, offset, count);
|
|
1163
|
+
offset += count * 2;
|
|
1164
|
+
return offset;
|
|
1165
|
+
},
|
|
1166
|
+
region: function(decodedGeometry, data, offset) {
|
|
1167
|
+
const count = decodedGeometry.vertexCount * 4;
|
|
1168
|
+
decodedGeometry["uv-region"] = new Uint16Array(data, offset, count);
|
|
1169
|
+
offset += count * 2;
|
|
1170
|
+
return offset;
|
|
1171
|
+
}
|
|
1172
|
+
};
|
|
1173
|
+
function decodeBinaryGeometry(data, schema, bufferInfo, featureData) {
|
|
1174
|
+
const decodedGeometry = {
|
|
1175
|
+
vertexCount: 0
|
|
1176
|
+
};
|
|
1177
|
+
const dataView = new DataView(data);
|
|
1178
|
+
try {
|
|
1179
|
+
let offset = 0;
|
|
1180
|
+
decodedGeometry.vertexCount = dataView.getUint32(offset, 1);
|
|
1181
|
+
offset += 4;
|
|
1182
|
+
decodedGeometry.featureCount = dataView.getUint32(offset, 1);
|
|
1183
|
+
offset += 4;
|
|
1184
|
+
if (defined_default(bufferInfo)) {
|
|
1185
|
+
for (let attrIndex = 0; attrIndex < bufferInfo.attributes.length; attrIndex++) {
|
|
1186
|
+
if (defined_default(binaryAttributeDecoders[bufferInfo.attributes[attrIndex]])) {
|
|
1187
|
+
offset = binaryAttributeDecoders[bufferInfo.attributes[attrIndex]](
|
|
1188
|
+
decodedGeometry,
|
|
1189
|
+
data,
|
|
1190
|
+
offset
|
|
1191
|
+
);
|
|
1192
|
+
} else {
|
|
1193
|
+
console.error(
|
|
1194
|
+
"Unknown decoder for",
|
|
1195
|
+
bufferInfo.attributes[attrIndex]
|
|
1196
|
+
);
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
} else {
|
|
1200
|
+
let ordering = schema.ordering;
|
|
1201
|
+
let featureAttributeOrder = schema.featureAttributeOrder;
|
|
1202
|
+
if (defined_default(featureData) && defined_default(featureData.geometryData) && defined_default(featureData.geometryData[0]) && defined_default(featureData.geometryData[0].params)) {
|
|
1203
|
+
ordering = Object.keys(
|
|
1204
|
+
featureData.geometryData[0].params.vertexAttributes
|
|
1205
|
+
);
|
|
1206
|
+
featureAttributeOrder = Object.keys(
|
|
1207
|
+
featureData.geometryData[0].params.featureAttributes
|
|
1208
|
+
);
|
|
1209
|
+
}
|
|
1210
|
+
for (let i = 0; i < ordering.length; i++) {
|
|
1211
|
+
const decoder = binaryAttributeDecoders[ordering[i]];
|
|
1212
|
+
offset = decoder(decodedGeometry, data, offset);
|
|
1213
|
+
}
|
|
1214
|
+
for (let j = 0; j < featureAttributeOrder.length; j++) {
|
|
1215
|
+
const curDecoder = binaryAttributeDecoders[featureAttributeOrder[j]];
|
|
1216
|
+
offset = curDecoder(decodedGeometry, data, offset);
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
} catch (e) {
|
|
1220
|
+
console.error(e);
|
|
1221
|
+
}
|
|
1222
|
+
decodedGeometry.scale_x = 1;
|
|
1223
|
+
decodedGeometry.scale_y = 1;
|
|
1224
|
+
return decodedGeometry;
|
|
1225
|
+
}
|
|
1226
|
+
function decodeAndCreateGltf(parameters) {
|
|
1227
|
+
const geometryData = decode(
|
|
1228
|
+
parameters.binaryData,
|
|
1229
|
+
parameters.schema,
|
|
1230
|
+
parameters.bufferInfo,
|
|
1231
|
+
parameters.featureData
|
|
1232
|
+
);
|
|
1233
|
+
if (defined_default(parameters.geoidDataList) && parameters.geoidDataList.length > 0) {
|
|
1234
|
+
orthometricToEllipsoidal(
|
|
1235
|
+
geometryData.vertexCount,
|
|
1236
|
+
geometryData.positions,
|
|
1237
|
+
geometryData.scale_x,
|
|
1238
|
+
geometryData.scale_y,
|
|
1239
|
+
parameters.cartographicCenter,
|
|
1240
|
+
parameters.geoidDataList,
|
|
1241
|
+
false
|
|
1242
|
+
);
|
|
1243
|
+
}
|
|
1244
|
+
transformToLocal(
|
|
1245
|
+
geometryData.vertexCount,
|
|
1246
|
+
geometryData.positions,
|
|
1247
|
+
geometryData.normals,
|
|
1248
|
+
parameters.cartographicCenter,
|
|
1249
|
+
parameters.cartesianCenter,
|
|
1250
|
+
parameters.parentRotation,
|
|
1251
|
+
parameters.ellipsoidRadiiSquare,
|
|
1252
|
+
geometryData.scale_x,
|
|
1253
|
+
geometryData.scale_y
|
|
1254
|
+
);
|
|
1255
|
+
if (defined_default(geometryData.uv0s) && defined_default(geometryData["uv-region"])) {
|
|
1256
|
+
cropUVs(
|
|
1257
|
+
geometryData.vertexCount,
|
|
1258
|
+
geometryData.uv0s,
|
|
1259
|
+
geometryData["uv-region"]
|
|
1260
|
+
);
|
|
1261
|
+
}
|
|
1262
|
+
let featureIndex;
|
|
1263
|
+
if (defined_default(geometryData["feature-index"])) {
|
|
1264
|
+
featureIndex = geometryData["feature-index"];
|
|
1265
|
+
} else if (defined_default(geometryData["faceRange"])) {
|
|
1266
|
+
featureIndex = new Array(geometryData.vertexCount);
|
|
1267
|
+
for (let range = 0; range < geometryData["faceRange"].length - 1; range += 2) {
|
|
1268
|
+
const curIndex = range / 2;
|
|
1269
|
+
const rangeStart = geometryData["faceRange"][range];
|
|
1270
|
+
const rangeEnd = geometryData["faceRange"][range + 1];
|
|
1271
|
+
for (let i = rangeStart; i <= rangeEnd; i++) {
|
|
1272
|
+
featureIndex[i * 3] = curIndex;
|
|
1273
|
+
featureIndex[i * 3 + 1] = curIndex;
|
|
1274
|
+
featureIndex[i * 3 + 2] = curIndex;
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
if (parameters.calculateNormals) {
|
|
1279
|
+
const data = generateNormals(
|
|
1280
|
+
geometryData.vertexCount,
|
|
1281
|
+
geometryData.indices,
|
|
1282
|
+
geometryData.positions,
|
|
1283
|
+
geometryData.normals,
|
|
1284
|
+
geometryData.uv0s,
|
|
1285
|
+
geometryData.colors,
|
|
1286
|
+
featureIndex
|
|
1287
|
+
);
|
|
1288
|
+
if (defined_default(data.normals)) {
|
|
1289
|
+
geometryData.normals = data.normals;
|
|
1290
|
+
if (defined_default(data.vertexCount)) {
|
|
1291
|
+
geometryData.vertexCount = data.vertexCount;
|
|
1292
|
+
geometryData.indices = data.indices;
|
|
1293
|
+
geometryData.positions = data.positions;
|
|
1294
|
+
geometryData.uv0s = data.uv0s;
|
|
1295
|
+
geometryData.colors = data.colors;
|
|
1296
|
+
featureIndex = data.featureIndex;
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
const meshData = generateGltfBuffer(
|
|
1301
|
+
geometryData.vertexCount,
|
|
1302
|
+
geometryData.indices,
|
|
1303
|
+
geometryData.positions,
|
|
1304
|
+
geometryData.normals,
|
|
1305
|
+
geometryData.uv0s,
|
|
1306
|
+
geometryData.colors,
|
|
1307
|
+
featureIndex,
|
|
1308
|
+
parameters
|
|
1309
|
+
);
|
|
1310
|
+
const customAttributes = {
|
|
1311
|
+
positions: geometryData.positions,
|
|
1312
|
+
indices: geometryData.indices,
|
|
1313
|
+
featureIndex,
|
|
1314
|
+
sourceURL: parameters.url,
|
|
1315
|
+
cartesianCenter: parameters.cartesianCenter,
|
|
1316
|
+
parentRotation: parameters.parentRotation
|
|
1317
|
+
};
|
|
1318
|
+
meshData._customAttributes = customAttributes;
|
|
1319
|
+
const results = {
|
|
1320
|
+
meshData
|
|
1321
|
+
};
|
|
1322
|
+
return results;
|
|
1323
|
+
}
|
|
1324
|
+
async function initWorker(parameters, transferableObjects) {
|
|
1325
|
+
const wasmConfig = parameters.webAssemblyConfig;
|
|
1326
|
+
if (defined_default(wasmConfig) && defined_default(wasmConfig.wasmBinaryFile)) {
|
|
1327
|
+
draco = await (0, import_draco_decoder_nodejs.default)(wasmConfig);
|
|
1328
|
+
} else {
|
|
1329
|
+
draco = await (0, import_draco_decoder_nodejs.default)();
|
|
1330
|
+
}
|
|
1331
|
+
return true;
|
|
1332
|
+
}
|
|
1333
|
+
function decodeI3S(parameters, transferableObjects) {
|
|
1334
|
+
const wasmConfig = parameters.webAssemblyConfig;
|
|
1335
|
+
if (defined_default(wasmConfig)) {
|
|
1336
|
+
return initWorker(parameters, transferableObjects);
|
|
1337
|
+
}
|
|
1338
|
+
return decodeAndCreateGltf(parameters, transferableObjects);
|
|
1339
|
+
}
|
|
1340
|
+
var decodeI3S_default = createTaskProcessorWorker_default(decodeI3S);
|
|
1341
|
+
export {
|
|
1342
|
+
decodeI3S_default as default
|
|
1343
|
+
};
|