@cesium/engine 2.2.0 → 2.4.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/{AttributeCompression-8a5a065e.js → AttributeCompression-f9f6c717.js} +1 -1
- package/Build/Workers/{AxisAlignedBoundingBox-379015ef.js → AxisAlignedBoundingBox-4bfd84f3.js} +1 -1
- package/Build/Workers/{BoundingRectangle-57f2b24f.js → BoundingRectangle-5fd6403a.js} +1 -1
- package/Build/Workers/{BoxGeometry-ecabfc78.js → BoxGeometry-af7d05ef.js} +1 -1
- package/Build/Workers/{Color-14d1a36d.js → Color-e5bfda3f.js} +1 -1
- package/Build/Workers/{CoplanarPolygonGeometryLibrary-048c3c14.js → CoplanarPolygonGeometryLibrary-59c69b0a.js} +1 -1
- package/Build/Workers/{CorridorGeometryLibrary-520c8619.js → CorridorGeometryLibrary-63907365.js} +1 -1
- package/Build/Workers/{CylinderGeometry-119068b8.js → CylinderGeometry-dbaa1678.js} +1 -1
- package/Build/Workers/{CylinderGeometryLibrary-135b0858.js → CylinderGeometryLibrary-7bf291b4.js} +1 -1
- package/Build/Workers/{EllipseGeometry-2dfc3523.js → EllipseGeometry-6508b78b.js} +1 -1
- package/Build/Workers/{EllipseGeometryLibrary-0a1e0170.js → EllipseGeometryLibrary-21262a28.js} +1 -1
- package/Build/Workers/{EllipseOutlineGeometry-c5251669.js → EllipseOutlineGeometry-2a2510bb.js} +1 -1
- package/Build/Workers/{EllipsoidGeodesic-dcff5cbd.js → EllipsoidGeodesic-5b3623dc.js} +1 -1
- package/Build/Workers/{EllipsoidGeometry-d10a5221.js → EllipsoidGeometry-8155e3a2.js} +1 -1
- package/Build/Workers/{EllipsoidOutlineGeometry-7039a0ae.js → EllipsoidOutlineGeometry-c045678d.js} +1 -1
- package/Build/Workers/{EllipsoidRhumbLine-b672d507.js → EllipsoidRhumbLine-ef872433.js} +1 -1
- package/Build/Workers/{EllipsoidTangentPlane-857186be.js → EllipsoidTangentPlane-546c0d5e.js} +1 -1
- package/Build/Workers/{EncodedCartesian3-e8bbca36.js → EncodedCartesian3-57415c8a.js} +1 -1
- package/Build/Workers/{FrustumGeometry-400fa1b7.js → FrustumGeometry-d3ff16d0.js} +31 -3
- package/Build/Workers/{GeometryAttribute-7a2de5c6.js → GeometryAttribute-13da9466.js} +1 -1
- package/Build/Workers/{GeometryInstance-3fb607b7.js → GeometryInstance-34d9e21e.js} +1 -1
- package/Build/Workers/{GeometryPipeline-916636fa.js → GeometryPipeline-03bc5709.js} +1 -1
- package/Build/Workers/{IndexDatatype-b8f3e09d.js → IndexDatatype-2643aa47.js} +1 -1
- package/Build/Workers/{IntersectionTests-b4d02d4d.js → IntersectionTests-85350792.js} +1 -1
- package/Build/Workers/{Math-dad82b4d.js → Math-0a2ac845.js} +12 -2
- package/Build/Workers/{Matrix2-1e403d0e.js → Matrix2-e1298525.js} +1 -1
- package/Build/Workers/{Matrix3-fa806b97.js → Matrix3-41c58dde.js} +1 -1
- package/Build/Workers/{OrientedBoundingBox-96fe1752.js → OrientedBoundingBox-29fb0fcd.js} +1 -1
- package/Build/Workers/{Plane-c27e1ac6.js → Plane-4c3d403b.js} +1 -1
- package/Build/Workers/{PolygonGeometryLibrary-931f1ec6.js → PolygonGeometryLibrary-d447448d.js} +1 -1
- package/Build/Workers/PolygonPipeline-460cce4e.js +1344 -0
- package/Build/Workers/{PolylinePipeline-6d5c63e5.js → PolylinePipeline-7119eb3f.js} +1 -1
- package/Build/Workers/{PolylineVolumeGeometryLibrary-f068c1fb.js → PolylineVolumeGeometryLibrary-d25f0050.js} +1 -1
- package/Build/Workers/{PrimitivePipeline-879f996a.js → PrimitivePipeline-e648752b.js} +1 -1
- package/Build/Workers/{RectangleGeometryLibrary-2d6f36f3.js → RectangleGeometryLibrary-bb378fb6.js} +1 -1
- package/Build/Workers/{TerrainEncoding-82882059.js → TerrainEncoding-c8e029a2.js} +1 -1
- package/Build/Workers/Transforms-e2d4a55a.js +14713 -0
- package/Build/Workers/{WallGeometryLibrary-db7a64fb.js → WallGeometryLibrary-3e0819ec.js} +1 -1
- package/Build/Workers/{WebMercatorProjection-76a3fcc0.js → WebMercatorProjection-13ed1a6e.js} +1 -1
- package/Build/Workers/{arrayRemoveDuplicates-fac118a8.js → arrayRemoveDuplicates-d2061e85.js} +1 -1
- package/Build/Workers/cesiumWorkerBootstrapper.js +1 -1
- package/Build/Workers/combineGeometry.js +1 -1
- package/Build/Workers/createBoxGeometry.js +1 -1
- package/Build/Workers/createBoxOutlineGeometry.js +1 -1
- package/Build/Workers/createCircleGeometry.js +1 -1
- package/Build/Workers/createCircleOutlineGeometry.js +1 -1
- package/Build/Workers/createCoplanarPolygonGeometry.js +1 -1
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +1 -1
- package/Build/Workers/createCorridorGeometry.js +1 -1
- package/Build/Workers/createCorridorOutlineGeometry.js +1 -1
- package/Build/Workers/createCylinderGeometry.js +1 -1
- package/Build/Workers/createCylinderOutlineGeometry.js +1 -1
- package/Build/Workers/createEllipseGeometry.js +1 -1
- package/Build/Workers/createEllipseOutlineGeometry.js +1 -1
- package/Build/Workers/createEllipsoidGeometry.js +1 -1
- package/Build/Workers/createEllipsoidOutlineGeometry.js +1 -1
- package/Build/Workers/createFrustumGeometry.js +1 -1
- package/Build/Workers/createFrustumOutlineGeometry.js +1 -1
- package/Build/Workers/createGeometry.js +1 -1
- package/Build/Workers/createGroundPolylineGeometry.js +1 -1
- package/Build/Workers/createPlaneGeometry.js +1 -1
- package/Build/Workers/createPlaneOutlineGeometry.js +1 -1
- package/Build/Workers/createPolygonGeometry.js +1 -1
- package/Build/Workers/createPolygonOutlineGeometry.js +1 -1
- package/Build/Workers/createPolylineGeometry.js +1 -1
- package/Build/Workers/createPolylineVolumeGeometry.js +1 -1
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +1 -1
- package/Build/Workers/createRectangleGeometry.js +1 -1
- package/Build/Workers/createRectangleOutlineGeometry.js +1 -1
- package/Build/Workers/createSimplePolylineGeometry.js +1 -1
- package/Build/Workers/createSphereGeometry.js +1 -1
- package/Build/Workers/createSphereOutlineGeometry.js +1 -1
- package/Build/Workers/createVectorTileClampedPolylines.js +1 -1
- package/Build/Workers/createVectorTileGeometries.js +1 -1
- package/Build/Workers/createVectorTilePoints.js +1 -1
- package/Build/Workers/createVectorTilePolygons.js +1 -1
- package/Build/Workers/createVectorTilePolylines.js +1 -1
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +1 -1
- package/Build/Workers/createVerticesFromHeightmap.js +5 -8
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +1 -1
- package/Build/Workers/createWallGeometry.js +1 -1
- package/Build/Workers/createWallOutlineGeometry.js +1 -1
- package/Build/Workers/decodeDraco.js +1 -1
- package/Build/Workers/decodeI3S.js +1 -1
- package/Build/Workers/package.js +1 -1
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +1 -1
- package/Source/Core/BingMapsGeocoderService.js +19 -1
- package/Source/Core/CartographicGeocoderService.js +15 -0
- package/Source/Core/Credit.js +1 -1
- package/Source/Core/FrustumGeometry.js +3 -2
- package/Source/Core/GeocoderService.js +32 -1
- package/Source/Core/GoogleMaps.js +56 -0
- package/Source/Core/Ion.js +2 -1
- package/Source/Core/IonGeocoderService.js +17 -2
- package/Source/Core/OpenCageGeocoderService.js +18 -1
- package/Source/Core/OrthographicFrustum.js +13 -0
- package/Source/Core/PeliasGeocoderService.js +14 -1
- package/Source/Core/PerspectiveFrustum.js +14 -0
- package/Source/Core/Request.js +3 -2
- package/Source/Core/RequestScheduler.js +10 -4
- package/Source/Core/Resource.js +240 -233
- package/Source/DataSources/DataSourceDisplay.js +2 -2
- package/Source/DataSources/EntityCluster.js +126 -128
- package/Source/DataSources/ModelVisualizer.js +5 -3
- package/Source/Renderer/UniformState.js +3 -2
- package/Source/Renderer/demodernizeShader.js +5 -5
- package/Source/Scene/ArcGisBaseMapType.js +12 -0
- package/Source/Scene/ArcGisMapServerImageryProvider.js +162 -20
- package/Source/Scene/ArcGisMapService.js +84 -0
- package/Source/Scene/Camera.js +8 -7
- package/Source/Scene/Cesium3DTile.js +4 -3
- package/Source/Scene/Cesium3DTileset.js +6 -5
- package/Source/Scene/CreditDisplay.js +112 -16
- package/Source/Scene/GlobeSurfaceTileProvider.js +4 -4
- package/Source/Scene/GltfJsonLoader.js +12 -0
- package/Source/Scene/GltfLoader.js +6 -37
- package/Source/Scene/IonImageryProvider.js +11 -11
- package/Source/Scene/Model/MaterialPipelineStage.js +12 -12
- package/Source/Scene/Model/Model.js +90 -47
- package/Source/Scene/Model/UniformType.js +1 -1
- package/Source/Scene/Picking.js +3 -2
- package/Source/Scene/QuadtreePrimitive.js +3 -2
- package/Source/Scene/SceneTransforms.js +3 -2
- package/Source/Scene/ScreenSpaceCameraController.js +140 -32
- package/Source/Scene/Vector3DTilePoints.js +25 -13
- package/Source/Scene/createGooglePhotorealistic3DTileset.js +53 -0
- package/Source/Shaders/AtmosphereCommon.glsl +51 -8
- package/Source/Shaders/AtmosphereCommon.js +51 -8
- package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.glsl +1 -1
- package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.js +1 -1
- package/Source/Shaders/PostProcessStages/AmbientOcclusionModulate.glsl +3 -3
- package/Source/Shaders/PostProcessStages/AmbientOcclusionModulate.js +3 -3
- package/Source/Widget/CesiumWidget.js +12 -0
- package/index.d.ts +244 -17
- package/index.js +14 -10
- package/package.json +4 -4
- package/Build/Workers/PolygonPipeline-32fc92cc.js +0 -1345
- package/Build/Workers/Transforms-9052372a.js +0 -14715
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import Credit from "../Core/Credit.js";
|
|
2
|
+
import defined from "../Core/defined.js";
|
|
3
|
+
import Resource from "../Core/Resource.js";
|
|
4
|
+
|
|
5
|
+
let defaultTokenCredit;
|
|
6
|
+
const defaultAccessToken =
|
|
7
|
+
"AAPKd815e334cb774973b7245e23a67f4d08Js7A8e8xvfBpgnZIzp1jbL3FWJTmx7AKG8wa87OwDcWEu4CxQCNiydpPbGpALiTf";
|
|
8
|
+
/**
|
|
9
|
+
* Default options for accessing the ArcGIS image tile service.
|
|
10
|
+
*
|
|
11
|
+
* An ArcGIS access token is required to access ArcGIS image tile layers.
|
|
12
|
+
* A default token is provided for evaluation purposes only.
|
|
13
|
+
* To obtain an access token, go to {@link https://developers.arcgis.com} and create a free account.
|
|
14
|
+
* More info can be found in the {@link https://developers.arcgis.com/documentation/mapping-apis-and-services/security/ | ArcGIS developer guide}.
|
|
15
|
+
*
|
|
16
|
+
* @see ArcGisMapServerImageryProvider
|
|
17
|
+
* @namespace ArcGisMapService
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
const ArcGisMapService = {};
|
|
21
|
+
/**
|
|
22
|
+
* Gets or sets the default ArcGIS access token.
|
|
23
|
+
*
|
|
24
|
+
* @type {string}
|
|
25
|
+
*/
|
|
26
|
+
ArcGisMapService.defaultAccessToken = defaultAccessToken;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Gets or sets the URL of the ArcGIS World Imagery tile service.
|
|
30
|
+
*
|
|
31
|
+
* @type {string|Resource}
|
|
32
|
+
* @default https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer
|
|
33
|
+
*/
|
|
34
|
+
ArcGisMapService.defaultWorldImageryServer = new Resource({
|
|
35
|
+
url:
|
|
36
|
+
"https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer",
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Gets or sets the URL of the ArcGIS World Hillshade tile service.
|
|
41
|
+
*
|
|
42
|
+
* @type {string|Resource}
|
|
43
|
+
* @default https://ibasemaps-api.arcgis.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer
|
|
44
|
+
*/
|
|
45
|
+
ArcGisMapService.defaultWorldHillshadeServer = new Resource({
|
|
46
|
+
url:
|
|
47
|
+
"https://ibasemaps-api.arcgis.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer",
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Gets or sets the URL of the ArcGIS World Oceans tile service.
|
|
52
|
+
*
|
|
53
|
+
* @type {string|Resource}
|
|
54
|
+
* @default https://ibasemaps-api.arcgis.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer
|
|
55
|
+
*/
|
|
56
|
+
ArcGisMapService.defaultWorldOceanServer = new Resource({
|
|
57
|
+
url:
|
|
58
|
+
"https://ibasemaps-api.arcgis.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer",
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
*
|
|
63
|
+
* @param {string} providedKey
|
|
64
|
+
* @return {string|undefined}
|
|
65
|
+
*/
|
|
66
|
+
ArcGisMapService.getDefaultTokenCredit = function (providedKey) {
|
|
67
|
+
if (providedKey !== defaultAccessToken) {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (!defined(defaultTokenCredit)) {
|
|
72
|
+
const defaultTokenMessage =
|
|
73
|
+
'<b> \
|
|
74
|
+
This application is using a default ArcGIS access token. Please assign <i>Cesium.ArcGisMapService.defaultAccessToken</i> \
|
|
75
|
+
with an API key from your ArcGIS Developer account before using the ArcGIS tile services. \
|
|
76
|
+
You can sign up for a free ArcGIS Developer account at <a href="https://developers.arcgis.com/">https://developers.arcgis.com/</a>.</b>';
|
|
77
|
+
|
|
78
|
+
defaultTokenCredit = new Credit(defaultTokenMessage, true);
|
|
79
|
+
defaultTokenCredit._isDefaultToken = true;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return defaultTokenCredit;
|
|
83
|
+
};
|
|
84
|
+
export default ArcGisMapService;
|
package/Source/Scene/Camera.js
CHANGED
|
@@ -2602,9 +2602,8 @@ function rectangleCameraPosition3D(camera, rectangle, result, updateCamera) {
|
|
|
2602
2602
|
|
|
2603
2603
|
let rightScalar;
|
|
2604
2604
|
let topScalar;
|
|
2605
|
-
const
|
|
2606
|
-
|
|
2607
|
-
camera.frustum._offCenterFrustum.top;
|
|
2605
|
+
const offCenterFrustum = camera.frustum._offCenterFrustum;
|
|
2606
|
+
const ratio = offCenterFrustum.right / offCenterFrustum.top;
|
|
2608
2607
|
const heightRatio = height * ratio;
|
|
2609
2608
|
if (width > heightRatio) {
|
|
2610
2609
|
rightScalar = width;
|
|
@@ -2950,8 +2949,9 @@ function getPickRayOrthographic(camera, windowPosition, result) {
|
|
|
2950
2949
|
const height = canvas.clientHeight;
|
|
2951
2950
|
|
|
2952
2951
|
let frustum = camera.frustum;
|
|
2953
|
-
|
|
2954
|
-
|
|
2952
|
+
const offCenterFrustum = frustum.offCenterFrustum;
|
|
2953
|
+
if (defined(offCenterFrustum)) {
|
|
2954
|
+
frustum = offCenterFrustum;
|
|
2955
2955
|
}
|
|
2956
2956
|
let x = (2.0 / width) * windowPosition.x - 1.0;
|
|
2957
2957
|
x *= (frustum.right - frustum.left) * 0.5;
|
|
@@ -3440,8 +3440,9 @@ function distanceToBoundingSphere3D(camera, radius) {
|
|
|
3440
3440
|
|
|
3441
3441
|
function distanceToBoundingSphere2D(camera, radius) {
|
|
3442
3442
|
let frustum = camera.frustum;
|
|
3443
|
-
|
|
3444
|
-
|
|
3443
|
+
const offCenterFrustum = frustum.offCenterFrustum;
|
|
3444
|
+
if (defined(offCenterFrustum)) {
|
|
3445
|
+
frustum = offCenterFrustum;
|
|
3445
3446
|
}
|
|
3446
3447
|
|
|
3447
3448
|
let right, top;
|
|
@@ -917,8 +917,9 @@ Cesium3DTile.prototype.getScreenSpaceError = function (
|
|
|
917
917
|
frameState.mode === SceneMode.SCENE2D ||
|
|
918
918
|
frustum instanceof OrthographicFrustum
|
|
919
919
|
) {
|
|
920
|
-
|
|
921
|
-
|
|
920
|
+
const offCenterFrustum = frustum.offCenterFrustum;
|
|
921
|
+
if (defined(offCenterFrustum)) {
|
|
922
|
+
frustum = offCenterFrustum;
|
|
922
923
|
}
|
|
923
924
|
const pixelSize =
|
|
924
925
|
Math.max(frustum.top - frustum.bottom, frustum.right - frustum.left) /
|
|
@@ -1796,7 +1797,7 @@ Cesium3DTile.prototype.createBoundingVolume = function (
|
|
|
1796
1797
|
*/
|
|
1797
1798
|
Cesium3DTile.prototype.updateTransform = function (parentTransform) {
|
|
1798
1799
|
parentTransform = defaultValue(parentTransform, Matrix4.IDENTITY);
|
|
1799
|
-
const computedTransform = Matrix4.
|
|
1800
|
+
const computedTransform = Matrix4.multiplyTransformation(
|
|
1800
1801
|
parentTransform,
|
|
1801
1802
|
this.transform,
|
|
1802
1803
|
scratchTransform
|
|
@@ -141,7 +141,7 @@ import Cesium3DTilesetSkipTraversal from "./Cesium3DTilesetSkipTraversal.js";
|
|
|
141
141
|
* try {
|
|
142
142
|
* const tileset = await Cesium.Cesium3DTileset.fromUrl(
|
|
143
143
|
* "http://localhost:8002/tilesets/Seattle/tileset.json"
|
|
144
|
-
*
|
|
144
|
+
* );
|
|
145
145
|
* scene.primitives.add(tileset);
|
|
146
146
|
* } catch (error) {
|
|
147
147
|
* console.error(`Error creating tileset: ${error}`);
|
|
@@ -2029,7 +2029,7 @@ Cesium3DTileset.fromIonAssetId = async function (assetId, options) {
|
|
|
2029
2029
|
* used for streaming massive heterogeneous 3D geospatial datasets.
|
|
2030
2030
|
*
|
|
2031
2031
|
* @param {Resource|string} url The url to a tileset JSON file.
|
|
2032
|
-
* @param {Cesium3DTileset.ConstructorOptions} options An object describing initialization options
|
|
2032
|
+
* @param {Cesium3DTileset.ConstructorOptions} [options] An object describing initialization options
|
|
2033
2033
|
* @returns {Promise<Cesium3DTileset>}
|
|
2034
2034
|
*
|
|
2035
2035
|
* @exception {DeveloperError} The tileset must be 3D Tiles version 0.0 or 1.0.
|
|
@@ -2040,7 +2040,7 @@ Cesium3DTileset.fromIonAssetId = async function (assetId, options) {
|
|
|
2040
2040
|
* try {
|
|
2041
2041
|
* const tileset = await Cesium.Cesium3DTileset.fromUrl(
|
|
2042
2042
|
* "http://localhost:8002/tilesets/Seattle/tileset.json"
|
|
2043
|
-
*
|
|
2043
|
+
* );
|
|
2044
2044
|
* scene.primitives.add(tileset);
|
|
2045
2045
|
* } catch (error) {
|
|
2046
2046
|
* console.error(`Error creating tileset: ${error}`);
|
|
@@ -3211,8 +3211,9 @@ function update(tileset, frameState, passStatistics, passOptions) {
|
|
|
3211
3211
|
if (defined(credits) && statistics.selected !== 0) {
|
|
3212
3212
|
for (let i = 0; i < credits.length; ++i) {
|
|
3213
3213
|
const credit = credits[i];
|
|
3214
|
-
credit.showOnScreen =
|
|
3215
|
-
|
|
3214
|
+
credit.showOnScreen =
|
|
3215
|
+
tileset._showCreditsOnScreen || credit._isDefaultToken;
|
|
3216
|
+
frameState.creditDisplay.addCreditToNextFrame(credit);
|
|
3216
3217
|
}
|
|
3217
3218
|
}
|
|
3218
3219
|
}
|
|
@@ -4,6 +4,7 @@ import Check from "../Core/Check.js";
|
|
|
4
4
|
import Credit from "../Core/Credit.js";
|
|
5
5
|
import defaultValue from "../Core/defaultValue.js";
|
|
6
6
|
import defined from "../Core/defined.js";
|
|
7
|
+
import deprecationWarning from "../Core/deprecationWarning.js";
|
|
7
8
|
import destroyObject from "../Core/destroyObject.js";
|
|
8
9
|
import Uri from "urijs";
|
|
9
10
|
|
|
@@ -303,7 +304,14 @@ function appendCss(container) {
|
|
|
303
304
|
* @constructor
|
|
304
305
|
*
|
|
305
306
|
* @example
|
|
306
|
-
*
|
|
307
|
+
* // Add a credit with a tooltip, image and link to display onscreen
|
|
308
|
+
* const credit = new Cesium.Credit(`<a href="https://cesium.com/" target="_blank"><img src="/images/cesium_logo.png" title="Cesium"/></a>`, true);
|
|
309
|
+
* viewer.creditDisplay.addStaticCredit(credit);
|
|
310
|
+
*
|
|
311
|
+
* @example
|
|
312
|
+
* // Add a credit with a plaintext link to display in the lightbox
|
|
313
|
+
* const credit = new Cesium.Credit('<a href="https://cesium.com/" target="_blank">Cesium</a>');
|
|
314
|
+
* viewer.creditDisplay.addStaticCredit(credit);
|
|
307
315
|
*/
|
|
308
316
|
function CreditDisplay(container, delimiter, viewport) {
|
|
309
317
|
//>>includeStart('debug', pragmas.debug);
|
|
@@ -373,7 +381,7 @@ function CreditDisplay(container, delimiter, viewport) {
|
|
|
373
381
|
this._hideLightbox = hideLightbox;
|
|
374
382
|
this._expandLink = expandLink;
|
|
375
383
|
this._expanded = false;
|
|
376
|
-
this.
|
|
384
|
+
this._staticCredits = [];
|
|
377
385
|
this._cesiumCredit = cesiumCredit;
|
|
378
386
|
this._previousCesiumCredit = undefined;
|
|
379
387
|
this._currentCesiumCredit = cesiumCredit;
|
|
@@ -418,17 +426,36 @@ function setCredit(creditDisplay, credits, credit, count) {
|
|
|
418
426
|
}
|
|
419
427
|
/**
|
|
420
428
|
* Adds a credit to the list of current credits to be displayed in the credit container
|
|
429
|
+
* for the next frame
|
|
421
430
|
*
|
|
422
431
|
* @param {Credit} credit The credit to display
|
|
432
|
+
* @deprecated
|
|
423
433
|
*/
|
|
424
434
|
CreditDisplay.prototype.addCredit = function (credit) {
|
|
435
|
+
deprecationWarning(
|
|
436
|
+
"CreditDisplay.addCredit",
|
|
437
|
+
"CreditDisplay.addCredit was deprecated in CesiumJS 1.105. It will be removed in CesiumJS 1.107. Use CreditDisplay.addCreditToNextFrame instead."
|
|
438
|
+
);
|
|
439
|
+
|
|
440
|
+
this.addCreditToNextFrame(credit);
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Adds a {@link Credit} that will show on screen or in the lightbox until
|
|
445
|
+
* the next frame. This is mostly for internal use. Use {@link CreditDisplay.addStaticCredit} to add a persistent credit to the screen.
|
|
446
|
+
*
|
|
447
|
+
* @see CreditDisplay.addStaticCredit
|
|
448
|
+
*
|
|
449
|
+
* @param {Credit} credit The credit to display in the next frame.
|
|
450
|
+
*/
|
|
451
|
+
CreditDisplay.prototype.addCreditToNextFrame = function (credit) {
|
|
425
452
|
//>>includeStart('debug', pragmas.debug);
|
|
426
453
|
Check.defined("credit", credit);
|
|
427
454
|
//>>includeEnd('debug');
|
|
428
455
|
|
|
429
456
|
if (credit._isIon) {
|
|
430
457
|
// If this is the an ion logo credit from the ion server
|
|
431
|
-
//
|
|
458
|
+
// Just use the default credit (which is identical) to avoid blinking
|
|
432
459
|
if (!defined(this._defaultCredit)) {
|
|
433
460
|
this._defaultCredit = Credit.clone(getDefaultCredit());
|
|
434
461
|
}
|
|
@@ -450,40 +477,94 @@ CreditDisplay.prototype.addCredit = function (credit) {
|
|
|
450
477
|
* Adds credits that will persist until they are removed
|
|
451
478
|
*
|
|
452
479
|
* @param {Credit} credit The credit to added to defaults
|
|
480
|
+
*
|
|
481
|
+
* @deprecated
|
|
453
482
|
*/
|
|
454
483
|
CreditDisplay.prototype.addDefaultCredit = function (credit) {
|
|
455
484
|
//>>includeStart('debug', pragmas.debug);
|
|
456
485
|
Check.defined("credit", credit);
|
|
457
486
|
//>>includeEnd('debug');
|
|
458
487
|
|
|
459
|
-
|
|
488
|
+
deprecationWarning(
|
|
489
|
+
"CreditDisplay.addDefaultCredit",
|
|
490
|
+
"CreditDisplay.addDefaultCredit was deprecated in CesiumJS 1.105. It will be removed in CesiumJS 1.107. Use CreditDisplay.addStaticCredit instead."
|
|
491
|
+
);
|
|
492
|
+
|
|
493
|
+
const defaultCredits = this._staticCredits;
|
|
460
494
|
if (!contains(defaultCredits, credit)) {
|
|
495
|
+
credit.showOnScreen = true;
|
|
461
496
|
defaultCredits.push(credit);
|
|
462
497
|
}
|
|
463
498
|
};
|
|
464
499
|
|
|
465
500
|
/**
|
|
466
|
-
*
|
|
501
|
+
* Adds a {@link Credit} that will show on screen or in the lightbox until removed with {@link CreditDisplay.removeStaticCredit}.
|
|
467
502
|
*
|
|
468
|
-
* @param {Credit} credit The credit to
|
|
503
|
+
* @param {Credit} credit The credit to added
|
|
504
|
+
*
|
|
505
|
+
* @example
|
|
506
|
+
* // Add a credit with a tooltip, image and link to display onscreen
|
|
507
|
+
* const credit = new Cesium.Credit(`<a href="https://cesium.com/" target="_blank"><img src="/images/cesium_logo.png" title="Cesium"/></a>`, true);
|
|
508
|
+
* viewer.creditDisplay.addStaticCredit(credit);
|
|
509
|
+
*
|
|
510
|
+
* @example
|
|
511
|
+
* // Add a credit with a plaintext link to display in the lightbox
|
|
512
|
+
* const credit = new Cesium.Credit('<a href="https://cesium.com/" target="_blank">Cesium</a>');
|
|
513
|
+
* viewer.creditDisplay.addStaticCredit(credit);
|
|
469
514
|
*/
|
|
470
|
-
CreditDisplay.prototype.
|
|
515
|
+
CreditDisplay.prototype.addStaticCredit = function (credit) {
|
|
516
|
+
//>>includeStart('debug', pragmas.debug);
|
|
517
|
+
Check.defined("credit", credit);
|
|
518
|
+
//>>includeEnd('debug');
|
|
519
|
+
|
|
520
|
+
const staticCredits = this._staticCredits;
|
|
521
|
+
if (!contains(staticCredits, credit)) {
|
|
522
|
+
staticCredits.push(credit);
|
|
523
|
+
}
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* Removes a static credit shown on screen or in the lightbox.
|
|
528
|
+
*
|
|
529
|
+
* @param {Credit} credit The credit to be removed.
|
|
530
|
+
*/
|
|
531
|
+
CreditDisplay.prototype.removeStaticCredit = function (credit) {
|
|
471
532
|
//>>includeStart('debug', pragmas.debug);
|
|
472
533
|
Check.defined("credit", credit);
|
|
473
534
|
//>>includeEnd('debug');
|
|
474
535
|
|
|
475
|
-
const
|
|
476
|
-
const index =
|
|
536
|
+
const staticCredits = this._staticCredits;
|
|
537
|
+
const index = staticCredits.indexOf(credit);
|
|
477
538
|
if (index !== -1) {
|
|
478
|
-
|
|
539
|
+
staticCredits.splice(index, 1);
|
|
479
540
|
}
|
|
480
541
|
};
|
|
481
542
|
|
|
543
|
+
/**
|
|
544
|
+
* Removes a default credit.
|
|
545
|
+
*
|
|
546
|
+
* @param {Credit} credit The credit to be removed from defaults
|
|
547
|
+
*/
|
|
548
|
+
CreditDisplay.prototype.removeDefaultCredit = function (credit) {
|
|
549
|
+
deprecationWarning(
|
|
550
|
+
"CreditDisplay.removeDefaultCredit",
|
|
551
|
+
"CreditDisplay.removeDefaultCredit was deprecated in CesiumJS 1.105. It will be removed in CesiumJS 1.107. Use CreditDisplay.addStaticCredit instead."
|
|
552
|
+
);
|
|
553
|
+
|
|
554
|
+
this.removeStaticCredit(credit);
|
|
555
|
+
};
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
* @private
|
|
559
|
+
*/
|
|
482
560
|
CreditDisplay.prototype.showLightbox = function () {
|
|
483
561
|
this._lightbox.style.display = "block";
|
|
484
562
|
this._expanded = true;
|
|
485
563
|
};
|
|
486
564
|
|
|
565
|
+
/**
|
|
566
|
+
* @private
|
|
567
|
+
*/
|
|
487
568
|
CreditDisplay.prototype.hideLightbox = function () {
|
|
488
569
|
this._lightbox.style.display = "none";
|
|
489
570
|
this._expanded = false;
|
|
@@ -506,14 +587,29 @@ CreditDisplay.prototype.beginFrame = function () {
|
|
|
506
587
|
this._creditDisplayElementPoolIndex = 0;
|
|
507
588
|
|
|
508
589
|
const screenCredits = currentFrameCredits.screenCredits;
|
|
590
|
+
const lightboxCredits = currentFrameCredits.lightboxCredits;
|
|
591
|
+
|
|
509
592
|
screenCredits.removeAll();
|
|
510
|
-
|
|
511
|
-
for (let i = 0; i < defaultCredits.length; ++i) {
|
|
512
|
-
const defaultCredit = defaultCredits[i];
|
|
513
|
-
setCredit(this, screenCredits, defaultCredit, Number.MAX_VALUE);
|
|
514
|
-
}
|
|
593
|
+
lightboxCredits.removeAll();
|
|
515
594
|
|
|
516
|
-
|
|
595
|
+
const staticCredits = this._staticCredits;
|
|
596
|
+
for (let i = 0; i < staticCredits.length; ++i) {
|
|
597
|
+
const staticCredit = staticCredits[i];
|
|
598
|
+
const creditCollection = staticCredit.showOnScreen
|
|
599
|
+
? screenCredits
|
|
600
|
+
: lightboxCredits;
|
|
601
|
+
|
|
602
|
+
if (
|
|
603
|
+
staticCredit._isIon &&
|
|
604
|
+
Credit.equals(CreditDisplay.cesiumCredit, this._cesiumCredit)
|
|
605
|
+
) {
|
|
606
|
+
// If this is an ion logo credit from the ion server,
|
|
607
|
+
// make sure to de-duplicate with the default ion credit
|
|
608
|
+
continue;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
setCredit(this, creditCollection, staticCredit, Number.MAX_VALUE);
|
|
612
|
+
}
|
|
517
613
|
|
|
518
614
|
if (!Credit.equals(CreditDisplay.cesiumCredit, this._cesiumCredit)) {
|
|
519
615
|
this._cesiumCredit = Credit.clone(CreditDisplay.cesiumCredit);
|
|
@@ -352,7 +352,7 @@ function updateCredits(surface, frameState) {
|
|
|
352
352
|
surface._terrainProvider._ready &&
|
|
353
353
|
defined(surface._terrainProvider.credit)
|
|
354
354
|
) {
|
|
355
|
-
creditDisplay.
|
|
355
|
+
creditDisplay.addCreditToNextFrame(surface._terrainProvider.credit);
|
|
356
356
|
}
|
|
357
357
|
|
|
358
358
|
const imageryLayers = surface._imageryLayers;
|
|
@@ -364,7 +364,7 @@ function updateCredits(surface, frameState) {
|
|
|
364
364
|
layer.imageryProvider._ready &&
|
|
365
365
|
defined(layer.imageryProvider.credit)
|
|
366
366
|
) {
|
|
367
|
-
creditDisplay.
|
|
367
|
+
creditDisplay.addCreditToNextFrame(layer.imageryProvider.credit);
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
370
|
}
|
|
@@ -2098,7 +2098,7 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
|
|
|
2098
2098
|
tileCreditIndex < tileCreditLength;
|
|
2099
2099
|
++tileCreditIndex
|
|
2100
2100
|
) {
|
|
2101
|
-
creditDisplay.
|
|
2101
|
+
creditDisplay.addCreditToNextFrame(tileCredits[tileCreditIndex]);
|
|
2102
2102
|
}
|
|
2103
2103
|
}
|
|
2104
2104
|
|
|
@@ -2719,7 +2719,7 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
|
|
|
2719
2719
|
creditIndex < creditLength;
|
|
2720
2720
|
++creditIndex
|
|
2721
2721
|
) {
|
|
2722
|
-
creditDisplay.
|
|
2722
|
+
creditDisplay.addCreditToNextFrame(credits[creditIndex]);
|
|
2723
2723
|
}
|
|
2724
2724
|
}
|
|
2725
2725
|
|
|
@@ -5,6 +5,7 @@ import getJsonFromTypedArray from "../Core/getJsonFromTypedArray.js";
|
|
|
5
5
|
import getMagic from "../Core/getMagic.js";
|
|
6
6
|
import isDataUri from "../Core/isDataUri.js";
|
|
7
7
|
import Resource from "../Core/Resource.js";
|
|
8
|
+
import RuntimeError from "../Core/RuntimeError.js";
|
|
8
9
|
import addDefaults from "./GltfPipeline/addDefaults.js";
|
|
9
10
|
import addPipelineExtras from "./GltfPipeline/addPipelineExtras.js";
|
|
10
11
|
import ForEach from "./GltfPipeline/ForEach.js";
|
|
@@ -14,6 +15,7 @@ import updateVersion from "./GltfPipeline/updateVersion.js";
|
|
|
14
15
|
import usesExtension from "./GltfPipeline/usesExtension.js";
|
|
15
16
|
import ResourceLoader from "./ResourceLoader.js";
|
|
16
17
|
import ResourceLoaderState from "./ResourceLoaderState.js";
|
|
18
|
+
import ModelUtility from "./Model/ModelUtility.js";
|
|
17
19
|
|
|
18
20
|
/**
|
|
19
21
|
* Loads a glTF JSON from a glTF or glb.
|
|
@@ -242,6 +244,16 @@ async function processGltfJson(gltfJsonLoader, gltf) {
|
|
|
242
244
|
await loadEmbeddedBuffers(gltfJsonLoader, gltf);
|
|
243
245
|
removePipelineExtras(gltf);
|
|
244
246
|
|
|
247
|
+
const version = gltf.asset.version;
|
|
248
|
+
if (version !== "1.0" && version !== "2.0") {
|
|
249
|
+
throw new RuntimeError(`Unsupported glTF version: ${version}`);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const extensionsRequired = gltf.extensionsRequired;
|
|
253
|
+
if (defined(extensionsRequired)) {
|
|
254
|
+
ModelUtility.checkSupportedExtensions(extensionsRequired);
|
|
255
|
+
}
|
|
256
|
+
|
|
245
257
|
gltfJsonLoader._gltf = gltf;
|
|
246
258
|
gltfJsonLoader._state = ResourceLoaderState.READY;
|
|
247
259
|
return gltfJsonLoader;
|
|
@@ -18,7 +18,6 @@ import getAccessorByteStride from "./GltfPipeline/getAccessorByteStride.js";
|
|
|
18
18
|
import getComponentReader from "./GltfPipeline/getComponentReader.js";
|
|
19
19
|
import numberOfComponentsForType from "./GltfPipeline/numberOfComponentsForType.js";
|
|
20
20
|
import GltfStructuralMetadataLoader from "./GltfStructuralMetadataLoader.js";
|
|
21
|
-
import ModelUtility from "./Model/ModelUtility.js";
|
|
22
21
|
import AttributeType from "./AttributeType.js";
|
|
23
22
|
import Axis from "./Axis.js";
|
|
24
23
|
import GltfLoaderUtil from "./GltfLoaderUtil.js";
|
|
@@ -240,12 +239,6 @@ function GltfLoader(options) {
|
|
|
240
239
|
this._loadForClassification = loadForClassification;
|
|
241
240
|
this._renameBatchIdSemantic = renameBatchIdSemantic;
|
|
242
241
|
|
|
243
|
-
// This flag will be set in parse() if the KHR_mesh_quantization extension is
|
|
244
|
-
// present in extensionsRequired. This flag is used later when parsing
|
|
245
|
-
// attributes. When the extension is present, attributes may be stored as
|
|
246
|
-
// quantized integer values instead of floats.
|
|
247
|
-
this._hasKhrMeshQuantization = false;
|
|
248
|
-
|
|
249
242
|
// When loading EXT_feature_metadata, the feature tables and textures
|
|
250
243
|
// are now stored as arrays like the newer EXT_structural_metadata extension.
|
|
251
244
|
// This requires sorting the dictionary keys for a consistent ordering.
|
|
@@ -392,26 +385,6 @@ async function loadGltfJson(loader) {
|
|
|
392
385
|
return;
|
|
393
386
|
}
|
|
394
387
|
|
|
395
|
-
const gltf = gltfJsonLoader.gltf;
|
|
396
|
-
const version = gltf.asset.version;
|
|
397
|
-
if (version !== "1.0" && version !== "2.0") {
|
|
398
|
-
const url = loader._gltfResource.url;
|
|
399
|
-
throw new RuntimeError(
|
|
400
|
-
`Failed to load ${url}: \nUnsupported glTF version: ${version}`
|
|
401
|
-
);
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
const extensionsRequired = gltf.extensionsRequired;
|
|
405
|
-
if (defined(extensionsRequired)) {
|
|
406
|
-
ModelUtility.checkSupportedExtensions(extensionsRequired);
|
|
407
|
-
|
|
408
|
-
// Check for the KHR_mesh_quantization extension here, it will be used later
|
|
409
|
-
// in loadAttribute().
|
|
410
|
-
loader._hasKhrMeshQuantization = extensionsRequired.includes(
|
|
411
|
-
"KHR_mesh_quantization"
|
|
412
|
-
);
|
|
413
|
-
}
|
|
414
|
-
|
|
415
388
|
loader._state = GltfLoaderState.LOADED;
|
|
416
389
|
loader._textureState = GltfLoaderState.LOADED;
|
|
417
390
|
|
|
@@ -1014,14 +987,7 @@ function setQuantizationFromWeb3dQuantizedAttributes(
|
|
|
1014
987
|
attribute.quantization = quantization;
|
|
1015
988
|
}
|
|
1016
989
|
|
|
1017
|
-
function createAttribute(
|
|
1018
|
-
gltf,
|
|
1019
|
-
accessorId,
|
|
1020
|
-
name,
|
|
1021
|
-
semantic,
|
|
1022
|
-
setIndex,
|
|
1023
|
-
hasKhrMeshQuantization
|
|
1024
|
-
) {
|
|
990
|
+
function createAttribute(gltf, accessorId, name, semantic, setIndex) {
|
|
1025
991
|
const accessor = gltf.accessors[accessorId];
|
|
1026
992
|
const MathType = AttributeType.getMathType(accessor.type);
|
|
1027
993
|
const normalized = defaultValue(accessor.normalized, false);
|
|
@@ -1057,6 +1023,10 @@ function createAttribute(
|
|
|
1057
1023
|
// In the glTF 2.0 spec, min and max are not affected by the normalized flag.
|
|
1058
1024
|
// However, for KHR_mesh_quantization, min and max must be dequantized for
|
|
1059
1025
|
// normalized values, else the bounding sphere will be computed incorrectly.
|
|
1026
|
+
const hasKhrMeshQuantization = gltf.extensionsRequired?.includes(
|
|
1027
|
+
"KHR_mesh_quantization"
|
|
1028
|
+
);
|
|
1029
|
+
|
|
1060
1030
|
if (hasKhrMeshQuantization && normalized && isQuantizable) {
|
|
1061
1031
|
dequantizeMinMax(attribute, MathType);
|
|
1062
1032
|
}
|
|
@@ -1197,8 +1167,7 @@ function loadAttribute(
|
|
|
1197
1167
|
accessorId,
|
|
1198
1168
|
name,
|
|
1199
1169
|
modelSemantic,
|
|
1200
|
-
setIndex
|
|
1201
|
-
loader._hasKhrMeshQuantization
|
|
1170
|
+
setIndex
|
|
1202
1171
|
);
|
|
1203
1172
|
|
|
1204
1173
|
if (!defined(draco) && !defined(bufferViewId)) {
|
|
@@ -296,18 +296,18 @@ Object.defineProperties(IonImageryProvider.prototype, {
|
|
|
296
296
|
get: function () {
|
|
297
297
|
return this._imageryProvider.hasAlphaChannel;
|
|
298
298
|
},
|
|
299
|
+
},
|
|
299
300
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
},
|
|
301
|
+
/**
|
|
302
|
+
* Gets the proxy used by this provider.
|
|
303
|
+
* @memberof IonImageryProvider.prototype
|
|
304
|
+
* @type {Proxy}
|
|
305
|
+
* @readonly
|
|
306
|
+
* @default undefined
|
|
307
|
+
*/
|
|
308
|
+
proxy: {
|
|
309
|
+
get: function () {
|
|
310
|
+
return undefined;
|
|
311
311
|
},
|
|
312
312
|
},
|
|
313
313
|
|
|
@@ -245,18 +245,6 @@ function processMaterialUniforms(
|
|
|
245
245
|
defaultEmissiveTexture,
|
|
246
246
|
disableTextures
|
|
247
247
|
) {
|
|
248
|
-
const emissiveTexture = material.emissiveTexture;
|
|
249
|
-
if (defined(emissiveTexture) && !disableTextures) {
|
|
250
|
-
processTexture(
|
|
251
|
-
shaderBuilder,
|
|
252
|
-
uniformMap,
|
|
253
|
-
emissiveTexture,
|
|
254
|
-
"u_emissiveTexture",
|
|
255
|
-
"EMISSIVE",
|
|
256
|
-
defaultEmissiveTexture
|
|
257
|
-
);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
248
|
const emissiveFactor = material.emissiveFactor;
|
|
261
249
|
if (
|
|
262
250
|
defined(emissiveFactor) &&
|
|
@@ -275,6 +263,18 @@ function processMaterialUniforms(
|
|
|
275
263
|
undefined,
|
|
276
264
|
ShaderDestination.FRAGMENT
|
|
277
265
|
);
|
|
266
|
+
|
|
267
|
+
const emissiveTexture = material.emissiveTexture;
|
|
268
|
+
if (defined(emissiveTexture) && !disableTextures) {
|
|
269
|
+
processTexture(
|
|
270
|
+
shaderBuilder,
|
|
271
|
+
uniformMap,
|
|
272
|
+
emissiveTexture,
|
|
273
|
+
"u_emissiveTexture",
|
|
274
|
+
"EMISSIVE",
|
|
275
|
+
defaultEmissiveTexture
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
278
|
}
|
|
279
279
|
|
|
280
280
|
const normalTexture = material.normalTexture;
|