@cesium/engine 21.0.1-ion.0 → 22.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Build/Workers/{chunk-LSNF6CIP.js → chunk-2D3GLFZD.js} +12 -12
- package/Build/Workers/chunk-34YXP222.js +352 -0
- package/Build/Workers/{chunk-OLH67Z2S.js → chunk-3GL53OCU.js} +17 -18
- package/Build/Workers/{chunk-WIPOMPA5.js → chunk-5B7VZQZY.js} +6 -6
- package/Build/Workers/{chunk-NWJRIJQG.js → chunk-5T5SY63I.js} +2 -2
- package/Build/Workers/{chunk-DTYIUWZU.js → chunk-5ZF53EY6.js} +4 -4
- package/Build/Workers/{chunk-UTTKH2UG.js → chunk-6HBKE43B.js} +7 -7
- package/Build/Workers/{chunk-ZTGZMKAB.js → chunk-726NINF5.js} +16 -16
- package/Build/Workers/{chunk-L73TRTIG.js → chunk-75HAJIDT.js} +1 -1
- package/Build/Workers/{chunk-G5RX7BPJ.js → chunk-7KAXDKRU.js} +10 -10
- package/Build/Workers/chunk-7XEJGXX2.js +2759 -0
- package/Build/Workers/{chunk-ZOVMWDPW.js → chunk-A4DPJIWS.js} +18 -10
- package/Build/Workers/{chunk-UTL4WVC3.js → chunk-A6JAFSZT.js} +5 -5
- package/Build/Workers/{chunk-E6T4LSM6.js → chunk-AARZSH4V.js} +5 -5
- package/Build/Workers/{chunk-EEDSGIH7.js → chunk-AOM3FHBN.js} +6 -6
- package/Build/Workers/{chunk-WJV24LAS.js → chunk-BJSNGGBM.js} +4 -4
- package/Build/Workers/{chunk-VIDWZGD6.js → chunk-ECHAJNQJ.js} +12 -12
- package/Build/Workers/{chunk-MIFUV36K.js → chunk-EJO3NKMS.js} +1 -1
- package/Build/Workers/{chunk-ADADBRLI.js → chunk-EZ7NJXQN.js} +4 -4
- package/Build/Workers/{chunk-MJWRSKJV.js → chunk-FA3SCJDX.js} +2 -2
- package/Build/Workers/{chunk-XFS2ORSO.js → chunk-GYRDA3XK.js} +14 -14
- package/Build/Workers/{chunk-3XTJC4CV.js → chunk-H7B7FU2U.js} +7 -7
- package/Build/Workers/{chunk-HDBIC7IL.js → chunk-IGX772ZQ.js} +1 -1
- package/Build/Workers/{chunk-EHMAKCWQ.js → chunk-JDJAPBZP.js} +1 -1
- package/Build/Workers/{chunk-LK7H6V2E.js → chunk-JZFU2LEM.js} +4 -4
- package/Build/Workers/{chunk-3K4DRV7Y.js → chunk-KGLDJRSO.js} +9 -9
- package/Build/Workers/{chunk-LEFV6H2V.js → chunk-KUB64XW6.js} +11 -11
- package/Build/Workers/{chunk-26ZRRKTU.js → chunk-L7U26FFD.js} +16 -16
- package/Build/Workers/{chunk-T7WXNKIA.js → chunk-LEFQBK6H.js} +11 -11
- package/Build/Workers/{chunk-75UG66GR.js → chunk-LWJXCI3F.js} +5 -5
- package/Build/Workers/{chunk-ESPNIYL5.js → chunk-M7HRE4QR.js} +8 -8
- package/Build/Workers/{chunk-SGEAS4NZ.js → chunk-MXHRZHDF.js} +6 -6
- package/Build/Workers/{chunk-YFZMB6FZ.js → chunk-N52ZRKUE.js} +6 -6
- package/Build/Workers/{chunk-AQ4A5CMC.js → chunk-NE5JTQJP.js} +7 -7
- package/Build/Workers/{chunk-G74UMFQ4.js → chunk-NGKF5NTR.js} +5 -5
- package/Build/Workers/{chunk-TXK2FF6N.js → chunk-NHZNMTIR.js} +5 -5
- package/Build/Workers/{chunk-2PX2ULSM.js → chunk-OE22564R.js} +3 -3
- package/Build/Workers/{chunk-AGT6W3JS.js → chunk-OUBBMEWX.js} +6 -6
- package/Build/Workers/{chunk-JESBYOH5.js → chunk-P2H75UV5.js} +67 -33
- package/Build/Workers/{chunk-B56XVJRS.js → chunk-QCMRUVVF.js} +12 -12
- package/Build/Workers/{chunk-SDFGZML6.js → chunk-QSMIHPUM.js} +2 -2
- package/Build/Workers/{chunk-SF2XXYOB.js → chunk-RCCYW6E7.js} +12 -12
- package/Build/Workers/{chunk-EZJXK2UP.js → chunk-RQRODXVN.js} +4 -4
- package/Build/Workers/{chunk-WMG6UOCJ.js → chunk-SZN34LQ5.js} +10 -10
- package/Build/Workers/{chunk-XYBFMHXA.js → chunk-U4XMLGSR.js} +7 -7
- package/Build/Workers/{chunk-KGL66RWW.js → chunk-U7CX3HHE.js} +8 -8
- package/Build/Workers/{chunk-MFPT34BC.js → chunk-VCVA7BMD.js} +4 -4
- package/Build/Workers/{chunk-H3G7OYZY.js → chunk-VVZ667H6.js} +2 -2
- package/Build/Workers/{chunk-PQW63B2T.js → chunk-W4PIP5PG.js} +2 -2
- package/Build/Workers/{chunk-XPTKQIVN.js → chunk-XPVZWY4A.js} +8 -8
- package/Build/Workers/{chunk-OWCFUM4Z.js → chunk-XQ347YWU.js} +13 -13
- package/Build/Workers/{chunk-MBIUW42A.js → chunk-XZO6F23E.js} +1 -1
- package/Build/Workers/{chunk-6KX3IUUT.js → chunk-YLILBDWK.js} +2 -2
- package/Build/Workers/{chunk-RFZAUDYZ.js → chunk-YLXWC7OW.js} +4 -4
- 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 +24 -22
- 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/createVerticesFromCesium3DTilesTerrain.js +88 -0
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +21 -21
- package/Build/Workers/createVerticesFromHeightmap.js +21 -21
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +19 -277
- 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/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +92 -0
- package/Source/Core/ArcGISTiledElevationTerrainProvider.js +2 -2
- package/Source/Core/Cesium3DTilesTerrainData.js +930 -0
- package/Source/Core/Cesium3DTilesTerrainGeometryProcessor.js +1866 -0
- package/Source/Core/Cesium3DTilesTerrainProvider.js +1052 -0
- package/Source/Core/CesiumTerrainProvider.js +2 -2
- package/Source/Core/Color.js +23 -6
- package/Source/Core/EllipsoidalOccluder.js +2 -2
- package/Source/Core/FeatureDetection.js +0 -2
- package/Source/Core/GoogleEarthEnterpriseMetadata.js +1 -1
- package/Source/Core/GoogleEarthEnterpriseTerrainData.js +1 -1
- package/Source/Core/GoogleEarthEnterpriseTerrainProvider.js +1 -1
- package/Source/Core/HeightmapTerrainData.js +10 -22
- package/Source/Core/HilbertOrder.js +0 -6
- package/Source/Core/ITwinPlatform.js +6 -6
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/IonResource.js +35 -27
- package/Source/Core/PixelFormat.js +2 -2
- package/Source/Core/QuantizedMeshTerrainData.js +23 -57
- package/Source/Core/Resource.js +15 -11
- package/Source/Core/S2Cell.js +6 -18
- package/Source/Core/TaskProcessor.js +1 -1
- package/Source/Core/TerrainData.js +2 -1
- package/Source/Core/TerrainEncoding.js +215 -38
- package/Source/Core/TerrainMesh.js +8 -8
- package/Source/Core/TerrainProvider.js +151 -0
- package/Source/Core/VRTheWorldTerrainProvider.js +2 -2
- package/Source/Core/binarySearch.js +1 -1
- package/Source/Core/createWorldBathymetryAsync.js +2 -2
- package/Source/Core/createWorldTerrainAsync.js +3 -3
- package/Source/Core/loadImageFromTypedArray.js +9 -3
- package/Source/Core/mergeSort.js +1 -1
- package/Source/DataSources/PropertyArray.js +2 -2
- package/Source/Renderer/AutomaticUniforms.js +61 -0
- package/Source/Renderer/Context.js +13 -7
- package/Source/Renderer/Pass.js +10 -9
- package/Source/Renderer/UniformState.js +12 -0
- package/Source/Renderer/VertexArray.js +1 -1
- package/Source/Scene/ArcGisMapServerImageryProvider.js +1 -1
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Azure2DImageryProvider.js +7 -5
- package/Source/Scene/BatchTable.js +2 -2
- package/Source/Scene/BillboardCollection.js +25 -21
- package/Source/Scene/BingMapsImageryProvider.js +1 -1
- package/Source/Scene/BoundingVolumeSemantics.js +54 -62
- package/Source/Scene/Cesium3DTile.js +3 -3
- package/Source/Scene/Cesium3DTilesVoxelProvider.js +1 -1
- package/Source/Scene/Cesium3DTileset.js +1 -1
- package/Source/Scene/EdgeFramebuffer.js +245 -0
- package/Source/Scene/FrameState.js +12 -0
- package/Source/Scene/GaussianSplat3DTileContent.js +12 -16
- package/Source/Scene/GaussianSplatPrimitive.js +12 -8
- package/Source/Scene/GaussianSplatSorter.js +2 -2
- package/Source/Scene/Globe.js +1 -1
- package/Source/Scene/GlobeSurfaceTile.js +10 -4
- package/Source/Scene/GltfBufferViewLoader.js +18 -0
- package/Source/Scene/GltfLoader.js +46 -8
- package/Source/Scene/Google2DImageryProvider.js +39 -27
- package/Source/Scene/GoogleEarthEnterpriseMapsProvider.js +1 -1
- package/Source/Scene/I3SDataProvider.js +1 -1
- package/Source/Scene/I3SDecoder.js +3 -3
- package/Source/Scene/ITwinData.js +4 -4
- package/Source/Scene/ImageryLayer.js +1 -1
- package/Source/Scene/Implicit3DTileContent.js +18 -7
- package/Source/Scene/ImplicitSubtree.js +3 -3
- package/Source/Scene/ImplicitTileset.js +2 -2
- package/Source/Scene/IonImageryProvider.js +15 -84
- package/Source/Scene/IonImageryProviderFactory.js +194 -0
- package/Source/Scene/LabelCollection.js +54 -36
- package/Source/Scene/MetadataComponentType.js +5 -5
- package/Source/Scene/MetadataTableProperty.js +3 -9
- package/Source/Scene/Model/EdgeDetectionPipelineStage.js +42 -0
- package/Source/Scene/Model/EdgeVisibilityPipelineStage.js +800 -0
- package/Source/Scene/Model/MetadataPipelineStage.js +7 -7
- package/Source/Scene/Model/ModelDrawCommand.js +69 -0
- package/Source/Scene/Model/ModelImagery.js +4 -0
- package/Source/Scene/Model/ModelRuntimeNode.js +2 -2
- package/Source/Scene/Model/ModelRuntimePrimitive.js +13 -2
- package/Source/Scene/Model/ModelSceneGraph.js +15 -3
- package/Source/Scene/Model/ModelUtility.js +0 -1
- package/Source/Scene/Model/NodeRenderResources.js +1 -1
- package/Source/Scene/Model/PrimitiveRenderResources.js +1 -1
- package/Source/Scene/OIT.js +11 -1
- package/Source/Scene/PickFramebuffer.js +13 -17
- package/Source/Scene/Picking.js +104 -80
- package/Source/Scene/QuadtreePrimitive.js +34 -26
- package/Source/Scene/QuadtreeTile.js +66 -46
- package/Source/Scene/ResourceLoaderState.js +1 -1
- package/Source/Scene/Scene.js +124 -12
- package/Source/Scene/ScreenSpaceCameraController.js +1 -1
- package/Source/Scene/SensorVolumePortionToDisplay.js +6 -6
- package/Source/Scene/SingleTileImageryProvider.js +3 -3
- package/Source/Scene/Terrain.js +5 -5
- package/Source/Scene/TileMapServiceImageryProvider.js +2 -2
- package/Source/Scene/UrlTemplateImageryProvider.js +1 -1
- package/Source/Scene/View.js +3 -0
- package/Source/Scene/VoxelPrimitive.js +196 -189
- package/Source/Scene/VoxelShape.js +2 -0
- package/Source/Scene/createWorldImageryAsync.js +1 -1
- package/Source/Shaders/BillboardCollectionFS.glsl +102 -62
- package/Source/Shaders/BillboardCollectionFS.js +102 -63
- package/Source/Shaders/BillboardCollectionVS.glsl +44 -37
- package/Source/Shaders/BillboardCollectionVS.js +45 -38
- package/Source/Shaders/Builtin/Constants/passCesium3DTile.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTile.js +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.js +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.js +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileEdges.glsl +10 -0
- package/Source/Shaders/Builtin/Constants/passCesium3DTileEdges.js +12 -0
- package/Source/Shaders/Builtin/Constants/passGaussianSplats.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passGaussianSplats.js +1 -1
- package/Source/Shaders/Builtin/Constants/passOpaque.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passOpaque.js +1 -1
- package/Source/Shaders/Builtin/Constants/passOverlay.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passOverlay.js +1 -1
- package/Source/Shaders/Builtin/Constants/passTranslucent.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passTranslucent.js +1 -1
- package/Source/Shaders/Builtin/Constants/passVoxels.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passVoxels.js +1 -1
- package/Source/Shaders/Builtin/CzmBuiltins.js +2 -0
- package/Source/Shaders/GlobeVS.glsl +1 -1
- package/Source/Shaders/GlobeVS.js +1 -1
- package/Source/Shaders/Model/EdgeDetectionStageFS.glsl +58 -0
- package/Source/Shaders/Model/EdgeDetectionStageFS.js +60 -0
- package/Source/Shaders/Model/EdgeVisibilityStageFS.glsl +83 -0
- package/Source/Shaders/Model/EdgeVisibilityStageFS.js +85 -0
- package/Source/Shaders/Model/ModelFS.glsl +5 -0
- package/Source/Shaders/Model/ModelFS.js +5 -0
- package/Source/Shaders/Model/PrimitiveOutlineStageFS.glsl +0 -1
- package/Source/Shaders/Model/PrimitiveOutlineStageFS.js +0 -1
- package/Source/Shaders/ShadowVolumeAppearanceFS.glsl +7 -15
- package/Source/Shaders/ShadowVolumeAppearanceFS.js +7 -15
- package/Source/Workers/createVerticesFromCesium3DTilesTerrain.js +46 -0
- package/Source/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +55 -0
- package/index.d.ts +281 -27
- package/index.js +176 -166
- package/package.json +2 -1
|
@@ -39,7 +39,7 @@ function LayerInformation(layer) {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
|
-
* @typedef {
|
|
42
|
+
* @typedef {object} CesiumTerrainProvider.ConstructorOptions
|
|
43
43
|
*
|
|
44
44
|
* Initialization options for the CesiumTerrainProvider constructor
|
|
45
45
|
*
|
|
@@ -1198,7 +1198,7 @@ CesiumTerrainProvider.fromIonAssetId = async function (assetId, options) {
|
|
|
1198
1198
|
* <li> {@link https://github.com/AnalyticalGraphicsInc/cesium/wiki/heightmap-1.0 Height Map} </li>
|
|
1199
1199
|
* </ul>
|
|
1200
1200
|
*
|
|
1201
|
-
* @param {Resource|
|
|
1201
|
+
* @param {Resource|string|Promise<Resource>|Promise<string>} url The URL of the Cesium terrain server.
|
|
1202
1202
|
* @param {CesiumTerrainProvider.ConstructorOptions} [options] An object describing initialization options.
|
|
1203
1203
|
* @returns {Promise<CesiumTerrainProvider>}
|
|
1204
1204
|
*
|
package/Source/Core/Color.js
CHANGED
|
@@ -679,6 +679,23 @@ Color.prototype.toBytes = function (result) {
|
|
|
679
679
|
return result;
|
|
680
680
|
};
|
|
681
681
|
|
|
682
|
+
/**
|
|
683
|
+
* Converts RGBA values in bytes to a single numeric unsigned 32-bit RGBA value, using the endianness
|
|
684
|
+
* of the system.
|
|
685
|
+
*
|
|
686
|
+
* @returns {number} A single numeric unsigned 32-bit RGBA value.
|
|
687
|
+
*
|
|
688
|
+
* @see Color.toRgba
|
|
689
|
+
*/
|
|
690
|
+
Color.bytesToRgba = function (red, green, blue, alpha) {
|
|
691
|
+
// scratchUint32Array and scratchUint8Array share an underlying array buffer
|
|
692
|
+
scratchUint8Array[0] = red;
|
|
693
|
+
scratchUint8Array[1] = green;
|
|
694
|
+
scratchUint8Array[2] = blue;
|
|
695
|
+
scratchUint8Array[3] = alpha;
|
|
696
|
+
return scratchUint32Array[0];
|
|
697
|
+
};
|
|
698
|
+
|
|
682
699
|
/**
|
|
683
700
|
* Converts this color to a single numeric unsigned 32-bit RGBA value, using the endianness
|
|
684
701
|
* of the system.
|
|
@@ -692,12 +709,12 @@ Color.prototype.toBytes = function (result) {
|
|
|
692
709
|
* @see Color.fromRgba
|
|
693
710
|
*/
|
|
694
711
|
Color.prototype.toRgba = function () {
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
712
|
+
return Color.bytesToRgba(
|
|
713
|
+
Color.floatToByte(this.red),
|
|
714
|
+
Color.floatToByte(this.green),
|
|
715
|
+
Color.floatToByte(this.blue),
|
|
716
|
+
Color.floatToByte(this.alpha),
|
|
717
|
+
);
|
|
701
718
|
};
|
|
702
719
|
|
|
703
720
|
/**
|
|
@@ -247,7 +247,7 @@ EllipsoidalOccluder.prototype.computeHorizonCullingPointPossiblyUnderEllipsoid =
|
|
|
247
247
|
* A reasonable direction to use is the direction from the center of the ellipsoid to
|
|
248
248
|
* the center of the bounding sphere computed from the positions. The direction need not
|
|
249
249
|
* be normalized.
|
|
250
|
-
* @param {number[]} vertices The vertices from which to compute the horizon culling point.
|
|
250
|
+
* @param {number[]|Float32Array|Float64Array} vertices The vertices from which to compute the horizon culling point. The positions
|
|
251
251
|
* must be expressed in a reference frame centered at the ellipsoid and aligned with the
|
|
252
252
|
* ellipsoid's axes.
|
|
253
253
|
* @param {number} [stride=3]
|
|
@@ -277,7 +277,7 @@ EllipsoidalOccluder.prototype.computeHorizonCullingPointFromVertices =
|
|
|
277
277
|
* A reasonable direction to use is the direction from the center of the ellipsoid to
|
|
278
278
|
* the center of the bounding sphere computed from the positions. The direction need not
|
|
279
279
|
* be normalized.
|
|
280
|
-
* @param {number[]} vertices The vertices from which to compute the horizon culling point. The positions
|
|
280
|
+
* @param {number[]|Float32Array|Float64Array} vertices The vertices from which to compute the horizon culling point. The positions
|
|
281
281
|
* must be expressed in a reference frame centered at the ellipsoid and aligned with the
|
|
282
282
|
* ellipsoid's axes.
|
|
283
283
|
* @param {number} [stride=3]
|
|
@@ -282,12 +282,10 @@ if (typeof ArrayBuffer !== "undefined") {
|
|
|
282
282
|
}
|
|
283
283
|
|
|
284
284
|
if (typeof BigInt64Array !== "undefined") {
|
|
285
|
-
// eslint-disable-next-line no-undef
|
|
286
285
|
typedArrayTypes.push(BigInt64Array);
|
|
287
286
|
}
|
|
288
287
|
|
|
289
288
|
if (typeof BigUint64Array !== "undefined") {
|
|
290
|
-
// eslint-disable-next-line no-undef
|
|
291
289
|
typedArrayTypes.push(BigUint64Array);
|
|
292
290
|
}
|
|
293
291
|
}
|
|
@@ -140,7 +140,7 @@ Object.defineProperties(GoogleEarthEnterpriseMetadata.prototype, {
|
|
|
140
140
|
* Creates a metadata object using the Google Earth Enterprise REST API. This is used by the GoogleEarthEnterpriseImageryProvider
|
|
141
141
|
* and GoogleEarthEnterpriseTerrainProvider to share metadata requests.
|
|
142
142
|
*
|
|
143
|
-
* @param {Resource|
|
|
143
|
+
* @param {Resource|string} resourceOrUrl The url of the Google Earth Enterprise server hosting the imagery.
|
|
144
144
|
*
|
|
145
145
|
* @returns {Promise<GoogleEarthEnterpriseMetadata>} A promise which resolves to the created GoogleEarthEnterpriseMetadata instance/
|
|
146
146
|
*/
|
|
@@ -380,7 +380,7 @@ GoogleEarthEnterpriseTerrainData.prototype.upsample = function (
|
|
|
380
380
|
|
|
381
381
|
/**
|
|
382
382
|
* Determines if a given child tile is available, based on the
|
|
383
|
-
* {@link
|
|
383
|
+
* {@link GoogleEarthEnterpriseTerrainData.childTileMask}. The given child tile coordinates are assumed
|
|
384
384
|
* to be one of the four children of this tile. If non-child tile coordinates are
|
|
385
385
|
* given, the availability of the southeast child tile is returned.
|
|
386
386
|
*
|
|
@@ -65,7 +65,7 @@ TerrainCache.prototype.tidy = function () {
|
|
|
65
65
|
};
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
|
-
* @typedef {
|
|
68
|
+
* @typedef {object} GoogleEarthEnterpriseTerrainProvider.ConstructorOptions
|
|
69
69
|
*
|
|
70
70
|
* Initialization options for GoogleEarthEnterpriseTerrainProvider constructor
|
|
71
71
|
*
|
|
@@ -94,16 +94,12 @@ import TerrainProvider from "./TerrainProvider.js";
|
|
|
94
94
|
* @see GoogleEarthEnterpriseTerrainData
|
|
95
95
|
*/
|
|
96
96
|
function HeightmapTerrainData(options) {
|
|
97
|
+
options = options ?? Frozen.EMPTY_OBJECT;
|
|
98
|
+
|
|
97
99
|
//>>includeStart('debug', pragmas.debug);
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
if (!defined(options.width)) {
|
|
102
|
-
throw new DeveloperError("options.width is required.");
|
|
103
|
-
}
|
|
104
|
-
if (!defined(options.height)) {
|
|
105
|
-
throw new DeveloperError("options.height is required.");
|
|
106
|
-
}
|
|
100
|
+
Check.typeOf.object("options.buffer", options.buffer);
|
|
101
|
+
Check.typeOf.number("options.width", options.width);
|
|
102
|
+
Check.typeOf.number("options.height", options.height);
|
|
107
103
|
//>>includeEnd('debug');
|
|
108
104
|
|
|
109
105
|
this._buffer = options.buffer;
|
|
@@ -158,7 +154,7 @@ Object.defineProperties(HeightmapTerrainData.prototype, {
|
|
|
158
154
|
* Uint8Array or image where a value of 255 indicates water and a value of 0 indicates land.
|
|
159
155
|
* Values in between 0 and 255 are allowed as well to smoothly blend between land and water.
|
|
160
156
|
* @memberof HeightmapTerrainData.prototype
|
|
161
|
-
* @type {Uint8Array|HTMLImageElement|HTMLCanvasElement|undefined}
|
|
157
|
+
* @type {Uint8Array|HTMLImageElement|HTMLCanvasElement|ImageBitmap|undefined}
|
|
162
158
|
*/
|
|
163
159
|
waterMask: {
|
|
164
160
|
get: function () {
|
|
@@ -645,18 +641,10 @@ HeightmapTerrainData.prototype.isChildAvailable = function (
|
|
|
645
641
|
childY,
|
|
646
642
|
) {
|
|
647
643
|
//>>includeStart('debug', pragmas.debug);
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
throw new DeveloperError("thisY is required.");
|
|
653
|
-
}
|
|
654
|
-
if (!defined(childX)) {
|
|
655
|
-
throw new DeveloperError("childX is required.");
|
|
656
|
-
}
|
|
657
|
-
if (!defined(childY)) {
|
|
658
|
-
throw new DeveloperError("childY is required.");
|
|
659
|
-
}
|
|
644
|
+
Check.typeOf.number("thisX", thisX);
|
|
645
|
+
Check.typeOf.number("thisY", thisY);
|
|
646
|
+
Check.typeOf.number("childX", childX);
|
|
647
|
+
Check.typeOf.number("childY", childY);
|
|
660
648
|
//>>includeEnd('debug');
|
|
661
649
|
|
|
662
650
|
let bitNumber = 2; // northwest child
|
|
@@ -38,13 +38,11 @@ HilbertOrder.encode2D = function (level, x, y) {
|
|
|
38
38
|
let rx,
|
|
39
39
|
ry,
|
|
40
40
|
s,
|
|
41
|
-
// eslint-disable-next-line no-undef
|
|
42
41
|
index = BigInt(0);
|
|
43
42
|
|
|
44
43
|
for (s = n / 2; s > 0; s /= 2) {
|
|
45
44
|
rx = (p.x & s) > 0 ? 1 : 0;
|
|
46
45
|
ry = (p.y & s) > 0 ? 1 : 0;
|
|
47
|
-
// eslint-disable-next-line no-undef
|
|
48
46
|
index += BigInt(((3 * rx) ^ ry) * s * s);
|
|
49
47
|
rotate(n, p, rx, ry);
|
|
50
48
|
}
|
|
@@ -67,7 +65,6 @@ HilbertOrder.decode2D = function (level, index) {
|
|
|
67
65
|
if (level < 1) {
|
|
68
66
|
throw new DeveloperError("Hilbert level cannot be less than 1.");
|
|
69
67
|
}
|
|
70
|
-
// eslint-disable-next-line no-undef
|
|
71
68
|
if (index < BigInt(0) || index >= BigInt(Math.pow(4, level))) {
|
|
72
69
|
throw new DeveloperError(
|
|
73
70
|
"Hilbert index exceeds valid maximum for given level.",
|
|
@@ -83,14 +80,11 @@ HilbertOrder.decode2D = function (level, index) {
|
|
|
83
80
|
let rx, ry, s, t;
|
|
84
81
|
|
|
85
82
|
for (s = 1, t = index; s < n; s *= 2) {
|
|
86
|
-
// eslint-disable-next-line no-undef
|
|
87
83
|
rx = 1 & Number(t / BigInt(2));
|
|
88
|
-
// eslint-disable-next-line no-undef
|
|
89
84
|
ry = 1 & Number(t ^ BigInt(rx));
|
|
90
85
|
rotate(s, p, rx, ry);
|
|
91
86
|
p.x += s * rx;
|
|
92
87
|
p.y += s * ry;
|
|
93
|
-
// eslint-disable-next-line no-undef
|
|
94
88
|
t /= BigInt(4);
|
|
95
89
|
}
|
|
96
90
|
|
|
@@ -114,7 +114,7 @@ ITwinPlatform.apiEndpoint = new Resource({
|
|
|
114
114
|
});
|
|
115
115
|
|
|
116
116
|
/**
|
|
117
|
-
* @typedef {
|
|
117
|
+
* @typedef {object} ExportRequest
|
|
118
118
|
* @private
|
|
119
119
|
* @property {string} iModelId
|
|
120
120
|
* @property {string} changesetId
|
|
@@ -122,13 +122,13 @@ ITwinPlatform.apiEndpoint = new Resource({
|
|
|
122
122
|
*/
|
|
123
123
|
|
|
124
124
|
/**
|
|
125
|
-
* @typedef {
|
|
125
|
+
* @typedef {object} Link
|
|
126
126
|
* @private
|
|
127
127
|
* @property {string} href
|
|
128
128
|
*/
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
|
-
* @typedef {
|
|
131
|
+
* @typedef {object} ExportRepresentation
|
|
132
132
|
* The export objects from get-exports when using return=representation
|
|
133
133
|
* @private
|
|
134
134
|
* @property {string} id Export id
|
|
@@ -140,7 +140,7 @@ ITwinPlatform.apiEndpoint = new Resource({
|
|
|
140
140
|
*/
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
|
-
* @typedef {
|
|
143
|
+
* @typedef {object} GetExportsResponse
|
|
144
144
|
* @private
|
|
145
145
|
* @property {ExportRepresentation[]} exports The list of exports for the current page
|
|
146
146
|
* @property {{self: Link, next: Link | undefined, prev: Link | undefined}} _links Pagination links
|
|
@@ -224,14 +224,14 @@ ITwinPlatform.getExports = async function (iModelId, changesetId) {
|
|
|
224
224
|
};
|
|
225
225
|
|
|
226
226
|
/**
|
|
227
|
-
* @typedef {
|
|
227
|
+
* @typedef {object} RealityDataExtent
|
|
228
228
|
* @private
|
|
229
229
|
* @property {{latitude: number, longitude: number}} southWest
|
|
230
230
|
* @property {{latitude: number, longitude: number}} northEast
|
|
231
231
|
*/
|
|
232
232
|
|
|
233
233
|
/**
|
|
234
|
-
* @typedef {
|
|
234
|
+
* @typedef {object} RealityDataRepresentation
|
|
235
235
|
* @private
|
|
236
236
|
* @property {string} id "95d8dccd-d89e-4287-bb5f-3219acbc71ae",
|
|
237
237
|
* @property {string} displayName "Name of reality data",
|
package/Source/Core/Ion.js
CHANGED
|
@@ -4,7 +4,7 @@ import Resource from "./Resource.js";
|
|
|
4
4
|
|
|
5
5
|
let defaultTokenCredit;
|
|
6
6
|
const defaultAccessToken =
|
|
7
|
-
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.
|
|
7
|
+
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJhN2VkNDM5ZS1jMDk0LTQ3NDItOTM5ZS00MzU3M2M1MTc2ZTkiLCJpZCI6MjU5LCJpYXQiOjE3NjIxODg4MDB9.ZZG574sONzeHxsX8HJMaL_ZiGA3dh_HrOxL7DrKRcd4";
|
|
8
8
|
/**
|
|
9
9
|
* Default settings for accessing the Cesium ion API.
|
|
10
10
|
*
|
|
@@ -7,6 +7,14 @@ import Ion from "./Ion.js";
|
|
|
7
7
|
import Resource from "./Resource.js";
|
|
8
8
|
import RuntimeError from "./RuntimeError.js";
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* A function that will be invoked when the access token is refreshed.
|
|
12
|
+
* @callback IonResourceRefreshCallback
|
|
13
|
+
* @param {IonResource} ionResource The root IonResource being refreshed.
|
|
14
|
+
* @param {object} endpoint The result of the Cesium ion asset endpoint service. This may be modified in place by the callback.
|
|
15
|
+
* @private
|
|
16
|
+
*/
|
|
17
|
+
|
|
10
18
|
/**
|
|
11
19
|
* A {@link Resource} instance that encapsulates Cesium ion asset access.
|
|
12
20
|
* This object is normally not instantiated directly, use {@link IonResource.fromAssetId}.
|
|
@@ -16,7 +24,7 @@ import RuntimeError from "./RuntimeError.js";
|
|
|
16
24
|
* @augments Resource
|
|
17
25
|
*
|
|
18
26
|
* @param {object} endpoint The result of the Cesium ion asset endpoint service.
|
|
19
|
-
* @param {Resource} endpointResource The resource used to retrieve the endpoint.
|
|
27
|
+
* @param {Resource} endpointResource The original resource used to retrieve the endpoint.
|
|
20
28
|
*
|
|
21
29
|
* @see Ion
|
|
22
30
|
* @see IonImageryProvider
|
|
@@ -39,12 +47,6 @@ function IonResource(endpoint, endpointResource) {
|
|
|
39
47
|
retryAttempts: 1,
|
|
40
48
|
retryCallback: retryCallback,
|
|
41
49
|
};
|
|
42
|
-
} else if (["GOOGLE_2D_MAPS", "AZURE_MAPS"].includes(externalType)) {
|
|
43
|
-
options = {
|
|
44
|
-
url: endpoint.options.url,
|
|
45
|
-
retryAttempts: 1,
|
|
46
|
-
retryCallback: retryCallback,
|
|
47
|
-
};
|
|
48
50
|
} else if (
|
|
49
51
|
externalType === "3DTILES" ||
|
|
50
52
|
externalType === "STK_TERRAIN_SERVER"
|
|
@@ -76,6 +78,13 @@ function IonResource(endpoint, endpointResource) {
|
|
|
76
78
|
this._pendingPromise = undefined;
|
|
77
79
|
this._credits = undefined;
|
|
78
80
|
this._isExternal = isExternal;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* A function that, if defined, will be invoked when the access token is refreshed.
|
|
84
|
+
* @private
|
|
85
|
+
* @type {IonResourceRefreshCallback|undefined}
|
|
86
|
+
*/
|
|
87
|
+
this.refreshCallback = undefined;
|
|
79
88
|
}
|
|
80
89
|
|
|
81
90
|
if (defined(Object.create)) {
|
|
@@ -205,7 +214,7 @@ IonResource.prototype._makeRequest = function (options) {
|
|
|
205
214
|
return Resource.prototype._makeRequest.call(this, options);
|
|
206
215
|
}
|
|
207
216
|
|
|
208
|
-
addClientHeaders(options);
|
|
217
|
+
options.headers = addClientHeaders(options.headers);
|
|
209
218
|
options.headers.Authorization = `Bearer ${this._ionEndpoint.accessToken}`;
|
|
210
219
|
|
|
211
220
|
return Resource.prototype._makeRequest.call(this, options);
|
|
@@ -239,20 +248,26 @@ IonResource._createEndpointResource = function (assetId, options) {
|
|
|
239
248
|
};
|
|
240
249
|
}
|
|
241
250
|
|
|
242
|
-
addClientHeaders(resourceOptions);
|
|
251
|
+
resourceOptions.headers = addClientHeaders(resourceOptions.headers);
|
|
243
252
|
|
|
244
253
|
return server.getDerivedResource(resourceOptions);
|
|
245
254
|
};
|
|
246
255
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
256
|
+
/**
|
|
257
|
+
* Adds CesiumJS client headers to the provided headers object.
|
|
258
|
+
* @private
|
|
259
|
+
* @param {object} [headers={}] The headers to modify.
|
|
260
|
+
* @returns {object} The modified headers.
|
|
261
|
+
*/
|
|
262
|
+
function addClientHeaders(headers = {}) {
|
|
263
|
+
headers["X-Cesium-Client"] = "CesiumJS";
|
|
264
|
+
|
|
252
265
|
/* global CESIUM_VERSION */
|
|
253
266
|
if (typeof CESIUM_VERSION !== "undefined") {
|
|
254
|
-
|
|
267
|
+
headers["X-Cesium-Client-Version"] = CESIUM_VERSION;
|
|
255
268
|
}
|
|
269
|
+
|
|
270
|
+
return headers;
|
|
256
271
|
}
|
|
257
272
|
|
|
258
273
|
function retryCallback(that, error) {
|
|
@@ -280,20 +295,13 @@ function retryCallback(that, error) {
|
|
|
280
295
|
ionRoot._pendingPromise = endpointResource
|
|
281
296
|
.fetchJson()
|
|
282
297
|
.then(function (newEndpoint) {
|
|
298
|
+
const refreshCallback = that.refreshCallback ?? ionRoot.refreshCallback;
|
|
299
|
+
if (defined(refreshCallback)) {
|
|
300
|
+
refreshCallback(ionRoot, newEndpoint);
|
|
301
|
+
}
|
|
302
|
+
|
|
283
303
|
// Set the token for root resource so new derived resources automatically pick it up
|
|
284
304
|
ionRoot._ionEndpoint = newEndpoint;
|
|
285
|
-
// Reset the session token for Google 2D imagery
|
|
286
|
-
if (newEndpoint.externalType === "GOOGLE_2D_MAPS") {
|
|
287
|
-
ionRoot.setQueryParameters({
|
|
288
|
-
session: newEndpoint.options.session,
|
|
289
|
-
key: newEndpoint.options.key,
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
if (newEndpoint.externalType === "AZURE_MAPS") {
|
|
293
|
-
ionRoot.setQueryParameters({
|
|
294
|
-
"subscription-key": newEndpoint.options["subscription-key"],
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
305
|
return ionRoot._ionEndpoint;
|
|
298
306
|
})
|
|
299
307
|
.finally(function (newEndpoint) {
|
|
@@ -464,8 +464,8 @@ PixelFormat.alignmentInBytes = function (pixelFormat, pixelDatatype, width) {
|
|
|
464
464
|
* @private
|
|
465
465
|
* @param {PixelFormat} pixelFormat The pixel format.
|
|
466
466
|
* @param {PixelDatatype} pixelDatatype The pixel datatype.
|
|
467
|
-
* @param {
|
|
468
|
-
* @param {
|
|
467
|
+
* @param {number} width The width of the texture.
|
|
468
|
+
* @param {number} height The height of the texture.
|
|
469
469
|
* @returns {TypedArray} The typed array.
|
|
470
470
|
*/
|
|
471
471
|
PixelFormat.createTypedArray = function (
|
|
@@ -92,52 +92,26 @@ import TerrainMesh from "./TerrainMesh.js";
|
|
|
92
92
|
* @see GoogleEarthEnterpriseTerrainData
|
|
93
93
|
*/
|
|
94
94
|
function QuantizedMeshTerrainData(options) {
|
|
95
|
+
options = options ?? Frozen.EMPTY_OBJECT;
|
|
96
|
+
|
|
95
97
|
//>>includeStart('debug', pragmas.debug)
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
if (!defined(options.horizonOcclusionPoint)) {
|
|
115
|
-
throw new DeveloperError("options.horizonOcclusionPoint is required.");
|
|
116
|
-
}
|
|
117
|
-
if (!defined(options.westIndices)) {
|
|
118
|
-
throw new DeveloperError("options.westIndices is required.");
|
|
119
|
-
}
|
|
120
|
-
if (!defined(options.southIndices)) {
|
|
121
|
-
throw new DeveloperError("options.southIndices is required.");
|
|
122
|
-
}
|
|
123
|
-
if (!defined(options.eastIndices)) {
|
|
124
|
-
throw new DeveloperError("options.eastIndices is required.");
|
|
125
|
-
}
|
|
126
|
-
if (!defined(options.northIndices)) {
|
|
127
|
-
throw new DeveloperError("options.northIndices is required.");
|
|
128
|
-
}
|
|
129
|
-
if (!defined(options.westSkirtHeight)) {
|
|
130
|
-
throw new DeveloperError("options.westSkirtHeight is required.");
|
|
131
|
-
}
|
|
132
|
-
if (!defined(options.southSkirtHeight)) {
|
|
133
|
-
throw new DeveloperError("options.southSkirtHeight is required.");
|
|
134
|
-
}
|
|
135
|
-
if (!defined(options.eastSkirtHeight)) {
|
|
136
|
-
throw new DeveloperError("options.eastSkirtHeight is required.");
|
|
137
|
-
}
|
|
138
|
-
if (!defined(options.northSkirtHeight)) {
|
|
139
|
-
throw new DeveloperError("options.northSkirtHeight is required.");
|
|
140
|
-
}
|
|
98
|
+
Check.typeOf.object("options.quantizedVertices", options.quantizedVertices);
|
|
99
|
+
Check.typeOf.object("options.indices", options.indices);
|
|
100
|
+
Check.typeOf.number("options.minimumHeight", options.minimumHeight);
|
|
101
|
+
Check.typeOf.number("options.maximumHeight", options.maximumHeight);
|
|
102
|
+
Check.typeOf.object("options.boundingSphere", options.boundingSphere);
|
|
103
|
+
Check.typeOf.object(
|
|
104
|
+
"options.horizonOcclusionPoint",
|
|
105
|
+
options.horizonOcclusionPoint,
|
|
106
|
+
);
|
|
107
|
+
Check.typeOf.object("options.westIndices", options.westIndices);
|
|
108
|
+
Check.typeOf.object("options.southIndices", options.southIndices);
|
|
109
|
+
Check.typeOf.object("options.eastIndices", options.eastIndices);
|
|
110
|
+
Check.typeOf.object("options.northIndices", options.northIndices);
|
|
111
|
+
Check.typeOf.number("options.westSkirtHeight", options.westSkirtHeight);
|
|
112
|
+
Check.typeOf.number("options.southSkirtHeight", options.southSkirtHeight);
|
|
113
|
+
Check.typeOf.number("options.eastSkirtHeight", options.eastSkirtHeight);
|
|
114
|
+
Check.typeOf.number("options.northSkirtHeight", options.northSkirtHeight);
|
|
141
115
|
//>>includeEnd('debug');
|
|
142
116
|
|
|
143
117
|
this._quantizedVertices = options.quantizedVertices;
|
|
@@ -729,18 +703,10 @@ QuantizedMeshTerrainData.prototype.isChildAvailable = function (
|
|
|
729
703
|
childY,
|
|
730
704
|
) {
|
|
731
705
|
//>>includeStart('debug', pragmas.debug);
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
throw new DeveloperError("thisY is required.");
|
|
737
|
-
}
|
|
738
|
-
if (!defined(childX)) {
|
|
739
|
-
throw new DeveloperError("childX is required.");
|
|
740
|
-
}
|
|
741
|
-
if (!defined(childY)) {
|
|
742
|
-
throw new DeveloperError("childY is required.");
|
|
743
|
-
}
|
|
706
|
+
Check.typeOf.number("thisX", thisX);
|
|
707
|
+
Check.typeOf.number("thisY", thisY);
|
|
708
|
+
Check.typeOf.number("childX", childX);
|
|
709
|
+
Check.typeOf.number("childY", childY);
|
|
744
710
|
//>>includeEnd('debug');
|
|
745
711
|
|
|
746
712
|
let bitNumber = 2; // northwest child
|
package/Source/Core/Resource.js
CHANGED
|
@@ -917,7 +917,7 @@ Resource.prototype.fetchImage = function (options) {
|
|
|
917
917
|
this.isBlobUri ||
|
|
918
918
|
(!this.hasHeaders && !preferBlob)
|
|
919
919
|
) {
|
|
920
|
-
return
|
|
920
|
+
return this._fetchImage({
|
|
921
921
|
resource: this,
|
|
922
922
|
flipY: flipY,
|
|
923
923
|
skipColorSpaceConversion: skipColorSpaceConversion,
|
|
@@ -957,8 +957,7 @@ Resource.prototype.fetchImage = function (options) {
|
|
|
957
957
|
url: blobUrl,
|
|
958
958
|
});
|
|
959
959
|
|
|
960
|
-
return
|
|
961
|
-
resource: generatedBlobResource,
|
|
960
|
+
return generatedBlobResource._fetchImage({
|
|
962
961
|
flipY: flipY,
|
|
963
962
|
skipColorSpaceConversion: skipColorSpaceConversion,
|
|
964
963
|
preferImageBitmap: false,
|
|
@@ -997,16 +996,15 @@ Resource.prototype.fetchImage = function (options) {
|
|
|
997
996
|
|
|
998
997
|
/**
|
|
999
998
|
* Fetches an image and returns a promise to it.
|
|
1000
|
-
*
|
|
1001
999
|
* @param {object} [options] An object with the following properties.
|
|
1002
|
-
* @param {Resource} [options.resource] Resource object that points to an image to fetch.
|
|
1003
1000
|
* @param {boolean} [options.preferImageBitmap] If true, image will be decoded during fetch and an <code>ImageBitmap</code> is returned.
|
|
1004
1001
|
* @param {boolean} [options.flipY] If true, image will be vertically flipped during decode. Only applies if the browser supports <code>createImageBitmap</code>.
|
|
1005
1002
|
* @param {boolean} [options.skipColorSpaceConversion=false] If true, any custom gamma or color profiles in the image will be ignored. Only applies if the browser supports <code>createImageBitmap</code>.
|
|
1003
|
+
* @returns {Promise<ImageBitmap|HTMLImageElement>|undefined} a promise that will resolve to the requested data when loaded. Returns undefined if the request has been throttled and cannot be made at this time.
|
|
1006
1004
|
* @private
|
|
1007
1005
|
*/
|
|
1008
|
-
function
|
|
1009
|
-
const resource =
|
|
1006
|
+
Resource.prototype._fetchImage = function (options) {
|
|
1007
|
+
const resource = this;
|
|
1010
1008
|
const flipY = options.flipY;
|
|
1011
1009
|
const skipColorSpaceConversion = options.skipColorSpaceConversion;
|
|
1012
1010
|
const preferImageBitmap = options.preferImageBitmap;
|
|
@@ -1050,8 +1048,7 @@ function fetchImage(options) {
|
|
|
1050
1048
|
request.state = RequestState.UNISSUED;
|
|
1051
1049
|
request.deferred = undefined;
|
|
1052
1050
|
|
|
1053
|
-
return
|
|
1054
|
-
resource: resource,
|
|
1051
|
+
return resource._fetchImage({
|
|
1055
1052
|
flipY: flipY,
|
|
1056
1053
|
skipColorSpaceConversion: skipColorSpaceConversion,
|
|
1057
1054
|
preferImageBitmap: preferImageBitmap,
|
|
@@ -1060,7 +1057,7 @@ function fetchImage(options) {
|
|
|
1060
1057
|
return Promise.reject(e);
|
|
1061
1058
|
});
|
|
1062
1059
|
});
|
|
1063
|
-
}
|
|
1060
|
+
};
|
|
1064
1061
|
|
|
1065
1062
|
/**
|
|
1066
1063
|
* Creates a Resource and calls fetchImage() on it.
|
|
@@ -1962,6 +1959,7 @@ Resource._Implementations.createImage = function (
|
|
|
1962
1959
|
flipY,
|
|
1963
1960
|
skipColorSpaceConversion,
|
|
1964
1961
|
preferImageBitmap,
|
|
1962
|
+
headers,
|
|
1965
1963
|
) {
|
|
1966
1964
|
const url = request.url;
|
|
1967
1965
|
// Passing an Image to createImageBitmap will force it to run on the main thread
|
|
@@ -1985,7 +1983,7 @@ Resource._Implementations.createImage = function (
|
|
|
1985
1983
|
responseType,
|
|
1986
1984
|
method,
|
|
1987
1985
|
undefined,
|
|
1988
|
-
|
|
1986
|
+
headers,
|
|
1989
1987
|
xhrDeferred,
|
|
1990
1988
|
undefined,
|
|
1991
1989
|
undefined,
|
|
@@ -2027,6 +2025,12 @@ Resource._Implementations.createImage = function (
|
|
|
2027
2025
|
* Wrapper for createImageBitmap
|
|
2028
2026
|
*
|
|
2029
2027
|
* @private
|
|
2028
|
+
* @param {Blob} blob The image blob.
|
|
2029
|
+
* @param {object} options An object containing the following properties:
|
|
2030
|
+
* @param {boolean} options.flipY Whether to flip the image Y axis.
|
|
2031
|
+
* @param {boolean} options.premultiplyAlpha Whether to premultiply the alpha channel.
|
|
2032
|
+
* @param {boolean} options.skipColorSpaceConversion Whether to skip color space conversion.
|
|
2033
|
+
* @returns {Promise<ImageBitmap>} A promise that resolves to the created image bitmap.
|
|
2030
2034
|
*/
|
|
2031
2035
|
Resource.createImageBitmapFromBlob = function (blob, options) {
|
|
2032
2036
|
Check.defined("options", options);
|