@cesium/engine 20.0.1 → 21.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Build/ThirdParty/Workers/zip-web-worker.js +637 -0
- package/Build/Workers/{chunk-7P7R7ERW.js → chunk-2T4WAVWX.js} +6 -6
- package/Build/Workers/{chunk-DNMSVJ4S.js → chunk-3G5XEUPY.js} +1 -1
- package/Build/Workers/{chunk-O7KDJVRH.js → chunk-3MSNTCHW.js} +9 -9
- package/Build/Workers/{chunk-7MCEUVPM.js → chunk-3OPG2FGI.js} +4 -4
- package/Build/Workers/{chunk-M4FSVD3C.js → chunk-3PUG3T2H.js} +12 -12
- package/Build/Workers/{chunk-CTU7LCVZ.js → chunk-4PH27XAL.js} +2 -2
- package/Build/Workers/{chunk-ZBLPNAYB.js → chunk-4VJYMLR6.js} +8 -8
- package/Build/Workers/{chunk-DAZVD3AH.js → chunk-5B3PGBQW.js} +11 -11
- package/Build/Workers/{chunk-UXIZVXIR.js → chunk-5GHCWGC4.js} +1 -1
- package/Build/Workers/{chunk-HZ22ZI3Q.js → chunk-5PEQUMCB.js} +12 -12
- package/Build/Workers/{chunk-HSVZWLJD.js → chunk-64WSG7AT.js} +4 -4
- package/Build/Workers/{chunk-ZJGO7T2S.js → chunk-6J6WGCWP.js} +4 -4
- package/Build/Workers/{chunk-OWV4L2GH.js → chunk-75B34CC6.js} +5 -5
- package/Build/Workers/{chunk-4MCKK5XE.js → chunk-7PLX65MV.js} +5 -5
- package/Build/Workers/{chunk-YVAOKOKX.js → chunk-AR2FUSG6.js} +1 -1
- package/Build/Workers/{chunk-JVNWWKXF.js → chunk-ARYRHDEB.js} +6 -6
- package/Build/Workers/{chunk-DAGWF5MM.js → chunk-B7INTBBB.js} +13 -13
- package/Build/Workers/{chunk-WNEY4A5P.js → chunk-BDPSQXLX.js} +5 -5
- package/Build/Workers/{chunk-LYKXQPGW.js → chunk-BU4CGMHO.js} +6 -6
- package/Build/Workers/{chunk-ECGKCTPM.js → chunk-BUBVUXDO.js} +6 -6
- package/Build/Workers/{chunk-LSYTMSIQ.js → chunk-CF72FAKC.js} +4 -4
- package/Build/Workers/{chunk-LZZA3PAR.js → chunk-DJ4ROETJ.js} +5 -5
- package/Build/Workers/{chunk-YNRRVRHO.js → chunk-E5XCZVIY.js} +1 -1
- package/Build/Workers/{chunk-RP4KKY2E.js → chunk-EAYW4CFP.js} +16 -16
- package/Build/Workers/{chunk-YW2UXIBU.js → chunk-EHFMZFVC.js} +4 -4
- package/Build/Workers/{chunk-HKHD5FDM.js → chunk-FFCKCQPK.js} +5 -5
- package/Build/Workers/{chunk-VQLQAENU.js → chunk-GKCZ2G36.js} +7 -7
- package/Build/Workers/{chunk-DJCPJJSP.js → chunk-HJ7IZBEI.js} +4 -4
- package/Build/Workers/{chunk-7FEVXX5D.js → chunk-JJZWDROM.js} +2 -2
- package/Build/Workers/{chunk-SLPWFCXZ.js → chunk-JUOEBO4F.js} +10 -10
- package/Build/Workers/{chunk-LHZKPI55.js → chunk-K4IDXMIZ.js} +9 -9
- package/Build/Workers/{chunk-D4VFVSGU.js → chunk-LL6HN3W4.js} +10 -10
- package/Build/Workers/{chunk-CZGSJ6ZG.js → chunk-LNTUIO55.js} +2 -2
- package/Build/Workers/{chunk-QFMJIXCL.js → chunk-LWOCFJEH.js} +9 -9
- package/Build/Workers/{chunk-2K5PKWLP.js → chunk-MMUISYW4.js} +16 -16
- package/Build/Workers/{chunk-IQKHPQNT.js → chunk-MXYW4BQ3.js} +2 -2
- package/Build/Workers/{chunk-XMIVNU5H.js → chunk-N6DVKXZD.js} +12 -12
- package/Build/Workers/{chunk-E2533KCN.js → chunk-NP46ZIBY.js} +3 -3
- package/Build/Workers/{chunk-O4DA3KRB.js → chunk-OW6F6CPZ.js} +7 -7
- package/Build/Workers/{chunk-QWHUQ4B7.js → chunk-P6OAOFBU.js} +8 -8
- package/Build/Workers/{chunk-4Z7AGRTU.js → chunk-PXDMWXO5.js} +2 -2
- package/Build/Workers/{chunk-WJ5THCIZ.js → chunk-QS7623NH.js} +6 -6
- package/Build/Workers/{chunk-OYFINQQA.js → chunk-ROH45IXJ.js} +7 -7
- package/Build/Workers/{chunk-2MEON5V4.js → chunk-S2P6LCIB.js} +4 -4
- package/Build/Workers/{chunk-JIXKGUWR.js → chunk-S4NZVXU6.js} +2 -2
- package/Build/Workers/{chunk-JHTZDMN6.js → chunk-SGGO5WVA.js} +5 -5
- package/Build/Workers/{chunk-UUXKGCBU.js → chunk-TG7N7TPY.js} +47 -50
- package/Build/Workers/{chunk-PFUF2QIK.js → chunk-TUZQG4RW.js} +14 -14
- package/Build/Workers/{chunk-LF74EILW.js → chunk-UHVE7V65.js} +12 -12
- package/Build/Workers/{chunk-L7PWWHKM.js → chunk-UY2HVPDL.js} +5 -5
- package/Build/Workers/{chunk-V65LOTF3.js → chunk-YNLPRFUQ.js} +6 -6
- package/Build/Workers/{chunk-RB3XS7EZ.js → chunk-ZYOHBCCE.js} +1 -1
- package/Build/Workers/combineGeometry.js +21 -21
- package/Build/Workers/createBoxGeometry.js +15 -15
- package/Build/Workers/createBoxOutlineGeometry.js +13 -13
- package/Build/Workers/createCircleGeometry.js +23 -23
- package/Build/Workers/createCircleOutlineGeometry.js +16 -16
- package/Build/Workers/createCoplanarPolygonGeometry.js +30 -30
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +28 -28
- package/Build/Workers/createCorridorGeometry.js +26 -26
- package/Build/Workers/createCorridorOutlineGeometry.js +25 -25
- package/Build/Workers/createCylinderGeometry.js +17 -17
- package/Build/Workers/createCylinderOutlineGeometry.js +15 -15
- package/Build/Workers/createEllipseGeometry.js +23 -23
- package/Build/Workers/createEllipseOutlineGeometry.js +16 -16
- package/Build/Workers/createEllipsoidGeometry.js +16 -16
- package/Build/Workers/createEllipsoidOutlineGeometry.js +15 -15
- package/Build/Workers/createFrustumGeometry.js +15 -15
- package/Build/Workers/createFrustumOutlineGeometry.js +15 -15
- package/Build/Workers/createGeometry.js +21 -21
- package/Build/Workers/createGroundPolylineGeometry.js +19 -19
- package/Build/Workers/createPlaneGeometry.js +13 -13
- package/Build/Workers/createPlaneOutlineGeometry.js +12 -12
- package/Build/Workers/createPolygonGeometry.js +29 -29
- package/Build/Workers/createPolygonOutlineGeometry.js +27 -27
- package/Build/Workers/createPolylineGeometry.js +22 -22
- package/Build/Workers/createPolylineVolumeGeometry.js +28 -28
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +24 -24
- package/Build/Workers/createRectangleGeometry.js +24 -24
- package/Build/Workers/createRectangleOutlineGeometry.js +17 -17
- package/Build/Workers/createSimplePolylineGeometry.js +20 -20
- package/Build/Workers/createSphereGeometry.js +16 -16
- package/Build/Workers/createSphereOutlineGeometry.js +15 -15
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +12 -12
- package/Build/Workers/createVectorTileGeometries.js +21 -21
- package/Build/Workers/createVectorTilePoints.js +11 -11
- package/Build/Workers/createVectorTilePolygons.js +19 -19
- package/Build/Workers/createVectorTilePolylines.js +12 -12
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +19 -19
- package/Build/Workers/createVerticesFromHeightmap.js +19 -19
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +16 -16
- package/Build/Workers/createWallGeometry.js +21 -21
- package/Build/Workers/createWallOutlineGeometry.js +20 -20
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +9 -9
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/transcodeKTX2.js +6 -6
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +19 -19
- package/Source/Core/Event.js +41 -49
- package/Source/Core/GoogleMaps.js +2 -2
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/IonResource.js +30 -4
- package/Source/Core/Resource.js +5 -1
- package/Source/DataSources/KmlDataSource.js +62 -63
- package/Source/DataSources/exportKml.js +27 -30
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Azure2DImageryProvider.js +308 -0
- package/Source/Scene/BatchTableHierarchy.js +2 -50
- package/Source/Scene/Billboard.js +4 -0
- package/Source/Scene/BillboardCollection.js +9 -2
- package/Source/Scene/ClippingPlaneCollection.js +3 -3
- package/Source/Scene/ClippingPolygon.js +91 -2
- package/Source/Scene/CreditDisplay.js +1 -1
- package/Source/Scene/GaussianSplat3DTileContent.js +54 -9
- package/Source/Scene/GaussianSplatPrimitive.js +49 -50
- package/Source/Scene/Google2DImageryProvider.js +614 -0
- package/Source/Scene/IonImageryProvider.js +22 -1
- package/Source/Scene/LabelCollection.js +1 -0
- package/Source/Scene/Material.js +248 -80
- package/Source/Scene/PntsParser.js +65 -0
- package/Source/Scene/Primitive.js +6 -0
- package/Source/Scene/PrimitiveState.js +123 -0
- package/Source/Scene/Scene.js +2 -2
- package/Source/Scene/VoxelBoundsCollection.js +494 -0
- package/Source/Scene/VoxelBoxShape.js +236 -101
- package/Source/Scene/VoxelCylinderShape.js +315 -204
- package/Source/Scene/VoxelEllipsoidShape.js +402 -119
- package/Source/Scene/VoxelPrimitive.js +119 -84
- package/Source/Scene/VoxelRenderResources.js +17 -10
- package/Source/Scene/VoxelShape.js +21 -6
- package/Source/Scene/buildVoxelDrawCommands.js +61 -20
- package/Source/Scene/createGooglePhotorealistic3DTileset.js +1 -1
- package/Source/Scene/getClippingFunction.js +79 -88
- package/Source/Shaders/BillboardCollectionVS.glsl +2 -0
- package/Source/Shaders/BillboardCollectionVS.js +2 -0
- package/Source/Shaders/Voxels/IntersectBox.glsl +20 -33
- package/Source/Shaders/Voxels/IntersectBox.js +20 -33
- package/Source/Shaders/Voxels/IntersectCylinder.glsl +28 -32
- package/Source/Shaders/Voxels/IntersectCylinder.js +28 -32
- package/Source/Shaders/Voxels/IntersectDepth.glsl +1 -4
- package/Source/Shaders/Voxels/IntersectDepth.js +1 -4
- package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +12 -20
- package/Source/Shaders/Voxels/IntersectEllipsoid.js +12 -20
- package/Source/Shaders/Voxels/IntersectLongitude.glsl +21 -9
- package/Source/Shaders/Voxels/IntersectLongitude.js +21 -9
- package/Source/Shaders/Voxels/{IntersectClippingPlanes.glsl → IntersectPlane.glsl} +5 -3
- package/Source/Shaders/Voxels/{IntersectClippingPlanes.js → IntersectPlane.js} +5 -3
- package/Source/Shaders/Voxels/Intersection.glsl +3 -3
- package/Source/Shaders/Voxels/Intersection.js +3 -3
- package/Source/Shaders/Voxels/Octree.glsl +46 -51
- package/Source/Shaders/Voxels/Octree.js +46 -51
- package/Source/Shaders/Voxels/VoxelFS.glsl +50 -48
- package/Source/Shaders/Voxels/VoxelFS.js +50 -48
- package/Source/Shaders/Voxels/VoxelUtils.glsl +0 -19
- package/Source/Shaders/Voxels/VoxelUtils.js +0 -19
- package/Source/Shaders/Voxels/convertLocalToBoxUv.glsl +30 -0
- package/Source/Shaders/Voxels/convertLocalToBoxUv.js +32 -0
- package/Source/Shaders/Voxels/convertLocalToCylinderUv.glsl +97 -0
- package/Source/Shaders/Voxels/convertLocalToCylinderUv.js +99 -0
- package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.glsl +193 -0
- package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.js +195 -0
- package/Source/ThirdParty/Workers/zip-web-worker.js +1 -0
- package/Source/ThirdParty/zip-module.wasm +0 -0
- package/index.d.ts +340 -14
- package/index.js +116 -114
- package/package.json +2 -2
- package/Build/ThirdParty/Workers/pako_deflate.min.js +0 -503
- package/Build/ThirdParty/Workers/pako_inflate.min.js +0 -698
- package/Build/ThirdParty/Workers/z-worker-pako.js +0 -601
- package/Source/Core/defaultValue.js +0 -48
- package/Source/Shaders/Voxels/convertUvToBox.glsl +0 -45
- package/Source/Shaders/Voxels/convertUvToBox.js +0 -46
- package/Source/Shaders/Voxels/convertUvToCylinder.glsl +0 -99
- package/Source/Shaders/Voxels/convertUvToCylinder.js +0 -101
- package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +0 -139
- package/Source/Shaders/Voxels/convertUvToEllipsoid.js +0 -141
- package/Source/ThirdParty/Workers/pako_deflate.min.js +0 -2
- package/Source/ThirdParty/Workers/pako_inflate.min.js +0 -2
- package/Source/ThirdParty/Workers/z-worker-pako.js +0 -1
|
@@ -42,7 +42,13 @@ import LabelStyle from "../Scene/LabelStyle.js";
|
|
|
42
42
|
import SceneMode from "../Scene/SceneMode.js";
|
|
43
43
|
import Autolinker from "autolinker";
|
|
44
44
|
import Uri from "urijs";
|
|
45
|
-
import
|
|
45
|
+
import {
|
|
46
|
+
configure,
|
|
47
|
+
BlobReader,
|
|
48
|
+
Data64URIWriter,
|
|
49
|
+
TextWriter,
|
|
50
|
+
ZipReader,
|
|
51
|
+
} from "@zip.js/zip.js/lib/zip-core.js";
|
|
46
52
|
import getElement from "./getElement.js";
|
|
47
53
|
import BillboardGraphics from "./BillboardGraphics.js";
|
|
48
54
|
import CompositePositionProperty from "./CompositePositionProperty.js";
|
|
@@ -390,24 +396,18 @@ function removeDuplicateNamespaces(text) {
|
|
|
390
396
|
return text;
|
|
391
397
|
}
|
|
392
398
|
|
|
393
|
-
function loadXmlFromZip(entry, uriResolver) {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
uriResolver.kml = parser.parseFromString(text, "application/xml");
|
|
399
|
-
},
|
|
400
|
-
);
|
|
399
|
+
async function loadXmlFromZip(entry, uriResolver) {
|
|
400
|
+
let text = await entry.getData(new TextWriter());
|
|
401
|
+
text = insertNamespaces(text);
|
|
402
|
+
text = removeDuplicateNamespaces(text);
|
|
403
|
+
uriResolver.kml = parser.parseFromString(text, "application/xml");
|
|
401
404
|
}
|
|
402
405
|
|
|
403
|
-
function loadDataUriFromZip(entry, uriResolver) {
|
|
406
|
+
async function loadDataUriFromZip(entry, uriResolver) {
|
|
404
407
|
const mimeType =
|
|
405
408
|
MimeTypes.detectFromFilename(entry.filename) ?? "application/octet-stream";
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
uriResolver[entry.filename] = dataUri;
|
|
409
|
-
},
|
|
410
|
-
);
|
|
409
|
+
const dataUri = await entry.getData(new Data64URIWriter(mimeType));
|
|
410
|
+
uriResolver[entry.filename] = dataUri;
|
|
411
411
|
}
|
|
412
412
|
|
|
413
413
|
function embedDataUris(div, elementType, attributeName, uriResolver) {
|
|
@@ -3287,69 +3287,68 @@ function loadKml(
|
|
|
3287
3287
|
});
|
|
3288
3288
|
}
|
|
3289
3289
|
|
|
3290
|
-
function loadKmz(
|
|
3290
|
+
async function loadKmz(
|
|
3291
3291
|
dataSource,
|
|
3292
3292
|
entityCollection,
|
|
3293
3293
|
blob,
|
|
3294
3294
|
sourceResource,
|
|
3295
3295
|
screenOverlayContainer,
|
|
3296
3296
|
) {
|
|
3297
|
-
const
|
|
3298
|
-
zip.
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
},
|
|
3297
|
+
const zWorkerUri = buildModuleUrl("ThirdParty/Workers/zip-web-worker.js");
|
|
3298
|
+
const zWasmUri = buildModuleUrl("ThirdParty/zip-module.wasm");
|
|
3299
|
+
configure({
|
|
3300
|
+
workerURI: zWorkerUri,
|
|
3301
|
+
wasmURI: zWasmUri,
|
|
3303
3302
|
});
|
|
3304
3303
|
|
|
3305
|
-
const reader = new
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
docEntry = entry;
|
|
3323
|
-
} else {
|
|
3324
|
-
// Wasn't the first kml and wasn't at the root
|
|
3325
|
-
promises.push(loadDataUriFromZip(entry, uriResolver));
|
|
3304
|
+
const reader = new ZipReader(new BlobReader(blob));
|
|
3305
|
+
const entries = await reader.getEntries();
|
|
3306
|
+
|
|
3307
|
+
const promises = [];
|
|
3308
|
+
const uriResolver = {};
|
|
3309
|
+
let docEntry;
|
|
3310
|
+
for (let i = 0; i < entries.length; i++) {
|
|
3311
|
+
const entry = entries[i];
|
|
3312
|
+
if (!entry.directory) {
|
|
3313
|
+
if (/\.kml$/i.test(entry.filename)) {
|
|
3314
|
+
// We use the first KML document we come across
|
|
3315
|
+
// https://developers.google.com/kml/documentation/kmzarchives
|
|
3316
|
+
// Unless we come across a .kml file at the root of the archive because GE does this
|
|
3317
|
+
if (!defined(docEntry) || !/\//i.test(entry.filename)) {
|
|
3318
|
+
if (defined(docEntry)) {
|
|
3319
|
+
// We found one at the root so load the initial kml as a data uri
|
|
3320
|
+
promises.push(loadDataUriFromZip(docEntry, uriResolver));
|
|
3326
3321
|
}
|
|
3322
|
+
docEntry = entry;
|
|
3327
3323
|
} else {
|
|
3324
|
+
// Wasn't the first kml and wasn't at the root
|
|
3328
3325
|
promises.push(loadDataUriFromZip(entry, uriResolver));
|
|
3329
3326
|
}
|
|
3327
|
+
} else {
|
|
3328
|
+
promises.push(loadDataUriFromZip(entry, uriResolver));
|
|
3330
3329
|
}
|
|
3331
3330
|
}
|
|
3331
|
+
}
|
|
3332
3332
|
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
});
|
|
3333
|
+
// Now load the root KML document
|
|
3334
|
+
if (defined(docEntry)) {
|
|
3335
|
+
promises.push(loadXmlFromZip(docEntry, uriResolver));
|
|
3336
|
+
}
|
|
3337
|
+
await Promise.all(promises);
|
|
3338
|
+
reader.close();
|
|
3339
|
+
if (!defined(uriResolver.kml)) {
|
|
3340
|
+
throw new RuntimeError("KMZ file does not contain a KML document.");
|
|
3341
|
+
}
|
|
3342
|
+
uriResolver.keys = Object.keys(uriResolver);
|
|
3343
|
+
|
|
3344
|
+
return loadKml(
|
|
3345
|
+
dataSource,
|
|
3346
|
+
entityCollection,
|
|
3347
|
+
uriResolver.kml,
|
|
3348
|
+
sourceResource,
|
|
3349
|
+
uriResolver,
|
|
3350
|
+
screenOverlayContainer,
|
|
3351
|
+
);
|
|
3353
3352
|
}
|
|
3354
3353
|
|
|
3355
3354
|
function load(dataSource, entityCollection, data, options) {
|
|
@@ -20,7 +20,13 @@ import TimeIntervalCollection from "../Core/TimeIntervalCollection.js";
|
|
|
20
20
|
import HeightReference from "../Scene/HeightReference.js";
|
|
21
21
|
import HorizontalOrigin from "../Scene/HorizontalOrigin.js";
|
|
22
22
|
import VerticalOrigin from "../Scene/VerticalOrigin.js";
|
|
23
|
-
import
|
|
23
|
+
import {
|
|
24
|
+
configure,
|
|
25
|
+
BlobReader,
|
|
26
|
+
BlobWriter,
|
|
27
|
+
TextReader,
|
|
28
|
+
ZipWriter,
|
|
29
|
+
} from "@zip.js/zip.js/lib/zip-core.js";
|
|
24
30
|
import BillboardGraphics from "./BillboardGraphics.js";
|
|
25
31
|
import CompositePositionProperty from "./CompositePositionProperty.js";
|
|
26
32
|
import ModelGraphics from "./ModelGraphics.js";
|
|
@@ -322,43 +328,34 @@ function exportKml(options) {
|
|
|
322
328
|
});
|
|
323
329
|
}
|
|
324
330
|
|
|
325
|
-
function createKmz(kmlString, externalFiles) {
|
|
326
|
-
const
|
|
327
|
-
zip.
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
},
|
|
331
|
+
async function createKmz(kmlString, externalFiles) {
|
|
332
|
+
const zWorkerUri = buildModuleUrl("ThirdParty/Workers/zip-web-worker.js");
|
|
333
|
+
const zWasmUri = buildModuleUrl("ThirdParty/zip-module.wasm");
|
|
334
|
+
configure({
|
|
335
|
+
workerURI: zWorkerUri,
|
|
336
|
+
wasmURI: zWasmUri,
|
|
332
337
|
});
|
|
333
|
-
const blobWriter = new
|
|
334
|
-
const writer = new
|
|
338
|
+
const blobWriter = new BlobWriter("application/vnd.google-earth.kmz");
|
|
339
|
+
const writer = new ZipWriter(blobWriter);
|
|
340
|
+
|
|
335
341
|
// We need to only write one file at a time so the zip doesn't get corrupted
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
})
|
|
345
|
-
.then(function (blob) {
|
|
346
|
-
return {
|
|
347
|
-
kmz: blob,
|
|
348
|
-
};
|
|
349
|
-
});
|
|
342
|
+
await writer.add("doc.kml", new TextReader(kmlString));
|
|
343
|
+
const keys = Object.keys(externalFiles);
|
|
344
|
+
await addExternalFilesToZip(writer, keys, externalFiles, 0);
|
|
345
|
+
await writer.close();
|
|
346
|
+
const blob = await blobWriter.getData();
|
|
347
|
+
return {
|
|
348
|
+
kmz: blob,
|
|
349
|
+
};
|
|
350
350
|
}
|
|
351
351
|
|
|
352
|
-
function addExternalFilesToZip(writer, keys, externalFiles, index) {
|
|
352
|
+
async function addExternalFilesToZip(writer, keys, externalFiles, index) {
|
|
353
353
|
if (keys.length === index) {
|
|
354
354
|
return;
|
|
355
355
|
}
|
|
356
356
|
const filename = keys[index];
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
.then(function () {
|
|
360
|
-
return addExternalFilesToZip(writer, keys, externalFiles, index + 1);
|
|
361
|
-
});
|
|
357
|
+
await writer.add(filename, new BlobReader(externalFiles[filename]));
|
|
358
|
+
return addExternalFilesToZip(writer, keys, externalFiles, index + 1);
|
|
362
359
|
}
|
|
363
360
|
|
|
364
361
|
exportKml._createState = function (options) {
|
|
@@ -4,7 +4,7 @@ import Resource from "../Core/Resource.js";
|
|
|
4
4
|
|
|
5
5
|
let defaultTokenCredit;
|
|
6
6
|
const defaultAccessToken =
|
|
7
|
-
"
|
|
7
|
+
"AAPTxy8BH1VEsoebNVZXo8HurEOF051kAEKlhkOhBEc9BmQqEeLjCLZBBnNm_y_K-Cs-tuPcsgUmlxDWvPdTmGIEhrihfZMTG77j2nmCeqeYCPAenHGG1YfJqJaeRLuy5YjARJcFLP2I_judomiDS-8A_LVZxWUObwIQNE5wcsQKxJl7RHiKm-81XRDuUJZXGqy9B4PwPxWkS-N9PZ7NmTT-sP6BOGn5ouiAN8dkxwNx3tA.AT1_BU0Co4D8";
|
|
8
8
|
/**
|
|
9
9
|
* Default options for accessing the ArcGIS image tile service.
|
|
10
10
|
*
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import Check from "../Core/Check.js";
|
|
2
|
+
import Credit from "../Core/Credit.js";
|
|
3
|
+
import defined from "../Core/defined.js";
|
|
4
|
+
import Resource from "../Core/Resource.js";
|
|
5
|
+
import IonResource from "../Core/IonResource.js";
|
|
6
|
+
import UrlTemplateImageryProvider from "./UrlTemplateImageryProvider.js";
|
|
7
|
+
|
|
8
|
+
const trailingSlashRegex = /\/$/;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @typedef {object} Azure2DImageryProvider.ConstructorOptions
|
|
12
|
+
*
|
|
13
|
+
* Initialization options for the Azure2DImageryProvider constructor
|
|
14
|
+
*
|
|
15
|
+
* @property {object} options Object with the following properties:
|
|
16
|
+
* @property {string} [options.url="https://atlas.microsoft.com/"] The Azure server url.
|
|
17
|
+
* @property {string} [options.tilesetId="microsoft.imagery"] The Azure tileset ID. Valid options are {@link microsoft.imagery}, {@link microsoft.base.road}, and {@link microsoft.base.labels.road}
|
|
18
|
+
* @property {string} options.subscriptionKey The public subscription key for the imagery.
|
|
19
|
+
* @property {Ellipsoid} [options.ellipsoid=Ellipsoid.default] The ellipsoid. If not specified, the default ellipsoid is used.
|
|
20
|
+
* @property {number} [options.minimumLevel=0] The minimum level-of-detail supported by the imagery provider. Take care when specifying
|
|
21
|
+
* this that the number of tiles at the minimum level is small, such as four or less. A larger number is likely
|
|
22
|
+
* to result in rendering problems.
|
|
23
|
+
* @property {number} [options.maximumLevel=22] The maximum level-of-detail supported by the imagery provider.
|
|
24
|
+
* @property {Rectangle} [options.rectangle=Rectangle.MAX_VALUE] The rectangle, in radians, covered by the image.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Provides 2D image tiles from Azure.
|
|
29
|
+
*
|
|
30
|
+
* @alias Azure2DImageryProvider
|
|
31
|
+
* @constructor
|
|
32
|
+
* @private
|
|
33
|
+
* @param {Azure2DImageryProvider.ConstructorOptions} options Object describing initialization options
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* // Azure 2D imagery provider
|
|
37
|
+
* const azureImageryProvider = new Cesium.Azure2DImageryProvider({
|
|
38
|
+
* subscriptionKey: "subscription-key",
|
|
39
|
+
* tilesetId: "microsoft.base.road"
|
|
40
|
+
* });
|
|
41
|
+
*/
|
|
42
|
+
function Azure2DImageryProvider(options) {
|
|
43
|
+
options = options ?? {};
|
|
44
|
+
options.maximumLevel = options.maximumLevel ?? 22;
|
|
45
|
+
options.minimumLevel = options.minimumLevel ?? 0;
|
|
46
|
+
|
|
47
|
+
const subscriptionKey =
|
|
48
|
+
options.subscriptionKey ?? options["subscription-key"];
|
|
49
|
+
//>>includeStart('debug', pragmas.debug);
|
|
50
|
+
Check.defined("options.tilesetId", options.tilesetId);
|
|
51
|
+
Check.defined("options.subscriptionKey", subscriptionKey);
|
|
52
|
+
//>>includeEnd('debug');
|
|
53
|
+
|
|
54
|
+
const resource =
|
|
55
|
+
options.url instanceof IonResource
|
|
56
|
+
? options.url
|
|
57
|
+
: Resource.createIfNeeded(options.url ?? "https://atlas.microsoft.com/");
|
|
58
|
+
|
|
59
|
+
let templateUrl = resource.getUrlComponent();
|
|
60
|
+
if (!trailingSlashRegex.test(templateUrl)) {
|
|
61
|
+
templateUrl += "/";
|
|
62
|
+
}
|
|
63
|
+
templateUrl += `map/tile`;
|
|
64
|
+
|
|
65
|
+
resource.url = templateUrl;
|
|
66
|
+
|
|
67
|
+
resource.setQueryParameters({
|
|
68
|
+
"api-version": "2024-04-01",
|
|
69
|
+
tilesetId: options.tilesetId,
|
|
70
|
+
zoom: `{z}`,
|
|
71
|
+
x: `{x}`,
|
|
72
|
+
y: `{y}`,
|
|
73
|
+
"subscription-key": subscriptionKey,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
let credit;
|
|
77
|
+
if (defined(options.credit)) {
|
|
78
|
+
credit = options.credit;
|
|
79
|
+
if (typeof credit === "string") {
|
|
80
|
+
credit = new Credit(credit);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const provider = new UrlTemplateImageryProvider({
|
|
85
|
+
...options,
|
|
86
|
+
url: resource,
|
|
87
|
+
credit: credit,
|
|
88
|
+
});
|
|
89
|
+
provider._resource = resource;
|
|
90
|
+
this._imageryProvider = provider;
|
|
91
|
+
|
|
92
|
+
// This will be defined for ion resources
|
|
93
|
+
this._tileCredits = resource.credits;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
Object.defineProperties(Azure2DImageryProvider.prototype, {
|
|
97
|
+
/**
|
|
98
|
+
* Gets the URL of the Azure 2D Imagery server.
|
|
99
|
+
* @memberof Azure2DImageryProvider.prototype
|
|
100
|
+
* @type {string}
|
|
101
|
+
* @readonly
|
|
102
|
+
*/
|
|
103
|
+
url: {
|
|
104
|
+
get: function () {
|
|
105
|
+
return this._imageryProvider.url;
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Gets the rectangle, in radians, of the imagery provided by the instance.
|
|
111
|
+
* @memberof Azure2DImageryProvider.prototype
|
|
112
|
+
* @type {Rectangle}
|
|
113
|
+
* @readonly
|
|
114
|
+
*/
|
|
115
|
+
rectangle: {
|
|
116
|
+
get: function () {
|
|
117
|
+
return this._imageryProvider.rectangle;
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Gets the width of each tile, in pixels.
|
|
123
|
+
* @memberof Azure2DImageryProvider.prototype
|
|
124
|
+
* @type {number}
|
|
125
|
+
* @readonly
|
|
126
|
+
*/
|
|
127
|
+
tileWidth: {
|
|
128
|
+
get: function () {
|
|
129
|
+
return this._imageryProvider.tileWidth;
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Gets the height of each tile, in pixels.
|
|
135
|
+
* @memberof Azure2DImageryProvider.prototype
|
|
136
|
+
* @type {number}
|
|
137
|
+
* @readonly
|
|
138
|
+
*/
|
|
139
|
+
tileHeight: {
|
|
140
|
+
get: function () {
|
|
141
|
+
return this._imageryProvider.tileHeight;
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Gets the maximum level-of-detail that can be requested.
|
|
147
|
+
* @memberof Azure2DImageryProvider.prototype
|
|
148
|
+
* @type {number|undefined}
|
|
149
|
+
* @readonly
|
|
150
|
+
*/
|
|
151
|
+
maximumLevel: {
|
|
152
|
+
get: function () {
|
|
153
|
+
return this._imageryProvider.maximumLevel;
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Gets the minimum level-of-detail that can be requested. Generally,
|
|
159
|
+
* a minimum level should only be used when the rectangle of the imagery is small
|
|
160
|
+
* enough that the number of tiles at the minimum level is small. An imagery
|
|
161
|
+
* provider with more than a few tiles at the minimum level will lead to
|
|
162
|
+
* rendering problems.
|
|
163
|
+
* @memberof Azure2DImageryProvider.prototype
|
|
164
|
+
* @type {number}
|
|
165
|
+
* @readonly
|
|
166
|
+
*/
|
|
167
|
+
minimumLevel: {
|
|
168
|
+
get: function () {
|
|
169
|
+
return this._imageryProvider.minimumLevel;
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Gets the tiling scheme used by the provider.
|
|
175
|
+
* @memberof Azure2DImageryProvider.prototype
|
|
176
|
+
* @type {TilingScheme}
|
|
177
|
+
* @readonly
|
|
178
|
+
*/
|
|
179
|
+
tilingScheme: {
|
|
180
|
+
get: function () {
|
|
181
|
+
return this._imageryProvider.tilingScheme;
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Gets the tile discard policy. If not undefined, the discard policy is responsible
|
|
187
|
+
* for filtering out "missing" tiles via its shouldDiscardImage function. If this function
|
|
188
|
+
* returns undefined, no tiles are filtered.
|
|
189
|
+
* @memberof Azure2DImageryProvider.prototype
|
|
190
|
+
* @type {TileDiscardPolicy}
|
|
191
|
+
* @readonly
|
|
192
|
+
*/
|
|
193
|
+
tileDiscardPolicy: {
|
|
194
|
+
get: function () {
|
|
195
|
+
return this._imageryProvider.tileDiscardPolicy;
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Gets an event that is raised when the imagery provider encounters an asynchronous error.. By subscribing
|
|
201
|
+
* to the event, you will be notified of the error and can potentially recover from it. Event listeners
|
|
202
|
+
* are passed an instance of {@link TileProviderError}.
|
|
203
|
+
* @memberof Azure2DImageryProvider.prototype
|
|
204
|
+
* @type {Event}
|
|
205
|
+
* @readonly
|
|
206
|
+
*/
|
|
207
|
+
errorEvent: {
|
|
208
|
+
get: function () {
|
|
209
|
+
return this._imageryProvider.errorEvent;
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Gets the credit to display when this imagery provider is active. Typically this is used to credit
|
|
215
|
+
* the source of the imagery.
|
|
216
|
+
* @memberof Azure2DImageryProvider.prototype
|
|
217
|
+
* @type {Credit}
|
|
218
|
+
* @readonly
|
|
219
|
+
*/
|
|
220
|
+
credit: {
|
|
221
|
+
get: function () {
|
|
222
|
+
return this._imageryProvider.credit;
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Gets the proxy used by this provider.
|
|
228
|
+
* @memberof Azure2DImageryProvider.prototype
|
|
229
|
+
* @type {Proxy}
|
|
230
|
+
* @readonly
|
|
231
|
+
*/
|
|
232
|
+
proxy: {
|
|
233
|
+
get: function () {
|
|
234
|
+
return this._imageryProvider.proxy;
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Gets a value indicating whether or not the images provided by this imagery provider
|
|
240
|
+
* include an alpha channel. If this property is false, an alpha channel, if present, will
|
|
241
|
+
* be ignored. If this property is true, any images without an alpha channel will be treated
|
|
242
|
+
* as if their alpha is 1.0 everywhere. When this property is false, memory usage
|
|
243
|
+
* and texture upload time are reduced.
|
|
244
|
+
* @memberof Azure2DImageryProvider.prototype
|
|
245
|
+
* @type {boolean}
|
|
246
|
+
* @readonly
|
|
247
|
+
*/
|
|
248
|
+
hasAlphaChannel: {
|
|
249
|
+
get: function () {
|
|
250
|
+
return this._imageryProvider.hasAlphaChannel;
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Gets the credits to be displayed when a given tile is displayed.
|
|
257
|
+
*
|
|
258
|
+
* @param {number} x The tile X coordinate.
|
|
259
|
+
* @param {number} y The tile Y coordinate.
|
|
260
|
+
* @param {number} level The tile level;
|
|
261
|
+
* @returns {Credit[]|undefined} The credits to be displayed when the tile is displayed.
|
|
262
|
+
*/
|
|
263
|
+
Azure2DImageryProvider.prototype.getTileCredits = function (x, y, level) {
|
|
264
|
+
return this._imageryProvider.getTileCredits(x, y, level);
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Requests the image for a given tile.
|
|
269
|
+
*
|
|
270
|
+
* @param {number} x The tile X coordinate.
|
|
271
|
+
* @param {number} y The tile Y coordinate.
|
|
272
|
+
* @param {number} level The tile level.
|
|
273
|
+
* @param {Request} [request] The request object. Intended for internal use only.
|
|
274
|
+
* @returns {Promise<ImageryTypes>|undefined} A promise for the image that will resolve when the image is available, or
|
|
275
|
+
* undefined if there are too many active requests to the server, and the request should be retried later.
|
|
276
|
+
*/
|
|
277
|
+
Azure2DImageryProvider.prototype.requestImage = function (
|
|
278
|
+
x,
|
|
279
|
+
y,
|
|
280
|
+
level,
|
|
281
|
+
request,
|
|
282
|
+
) {
|
|
283
|
+
return this._imageryProvider.requestImage(x, y, level, request);
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Picking features is not currently supported by this imagery provider, so this function simply returns
|
|
288
|
+
* undefined.
|
|
289
|
+
*
|
|
290
|
+
* @param {number} x The tile X coordinate.
|
|
291
|
+
* @param {number} y The tile Y coordinate.
|
|
292
|
+
* @param {number} level The tile level.
|
|
293
|
+
* @param {number} longitude The longitude at which to pick features.
|
|
294
|
+
* @param {number} latitude The latitude at which to pick features.
|
|
295
|
+
* @return {undefined} Undefined since picking is not supported.
|
|
296
|
+
*/
|
|
297
|
+
Azure2DImageryProvider.prototype.pickFeatures = function (
|
|
298
|
+
x,
|
|
299
|
+
y,
|
|
300
|
+
level,
|
|
301
|
+
longitude,
|
|
302
|
+
latitude,
|
|
303
|
+
) {
|
|
304
|
+
return undefined;
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
// Exposed for tests
|
|
308
|
+
export default Azure2DImageryProvider;
|
|
@@ -6,7 +6,7 @@ import ComponentDatatype from "../Core/ComponentDatatype.js";
|
|
|
6
6
|
import defined from "../Core/defined.js";
|
|
7
7
|
import DeveloperError from "../Core/DeveloperError.js";
|
|
8
8
|
import getBinaryAccessor from "./getBinaryAccessor.js";
|
|
9
|
-
import
|
|
9
|
+
import Cesium3DTileBatchTable from "./Cesium3DTileBatchTable.js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Object for handling the <code>3DTILES_batch_table_hierarchy</code> extension
|
|
@@ -127,7 +127,7 @@ function initialize(hierarchy, hierarchyJson, binaryBody) {
|
|
|
127
127
|
for (i = 0; i < classesLength; ++i) {
|
|
128
128
|
const classInstancesLength = classes[i].length;
|
|
129
129
|
const properties = classes[i].instances;
|
|
130
|
-
const binaryProperties = getBinaryProperties(
|
|
130
|
+
const binaryProperties = Cesium3DTileBatchTable.getBinaryProperties(
|
|
131
131
|
classInstancesLength,
|
|
132
132
|
properties,
|
|
133
133
|
binaryBody,
|
|
@@ -154,54 +154,6 @@ function initialize(hierarchy, hierarchyJson, binaryBody) {
|
|
|
154
154
|
hierarchy._byteLength = byteLength;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
function getBinaryProperties(featuresLength, properties, binaryBody) {
|
|
158
|
-
let binaryProperties;
|
|
159
|
-
for (const name in properties) {
|
|
160
|
-
if (properties.hasOwnProperty(name)) {
|
|
161
|
-
const property = properties[name];
|
|
162
|
-
const byteOffset = property.byteOffset;
|
|
163
|
-
if (defined(byteOffset)) {
|
|
164
|
-
// This is a binary property
|
|
165
|
-
const componentType = property.componentType;
|
|
166
|
-
const type = property.type;
|
|
167
|
-
if (!defined(componentType)) {
|
|
168
|
-
throw new RuntimeError("componentType is required.");
|
|
169
|
-
}
|
|
170
|
-
if (!defined(type)) {
|
|
171
|
-
throw new RuntimeError("type is required.");
|
|
172
|
-
}
|
|
173
|
-
if (!defined(binaryBody)) {
|
|
174
|
-
throw new RuntimeError(
|
|
175
|
-
`Property ${name} requires a batch table binary.`,
|
|
176
|
-
);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
const binaryAccessor = getBinaryAccessor(property);
|
|
180
|
-
const componentCount = binaryAccessor.componentsPerAttribute;
|
|
181
|
-
const classType = binaryAccessor.classType;
|
|
182
|
-
const typedArray = binaryAccessor.createArrayBufferView(
|
|
183
|
-
binaryBody.buffer,
|
|
184
|
-
binaryBody.byteOffset + byteOffset,
|
|
185
|
-
featuresLength,
|
|
186
|
-
);
|
|
187
|
-
|
|
188
|
-
if (!defined(binaryProperties)) {
|
|
189
|
-
binaryProperties = {};
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
// Store any information needed to access the binary data, including the typed array,
|
|
193
|
-
// componentCount (e.g. a VEC4 would be 4), and the type used to pack and unpack (e.g. Cartesian4).
|
|
194
|
-
binaryProperties[name] = {
|
|
195
|
-
typedArray: typedArray,
|
|
196
|
-
componentCount: componentCount,
|
|
197
|
-
type: classType,
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
return binaryProperties;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
157
|
function countBinaryPropertyMemory(binaryProperties) {
|
|
206
158
|
let byteLength = 0;
|
|
207
159
|
for (const name in binaryProperties) {
|
|
@@ -227,6 +227,9 @@ function Billboard(options, billboardCollection) {
|
|
|
227
227
|
this._updateClamping();
|
|
228
228
|
|
|
229
229
|
this._splitDirection = options.splitDirection ?? SplitDirection.NONE;
|
|
230
|
+
// Primarily used by labels to indicate that the position is derived from the parent.
|
|
231
|
+
// and expensive operations like clamping can be skipped.
|
|
232
|
+
this._positionFromParent = false;
|
|
230
233
|
}
|
|
231
234
|
|
|
232
235
|
const SHOW_INDEX = (Billboard.SHOW_INDEX = 0);
|
|
@@ -1147,6 +1150,7 @@ Billboard._updateClamping = function (collection, owner) {
|
|
|
1147
1150
|
|
|
1148
1151
|
if (
|
|
1149
1152
|
owner._heightReference === HeightReference.NONE ||
|
|
1153
|
+
owner._positionFromParent ||
|
|
1150
1154
|
!defined(owner._position)
|
|
1151
1155
|
) {
|
|
1152
1156
|
return;
|
|
@@ -1020,13 +1020,20 @@ function writeCompressedAttrib0(
|
|
|
1020
1020
|
Math.floor(
|
|
1021
1021
|
CesiumMath.clamp(pixelOffsetY, -UPPER_BOUND, UPPER_BOUND) + UPPER_BOUND,
|
|
1022
1022
|
) * LEFT_SHIFT8;
|
|
1023
|
+
|
|
1024
|
+
// We scale `translate` by LEFT_SHIFT2 before encoding it (and unscale after decoding in the shader)
|
|
1025
|
+
// to preserve some subpixel precision (1 / 4 = 0.25 pixels). This mitigates rounding errors in aligning glyphs.
|
|
1026
|
+
// The cost of increasing this scaling factor is that it decreases the range of representable `translate` values
|
|
1027
|
+
// by the same scaling factor. Value must be kept in sync with the shader.
|
|
1023
1028
|
let compressed2 =
|
|
1024
1029
|
Math.floor(
|
|
1025
|
-
CesiumMath.clamp(translateX, -UPPER_BOUND, UPPER_BOUND) +
|
|
1030
|
+
CesiumMath.clamp(translateX * LEFT_SHIFT2, -UPPER_BOUND, UPPER_BOUND) +
|
|
1031
|
+
UPPER_BOUND,
|
|
1026
1032
|
) * LEFT_SHIFT8;
|
|
1027
1033
|
|
|
1028
1034
|
const tempTanslateY =
|
|
1029
|
-
(CesiumMath.clamp(translateY, -UPPER_BOUND, UPPER_BOUND) +
|
|
1035
|
+
(CesiumMath.clamp(translateY * LEFT_SHIFT2, -UPPER_BOUND, UPPER_BOUND) +
|
|
1036
|
+
UPPER_BOUND) *
|
|
1030
1037
|
RIGHT_SHIFT8;
|
|
1031
1038
|
const upperTranslateY = Math.floor(tempTanslateY);
|
|
1032
1039
|
const lowerTranslateY = Math.floor(
|