@cesium/engine 22.3.0 → 23.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-EAAH543Q.js → chunk-2GL2EUEE.js} +11 -11
- package/Build/Workers/{chunk-EUDHHS7K.js → chunk-2WI4HGJU.js} +6 -6
- package/Build/Workers/{chunk-LWZHJWYK.js → chunk-36LBFITA.js} +665 -366
- package/Build/Workers/{chunk-7U5YNLF3.js → chunk-3B65YFXC.js} +1 -1
- package/Build/Workers/{chunk-D63Z7KKL.js → chunk-4LGFX2P5.js} +11 -11
- package/Build/Workers/{chunk-D6OKR3BQ.js → chunk-4UNQX2MP.js} +2 -2
- package/Build/Workers/{chunk-BO22JHBX.js → chunk-52K3GJKG.js} +3 -3
- package/Build/Workers/{chunk-XLIJV3YZ.js → chunk-56OHFSLH.js} +10 -10
- package/Build/Workers/{chunk-AWELU5C6.js → chunk-5A7YSAXT.js} +14 -14
- package/Build/Workers/{chunk-T5MJDW43.js → chunk-5JP5FG7U.js} +7 -7
- package/Build/Workers/{chunk-NVL7JXAQ.js → chunk-5R7SBUTW.js} +10 -10
- package/Build/Workers/chunk-5VKZVPO5.js +1829 -0
- package/Build/Workers/{chunk-YHPBT4I5.js → chunk-6FVFM2KB.js} +5 -5
- package/Build/Workers/{chunk-WHLGBMBC.js → chunk-6SLGTBB2.js} +5 -5
- package/Build/Workers/{chunk-VIQIKMTZ.js → chunk-7KRN6JPQ.js} +14 -14
- package/Build/Workers/{chunk-TCOUGKXF.js → chunk-AA33B6PU.js} +4 -4
- package/Build/Workers/{chunk-S2KVL7OJ.js → chunk-AP6XWET5.js} +8 -8
- package/Build/Workers/{chunk-5PJB7ASO.js → chunk-APDKMX7W.js} +6 -6
- package/Build/Workers/{chunk-IXL46IYV.js → chunk-ARCFIOKA.js} +12 -12
- package/Build/Workers/{chunk-KIJR26N3.js → chunk-BNBD2YZK.js} +16 -16
- package/Build/Workers/{chunk-4R6FGUFP.js → chunk-DT5SJBKA.js} +29 -15
- package/Build/Workers/{chunk-FUDC3KOT.js → chunk-ESD4IEOU.js} +5 -5
- package/Build/Workers/{chunk-K2PLKJJG.js → chunk-FSDVXW7M.js} +5 -5
- package/Build/Workers/{chunk-4BBANFU6.js → chunk-G3YT7M7A.js} +1 -1
- package/Build/Workers/{chunk-K4PGSAR5.js → chunk-GN5NEUDT.js} +8 -8
- package/Build/Workers/{chunk-OOYICVOK.js → chunk-HYLEKKO5.js} +1 -1
- package/Build/Workers/{chunk-FDOLXORR.js → chunk-HYTFXWMY.js} +7 -7
- package/Build/Workers/{chunk-7SLNBIZS.js → chunk-IFA7VHHP.js} +560 -277
- package/Build/Workers/{chunk-N66PIK46.js → chunk-IYVDOB5V.js} +4 -4
- package/Build/Workers/{chunk-ZWWN2CQH.js → chunk-JUGY5AZN.js} +4 -4
- package/Build/Workers/{chunk-4O2ARYS7.js → chunk-KPYU6YZG.js} +1 -1
- package/Build/Workers/{chunk-TY5JXMVO.js → chunk-L7RDJ4V7.js} +1 -1
- package/Build/Workers/{chunk-L4OFWHNI.js → chunk-LDQWNMEC.js} +1 -1
- package/Build/Workers/{chunk-N6XBJBI7.js → chunk-MQJG522T.js} +6 -6
- package/Build/Workers/{chunk-FS42VX2H.js → chunk-MT5M7RLZ.js} +2 -2
- package/Build/Workers/{chunk-7ATKQRBM.js → chunk-N4AWE7TZ.js} +10 -10
- package/Build/Workers/{chunk-EOSX23OS.js → chunk-NAYRNPEP.js} +4 -4
- package/Build/Workers/{chunk-NO3LMU7T.js → chunk-NNHU33JK.js} +7 -7
- package/Build/Workers/{chunk-HWGP4GVC.js → chunk-NQCAZU7S.js} +13 -13
- package/Build/Workers/{chunk-6GBGEUWR.js → chunk-NUYLNQKV.js} +2 -2
- package/Build/Workers/{chunk-E4YDCSQK.js → chunk-OC6X22PG.js} +9 -9
- package/Build/Workers/{chunk-ZGGVEGTA.js → chunk-OHBM4YG4.js} +12 -12
- package/Build/Workers/{chunk-6WDMPXQ7.js → chunk-OMXN7YF4.js} +12 -12
- package/Build/Workers/{chunk-LK7GEFGB.js → chunk-OQ3EAJNW.js} +2 -2
- package/Build/Workers/{chunk-M5DVYXJJ.js → chunk-OQBPOKPZ.js} +6 -6
- package/Build/Workers/{chunk-WUWPKBOZ.js → chunk-PQVNT5CJ.js} +6 -6
- package/Build/Workers/{chunk-W5NV72VR.js → chunk-QA24Q62E.js} +17 -17
- package/Build/Workers/{chunk-PJLRXIMS.js → chunk-QQX7S5QT.js} +17 -17
- package/Build/Workers/{chunk-D2PEV362.js → chunk-QTOHIXGF.js} +10 -10
- package/Build/Workers/{chunk-MASEF4OV.js → chunk-R7M4XNPP.js} +8 -8
- package/Build/Workers/{chunk-2MLJ46ZZ.js → chunk-SGKTBHFQ.js} +13 -13
- package/Build/Workers/{chunk-EY5HOJFQ.js → chunk-SQTRWKO2.js} +5 -5
- package/Build/Workers/{chunk-AFGP5BXS.js → chunk-T43FXHNC.js} +7 -7
- package/Build/Workers/{chunk-IHFAFGR2.js → chunk-UEEGWJJP.js} +2 -2
- package/Build/Workers/{chunk-TMGLPEZW.js → chunk-WKXDCVBO.js} +4 -4
- package/Build/Workers/{chunk-VRAAQ3FS.js → chunk-Y5AJSEEN.js} +2 -2
- package/Build/Workers/{chunk-Y5MRBKQN.js → chunk-ZIW5FCIW.js} +18 -18
- package/Build/Workers/combineGeometry.js +24 -24
- package/Build/Workers/createBoxGeometry.js +18 -18
- package/Build/Workers/createBoxOutlineGeometry.js +16 -16
- package/Build/Workers/createCircleGeometry.js +26 -26
- package/Build/Workers/createCircleOutlineGeometry.js +19 -19
- package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
- package/Build/Workers/createCorridorGeometry.js +29 -29
- package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
- package/Build/Workers/createCylinderGeometry.js +20 -20
- package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
- package/Build/Workers/createEllipseGeometry.js +26 -26
- package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
- package/Build/Workers/createEllipsoidGeometry.js +19 -19
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
- package/Build/Workers/createFrustumGeometry.js +18 -18
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
- package/Build/Workers/createGeometry.js +24 -24
- package/Build/Workers/createGroundPolylineGeometry.js +22 -22
- package/Build/Workers/createPlaneGeometry.js +16 -16
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
- package/Build/Workers/createPolygonGeometry.js +32 -32
- package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
- package/Build/Workers/createPolylineGeometry.js +25 -25
- package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
- package/Build/Workers/createRectangleGeometry.js +27 -27
- package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
- package/Build/Workers/createSimplePolylineGeometry.js +23 -23
- package/Build/Workers/createSphereGeometry.js +19 -19
- package/Build/Workers/createSphereOutlineGeometry.js +18 -18
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -24
- package/Build/Workers/createVectorTilePoints.js +13 -13
- package/Build/Workers/createVectorTilePolygons.js +22 -22
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
- package/Build/Workers/createVerticesFromHeightmap.js +22 -22
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
- package/Build/Workers/createWallGeometry.js +24 -24
- package/Build/Workers/createWallOutlineGeometry.js +23 -23
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +10 -10
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
- package/Build/Workers/transcodeKTX2.js +6 -6
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Source/Core/AttributeCompression.js +53 -6
- package/Source/Core/Cartesian2.js +689 -684
- package/Source/Core/Cartesian3.js +1044 -1043
- package/Source/Core/Cartesian4.js +816 -813
- package/Source/Core/GoogleMaps.js +23 -2
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/OpenCageGeocoderService.js +2 -3
- package/Source/Core/globalTypes.js +16 -0
- package/Source/Renderer/ShaderDestination.js +54 -13
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Billboard.js +7 -4
- package/Source/Scene/BillboardCollection.js +64 -25
- package/Source/Scene/BufferLoader.js +65 -74
- package/Source/Scene/CubeMapPanorama.js +351 -0
- package/Source/Scene/DerivedCommand.js +8 -31
- package/Source/Scene/DracoLoader.js +79 -78
- package/Source/Scene/EquirectangularPanorama.js +264 -0
- package/Source/Scene/FrameState.js +7 -0
- package/Source/Scene/GaussianSplatPrimitive.js +906 -167
- package/Source/Scene/GlobeSurfaceShaderSet.js +36 -32
- package/Source/Scene/GltfBufferViewLoader.js +109 -118
- package/Source/Scene/GltfDracoLoader.js +167 -176
- package/Source/Scene/GltfImageLoader.js +91 -101
- package/Source/Scene/GltfIndexBufferLoader.js +228 -241
- package/Source/Scene/GltfJsonLoader.js +90 -99
- package/Source/Scene/GltfLoader.js +313 -324
- package/Source/Scene/GltfSpzLoader.js +127 -134
- package/Source/Scene/GltfStructuralMetadataLoader.js +181 -186
- package/Source/Scene/GltfTextureLoader.js +217 -231
- package/Source/Scene/GltfVertexBufferLoader.js +267 -276
- package/Source/Scene/GoogleStreetViewCubeMapPanoramaProvider.js +341 -0
- package/Source/Scene/Label.js +6 -4
- package/Source/Scene/LabelCollection.js +59 -1
- package/Source/Scene/MetadataClassProperty.js +212 -7
- package/Source/Scene/MetadataComponentType.js +162 -127
- package/Source/Scene/MetadataSchemaLoader.js +60 -67
- package/Source/Scene/MetadataTable.js +14 -0
- package/Source/Scene/MetadataTableProperty.js +14 -0
- package/Source/Scene/Model/B3dmLoader.js +216 -224
- package/Source/Scene/Model/CustomShader.js +6 -1
- package/Source/Scene/Model/CustomShaderPipelineStage.js +122 -7
- package/Source/Scene/Model/GeoJsonLoader.js +53 -61
- package/Source/Scene/Model/GeometryPipelineStage.js +17 -3
- package/Source/Scene/Model/I3dmLoader.js +232 -240
- package/Source/Scene/Model/MaterialPipelineStage.js +1 -1
- package/Source/Scene/Model/MetadataPipelineStage.js +438 -22
- package/Source/Scene/Model/PntsLoader.js +78 -89
- package/Source/Scene/Panorama.js +53 -0
- package/Source/Scene/PanoramaProvider.js +43 -0
- package/Source/Scene/PointPrimitiveCollection.js +14 -22
- package/Source/Scene/PropertyTable.js +43 -0
- package/Source/Scene/PropertyTexture.js +1 -1
- package/Source/Scene/PropertyTextureProperty.js +0 -97
- package/Source/Scene/ResourceLoader.js +84 -92
- package/Source/Scene/Scene.js +12 -0
- package/Source/Scene/SkyBox.js +29 -164
- package/Source/Scene/StructuralMetadata.js +18 -3
- package/Source/Scene/parseStructuralMetadata.js +244 -0
- package/Source/Shaders/BillboardCollectionFS.glsl +66 -40
- package/Source/Shaders/BillboardCollectionFS.js +67 -40
- package/Source/Shaders/BillboardCollectionVS.glsl +22 -31
- package/Source/Shaders/BillboardCollectionVS.js +22 -31
- package/Source/Shaders/Builtin/CzmBuiltins.js +4 -0
- package/Source/Shaders/Builtin/Functions/decodeRGB8.glsl +22 -0
- package/Source/Shaders/Builtin/Functions/decodeRGB8.js +24 -0
- package/Source/Shaders/Builtin/Functions/unpackTexture.glsl +35 -0
- package/Source/Shaders/Builtin/Functions/unpackTexture.js +37 -0
- package/Source/Shaders/CubeMapPanoramaVS.glsl +11 -0
- package/Source/Shaders/CubeMapPanoramaVS.js +13 -0
- package/Source/Shaders/Model/MetadataStageFS.glsl +2 -1
- package/Source/Shaders/Model/MetadataStageFS.js +2 -1
- package/Source/Shaders/Model/MetadataStageVS.glsl +2 -1
- package/Source/Shaders/Model/MetadataStageVS.js +2 -1
- package/Source/Shaders/Model/ModelFS.glsl +2 -2
- package/Source/Shaders/Model/ModelFS.js +2 -2
- package/Source/Shaders/Model/ModelVS.glsl +2 -2
- package/Source/Shaders/Model/ModelVS.js +2 -2
- package/Source/Shaders/PointPrimitiveCollectionVS.glsl +8 -39
- package/Source/Shaders/PointPrimitiveCollectionVS.js +8 -39
- package/index.d.ts +564 -189
- package/index.js +127 -119
- package/package.json +1 -1
- package/Build/Workers/chunk-LYBNPUEI.js +0 -1443
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import DeveloperError from "../Core/DeveloperError.js";
|
|
2
|
+
import defined from "../Core/defined.js";
|
|
3
|
+
import Resource from "../Core/Resource.js";
|
|
4
|
+
import Cartesian3 from "../Core/Cartesian3.js";
|
|
5
|
+
import Cartographic from "../Core/Cartographic.js";
|
|
6
|
+
import Matrix3 from "../Core/Matrix3.js";
|
|
7
|
+
import Matrix4 from "../Core/Matrix4.js";
|
|
8
|
+
import CesiumMath from "../Core/Math.js";
|
|
9
|
+
import Transforms from "../Core/Transforms.js";
|
|
10
|
+
import Frozen from "../Core/Frozen.js";
|
|
11
|
+
import Ellipsoid from "../Core/Ellipsoid.js";
|
|
12
|
+
import GoogleMaps from "../Core/GoogleMaps.js";
|
|
13
|
+
import CubeMapPanorama from "./CubeMapPanorama.js";
|
|
14
|
+
|
|
15
|
+
const DEFAULT_TILE_SIZE = 600;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* <div class="notice">
|
|
19
|
+
* This object is normally not instantiated directly, use {@link GoogleStreetViewCubeMapPanoramaProvider.fromUrl}.
|
|
20
|
+
* </div>
|
|
21
|
+
*
|
|
22
|
+
*
|
|
23
|
+
* Creates a {@link PanoramaProvider} which provides imagery from {@link https://developers.google.com/maps/documentation/streetview|Google Street View Static API} to be displayed in a panorama.
|
|
24
|
+
*
|
|
25
|
+
* @alias GoogleStreetViewCubeMapPanoramaProvider
|
|
26
|
+
* @constructor
|
|
27
|
+
*
|
|
28
|
+
* @see CubeMapPanorama
|
|
29
|
+
*
|
|
30
|
+
* @demo {@link https://sandcastle.cesium.com/index.html?id=google-streetview-panorama|Cesium Sandcastle Google Streetview Panorama}
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
function GoogleStreetViewCubeMapPanoramaProvider(options) {
|
|
34
|
+
options = options ?? Frozen.EMPTY_OBJECT;
|
|
35
|
+
this._key = defined(options.key) ? options.key : GoogleMaps.defaultApiKey;
|
|
36
|
+
|
|
37
|
+
this._baseResource = Resource.createIfNeeded(
|
|
38
|
+
options.url ?? GoogleMaps.streetViewStaticApiEndpoint,
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
this._metadataResource = this._baseResource.getDerivedResource({
|
|
42
|
+
url: "streetview/metadata",
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
this._tileSize = options.tileSize ?? DEFAULT_TILE_SIZE;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
Object.defineProperties(GoogleStreetViewCubeMapPanoramaProvider.prototype, {});
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Gets the panorama primitive for a requested position and orientation.
|
|
52
|
+
* @param {object} options Object with the following properties:
|
|
53
|
+
* @param {Cartographic} options.cartographic The position to place the panorama in the scene.
|
|
54
|
+
* @param {string} [options.panoId] The panoramaId identifier for the image in the Google API. If not provided this will be looked up for the provided cartographic location.
|
|
55
|
+
* @param {number} [options.tileSize] - Optional tile size override (square).
|
|
56
|
+
* @param {string} [options.signature] - Optional signature for signed URLs. See {@link https://developers.google.com/maps/documentation/streetview/digital-signature} for more information.
|
|
57
|
+
* @param {Credit|string} [options.credit] A credit for the data source, which is displayed on the canvas.
|
|
58
|
+
*
|
|
59
|
+
* @returns {CubeMapPanorama} The panorama primitive textured with imagery.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
*
|
|
63
|
+
* const provider = await Cesium.GoogleStreetViewCubeMapPanoramaProvider.fromUrl({
|
|
64
|
+
* key: 'your Google Streetview Static api key'
|
|
65
|
+
* })
|
|
66
|
+
*
|
|
67
|
+
* const panoIdObject = provider.getNearestPanoId(position);
|
|
68
|
+
* const position = Cartographic.fromDegrees(panoIdObject.location.lng, panoIdObject.location.lat, 0);
|
|
69
|
+
*
|
|
70
|
+
* const primitive = await provider.loadPanorama({
|
|
71
|
+
* cartographic: position,
|
|
72
|
+
* panoId: panoIdObject.panoId
|
|
73
|
+
* });
|
|
74
|
+
* viewer.scene.primitive.add(primitive);
|
|
75
|
+
*
|
|
76
|
+
*/
|
|
77
|
+
GoogleStreetViewCubeMapPanoramaProvider.prototype.loadPanorama =
|
|
78
|
+
async function (options) {
|
|
79
|
+
const cartographic = options.cartographic;
|
|
80
|
+
//>>includeStart('debug', pragmas.debug);
|
|
81
|
+
if (!defined(options.cartographic)) {
|
|
82
|
+
throw new DeveloperError("options.cartographic is required.");
|
|
83
|
+
}
|
|
84
|
+
//>>includeEnd('debug');
|
|
85
|
+
|
|
86
|
+
const tileSize = options.tileSize ?? this._tileSize;
|
|
87
|
+
const tileSizeString = `${tileSize}x${tileSize}`;
|
|
88
|
+
|
|
89
|
+
const signature = options.signature;
|
|
90
|
+
|
|
91
|
+
let { panoId } = options;
|
|
92
|
+
|
|
93
|
+
if (!defined(panoId)) {
|
|
94
|
+
const panoIdObject = await this.getNearestPanoId(cartographic);
|
|
95
|
+
panoId = panoIdObject.panoId;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const credit = GoogleMaps.getDefaultCredit();
|
|
99
|
+
|
|
100
|
+
const posObj = Cartesian3.fromDegrees(
|
|
101
|
+
CesiumMath.toDegrees(cartographic.longitude),
|
|
102
|
+
CesiumMath.toDegrees(cartographic.latitude),
|
|
103
|
+
0,
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
const facePromises = [
|
|
107
|
+
this._loadFaceImage({
|
|
108
|
+
heading: 0,
|
|
109
|
+
pitch: 0,
|
|
110
|
+
tileSizeString,
|
|
111
|
+
panoId,
|
|
112
|
+
signature,
|
|
113
|
+
}),
|
|
114
|
+
this._loadFaceImage({
|
|
115
|
+
heading: 180,
|
|
116
|
+
pitch: 0,
|
|
117
|
+
tileSizeString,
|
|
118
|
+
panoId,
|
|
119
|
+
signature,
|
|
120
|
+
}),
|
|
121
|
+
this._loadFaceImage({
|
|
122
|
+
heading: -90,
|
|
123
|
+
pitch: -90,
|
|
124
|
+
tileSizeString,
|
|
125
|
+
panoId,
|
|
126
|
+
signature,
|
|
127
|
+
}),
|
|
128
|
+
this._loadFaceImage({
|
|
129
|
+
heading: -90,
|
|
130
|
+
pitch: 90,
|
|
131
|
+
tileSizeString,
|
|
132
|
+
panoId,
|
|
133
|
+
signature,
|
|
134
|
+
}),
|
|
135
|
+
this._loadFaceImage({
|
|
136
|
+
heading: 270,
|
|
137
|
+
pitch: 0,
|
|
138
|
+
tileSizeString,
|
|
139
|
+
panoId,
|
|
140
|
+
signature,
|
|
141
|
+
}),
|
|
142
|
+
this._loadFaceImage({
|
|
143
|
+
heading: 90,
|
|
144
|
+
pitch: 0,
|
|
145
|
+
tileSizeString,
|
|
146
|
+
panoId,
|
|
147
|
+
signature,
|
|
148
|
+
}),
|
|
149
|
+
];
|
|
150
|
+
|
|
151
|
+
const [positiveX, negativeX, positiveY, negativeY, positiveZ, negativeZ] =
|
|
152
|
+
await Promise.all(facePromises);
|
|
153
|
+
|
|
154
|
+
const northDownEastToFixedFrameTransform =
|
|
155
|
+
Transforms.localFrameToFixedFrameGenerator("north", "down");
|
|
156
|
+
|
|
157
|
+
const transform = Matrix4.getMatrix3(
|
|
158
|
+
northDownEastToFixedFrameTransform(posObj, Ellipsoid.default),
|
|
159
|
+
new Matrix3(),
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
const panorama = new CubeMapPanorama({
|
|
163
|
+
sources: {
|
|
164
|
+
positiveX,
|
|
165
|
+
negativeX,
|
|
166
|
+
positiveY,
|
|
167
|
+
negativeY,
|
|
168
|
+
positiveZ,
|
|
169
|
+
negativeZ,
|
|
170
|
+
},
|
|
171
|
+
transform: transform,
|
|
172
|
+
credit,
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
return panorama;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Gets the panoIds for the given cartographic location. See {@link https://developers.google.com/maps/documentation/tile/streetview#panoid-search}.
|
|
180
|
+
|
|
181
|
+
* @param {Cartographic} position The position to search for the nearest panoId.
|
|
182
|
+
* @param {number} [radius=50] The radius in meters to search for the nearest panoId.
|
|
183
|
+
*
|
|
184
|
+
* @returns {Object} an object containing a panoId, latitude, and longitude of the closest panorama
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
*
|
|
188
|
+
* const provider = await Cesium.GoogleStreetViewCubeMapPanoramaProvider.fromUrl({
|
|
189
|
+
* key: 'your Google Streetview Static api key'
|
|
190
|
+
* })
|
|
191
|
+
* const panoIds = provider.getNearestPanoId(position);
|
|
192
|
+
*/
|
|
193
|
+
GoogleStreetViewCubeMapPanoramaProvider.prototype.getNearestPanoId =
|
|
194
|
+
async function (position, radius) {
|
|
195
|
+
//>>includeStart('debug', pragmas.debug);
|
|
196
|
+
if (!defined(position)) {
|
|
197
|
+
throw new DeveloperError("position is required.");
|
|
198
|
+
}
|
|
199
|
+
//>>includeEnd('debug');
|
|
200
|
+
|
|
201
|
+
const pos = [
|
|
202
|
+
CesiumMath.toDegrees(position.latitude),
|
|
203
|
+
CesiumMath.toDegrees(position.longitude),
|
|
204
|
+
];
|
|
205
|
+
const posString = pos.join(",");
|
|
206
|
+
|
|
207
|
+
const resource = this._metadataResource.getDerivedResource({
|
|
208
|
+
queryParameters: {
|
|
209
|
+
key: this._key,
|
|
210
|
+
location: posString,
|
|
211
|
+
radius: radius ?? 50,
|
|
212
|
+
},
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
const panoIdObject = await resource.fetchJson();
|
|
216
|
+
|
|
217
|
+
if (panoIdObject.status !== "OK") {
|
|
218
|
+
throw new DeveloperError(
|
|
219
|
+
`GoogleStreetViewCubeMapPanoramaProvider metadata error: ${panoIdObject.status}`,
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
panoId: panoIdObject.pano_id,
|
|
224
|
+
latitude: panoIdObject.location.lat,
|
|
225
|
+
longitude: panoIdObject.location.lng,
|
|
226
|
+
};
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Gets metadata for panoId. See {@link https://developers.google.com/maps/documentation/tile/streetview#metadata_response} for response object.
|
|
231
|
+
* @param {string} panoId
|
|
232
|
+
*
|
|
233
|
+
* @returns {object} object containing metadata for the panoId.
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* const panoIdObject = provider.getNearestPanoId(position);
|
|
237
|
+
* const panoIdMetadata = provider.getPanoIdMetadata(panoIdObject.panoId);
|
|
238
|
+
*
|
|
239
|
+
*/
|
|
240
|
+
GoogleStreetViewCubeMapPanoramaProvider.prototype.getPanoIdMetadata =
|
|
241
|
+
async function (panoId) {
|
|
242
|
+
const resource = this._metadataResource.getDerivedResource({
|
|
243
|
+
queryParameters: {
|
|
244
|
+
key: this._key,
|
|
245
|
+
pano: panoId,
|
|
246
|
+
},
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
const panoIdObject = await resource.fetchJson();
|
|
250
|
+
|
|
251
|
+
if (panoIdObject.status !== "OK") {
|
|
252
|
+
throw new DeveloperError(
|
|
253
|
+
`GoogleStreetViewCubeMapPanoramaProvider metadata error: ${panoIdObject.status}`,
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
return panoIdObject;
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
GoogleStreetViewCubeMapPanoramaProvider.prototype._loadFaceImage =
|
|
260
|
+
async function (options) {
|
|
261
|
+
const url = this._buildFaceUrl(options);
|
|
262
|
+
|
|
263
|
+
try {
|
|
264
|
+
return await Resource.fetchImage({
|
|
265
|
+
url,
|
|
266
|
+
preferImageBitmap: true,
|
|
267
|
+
flipY: true,
|
|
268
|
+
});
|
|
269
|
+
} catch (error) {
|
|
270
|
+
throw new DeveloperError(`Failed to load Street View face image: ${url}`);
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
GoogleStreetViewCubeMapPanoramaProvider.prototype._buildFaceUrl = function (
|
|
275
|
+
options,
|
|
276
|
+
) {
|
|
277
|
+
const { heading, pitch, tileSizeString, panoId, signature } = options;
|
|
278
|
+
const resource = this._baseResource.getDerivedResource({
|
|
279
|
+
queryParameters: {
|
|
280
|
+
size: tileSizeString,
|
|
281
|
+
pano: panoId,
|
|
282
|
+
heading,
|
|
283
|
+
pitch,
|
|
284
|
+
key: this._key,
|
|
285
|
+
...(defined(signature) && { signature }),
|
|
286
|
+
},
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
return resource.url;
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Creates a {@link PanoramaProvider} which provides cube face images from the {@link https://developers.google.com/maps/documentation/streetview|Google Street View Static API}.
|
|
294
|
+
* @param {object} options Object with the following properties:
|
|
295
|
+
* @param {string} [options.key=GoogleMaps.defaultStreetViewStaticApiKey] Your API key to access Google Street View Static API. See {@link https://developers.google.com/maps/documentation/javascript/get-api-key} for instructions on how to create your own key. If undefined, defaults to {@link GoogleMaps.defaultStreetViewStaticApiKey}. If that value is unavailable, falls back to {@link GoogleMaps.defaultApiKey}.
|
|
296
|
+
* @param {string|Resource} [options.url=GoogleMaps.streetViewStaticApiEndpoint] The URL to access Google Street View Static API. See {@link https://developers.google.com/maps/documentation/streetview/overview} for more information.
|
|
297
|
+
* @param {number} [options.tileSize=600] Default width and height (in pixels) of each square tile.
|
|
298
|
+
* @param {Credit|string} [options.credit] A credit for the data source, which is displayed on the canvas.
|
|
299
|
+
*
|
|
300
|
+
* @returns {Promise<GoogleStreetViewCubeMapPanoramaProvider>} A promise that resolves to the created GoogleStreetViewCubeMapPanoramaProvider.'
|
|
301
|
+
*
|
|
302
|
+
* @example
|
|
303
|
+
* const provider = await Cesium.GoogleStreetViewCubeMapPanoramaProvider.fromUrl({
|
|
304
|
+
* key: 'your Google Streetview Static api key'
|
|
305
|
+
* })
|
|
306
|
+
*/
|
|
307
|
+
GoogleStreetViewCubeMapPanoramaProvider.fromUrl = async function (options) {
|
|
308
|
+
options = options ?? {};
|
|
309
|
+
options.key =
|
|
310
|
+
options.key ??
|
|
311
|
+
GoogleMaps.defaultStreetViewStaticApiKey ??
|
|
312
|
+
GoogleMaps.defaultApiKey;
|
|
313
|
+
if (
|
|
314
|
+
!defined(options.key) &&
|
|
315
|
+
!defined(GoogleMaps.defaultStreetViewStaticApiKey) &&
|
|
316
|
+
!defined(GoogleMaps.defaultApiKey)
|
|
317
|
+
) {
|
|
318
|
+
throw new DeveloperError(
|
|
319
|
+
"options.key, GoogleMaps.defaultStreetViewStaticApiKey or GoogleMaps.defaultApiKey is required.",
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
return new GoogleStreetViewCubeMapPanoramaProvider({
|
|
324
|
+
...options,
|
|
325
|
+
});
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
GoogleStreetViewCubeMapPanoramaProvider._parseMetadata = function (
|
|
329
|
+
panoIdMetadata,
|
|
330
|
+
) {
|
|
331
|
+
const cartographic = Cartographic.fromDegrees(
|
|
332
|
+
panoIdMetadata.location.lng,
|
|
333
|
+
panoIdMetadata.location.lat,
|
|
334
|
+
0,
|
|
335
|
+
);
|
|
336
|
+
return {
|
|
337
|
+
cartographic,
|
|
338
|
+
};
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
export default GoogleStreetViewCubeMapPanoramaProvider;
|
package/Source/Scene/Label.js
CHANGED
|
@@ -112,7 +112,7 @@ function parseFont(label) {
|
|
|
112
112
|
* @property {NearFarScalar} [pixelOffsetScaleByDistance] A {@link NearFarScalar} specifying near and far pixel offset scaling properties of the label based on the label's distance from the camera.
|
|
113
113
|
* @property {NearFarScalar} [scaleByDistance] A {@link NearFarScalar} specifying near and far scaling properties of the label based on the label's distance from the camera.
|
|
114
114
|
* @property {DistanceDisplayCondition} [distanceDisplayCondition] A {@link DistanceDisplayCondition} specifying at what distance from the camera that this label will be displayed.
|
|
115
|
-
* @property {number} [disableDepthTestDistance]
|
|
115
|
+
* @property {number} [disableDepthTestDistance] The distance from the camera, beyond which, depth testing is disabled—to, for example, prevent clipping against terrain.
|
|
116
116
|
*/
|
|
117
117
|
|
|
118
118
|
/**
|
|
@@ -1048,10 +1048,12 @@ Object.defineProperties(Label.prototype, {
|
|
|
1048
1048
|
},
|
|
1049
1049
|
|
|
1050
1050
|
/**
|
|
1051
|
-
* Gets or sets the distance from the camera
|
|
1052
|
-
* When set to
|
|
1051
|
+
* Gets or sets the distance from the camera, beyond which, depth testing is disabled—to, for example, prevent clipping against terrain.
|
|
1052
|
+
* When set to <code>undefined</code> or
|
|
1053
|
+
* <code>0</code>, the depth test is always applied. When set to Number.<code>POSITIVE_INFINITY</code>, the depth test is never applied.
|
|
1053
1054
|
* @memberof Label.prototype
|
|
1054
|
-
* @type {number}
|
|
1055
|
+
* @type {number|undefined}
|
|
1056
|
+
* @default undefined
|
|
1055
1057
|
*/
|
|
1056
1058
|
disableDepthTestDistance: {
|
|
1057
1059
|
get: function () {
|
|
@@ -19,6 +19,7 @@ import SDFSettings from "./SDFSettings.js";
|
|
|
19
19
|
import TextureAtlas from "../Renderer/TextureAtlas.js";
|
|
20
20
|
import VerticalOrigin from "./VerticalOrigin.js";
|
|
21
21
|
import GraphemeSplitter from "grapheme-splitter";
|
|
22
|
+
import { Check } from "@cesium/engine";
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* A glyph represents a single character in label.
|
|
@@ -593,7 +594,8 @@ function destroyLabel(labelCollection, label) {
|
|
|
593
594
|
* is used for rendering both opaque and translucent labels. However, if either all of the labels are completely opaque or all are completely translucent,
|
|
594
595
|
* setting the technique to BlendOption.OPAQUE or BlendOption.TRANSLUCENT can improve performance by up to 2x.
|
|
595
596
|
* @param {boolean} [options.show=true] Determines if the labels in the collection will be shown.
|
|
596
|
-
*
|
|
597
|
+
* @param {number} [options.coarseDepthTestDistance] The distance from the camera, beyond which, labels are depth-tested against an approximation of the globe ellipsoid rather than against the full globe depth buffer. If unspecified, the default value is determined relative to the value of {@link Ellipsoid.default}.
|
|
598
|
+
* @param {number} [options.threePointDepthTestDistance] The distance from the camera, within which, lables with a {@link Label#heightReference} value of {@link HeightReference.CLAMP_TO_GROUND} or {@link HeightReference.CLAMP_TO_TERRAIN} are depth tested against three key points. This ensures that if any key point of the label is visible, the whole label will be visible. If unspecified, the default value is determined relative to the value of {@link Ellipsoid.default}.
|
|
597
599
|
* @performance For best performance, prefer a few collections, each with many labels, to
|
|
598
600
|
* many collections with only a few labels each. Avoid having collections where some
|
|
599
601
|
* labels change every frame and others do not; instead, create one or more collections
|
|
@@ -629,6 +631,8 @@ function LabelCollection(options) {
|
|
|
629
631
|
textureAtlas: new TextureAtlas({
|
|
630
632
|
initialSize: whitePixelSize,
|
|
631
633
|
}),
|
|
634
|
+
coarseDepthTestDistance: options.coarseDepthTestDistance,
|
|
635
|
+
threePointDepthTestDistance: options.threePointDepthTestDistance,
|
|
632
636
|
});
|
|
633
637
|
this._backgroundBillboardCollection = backgroundBillboardCollection;
|
|
634
638
|
this._backgroundBillboardTexture = new BillboardTexture(
|
|
@@ -638,6 +642,8 @@ function LabelCollection(options) {
|
|
|
638
642
|
this._glyphBillboardCollection = new BillboardCollection({
|
|
639
643
|
scene: this._scene,
|
|
640
644
|
batchTable: this._batchTable,
|
|
645
|
+
coarseDepthTestDistance: options.coarseDepthTestDistance,
|
|
646
|
+
threePointDepthTestDistance: options.threePointDepthTestDistance,
|
|
641
647
|
});
|
|
642
648
|
this._glyphBillboardCollection._sdf = true;
|
|
643
649
|
|
|
@@ -759,6 +765,58 @@ Object.defineProperties(LabelCollection.prototype, {
|
|
|
759
765
|
return this._glyphBillboardCollection.ready;
|
|
760
766
|
},
|
|
761
767
|
},
|
|
768
|
+
|
|
769
|
+
/**
|
|
770
|
+
* The distance from the camera, beyond which, labels are depth-tested against an approximation of
|
|
771
|
+
* the globe ellipsoid rather than against the full globe depth buffer. When set to <code>0</code>, the
|
|
772
|
+
* approximate depth test is always applied. When set to <code>Number.POSITIVE_INFINITY</code>, the
|
|
773
|
+
* approximate depth test is never applied.
|
|
774
|
+
* <br/><br/>
|
|
775
|
+
* This setting only applies when a label's {@link Label#disableDepthTestDistance} value would
|
|
776
|
+
* otherwise allow depth testing—i.e., distance from the camera to the label is less than the
|
|
777
|
+
* label's {@link Label#disableDepthTestDistance} value.
|
|
778
|
+
* @memberof LabelCollection.prototype
|
|
779
|
+
* @type {number}
|
|
780
|
+
*/
|
|
781
|
+
coarseDepthTestDistance: {
|
|
782
|
+
get: function () {
|
|
783
|
+
return this._backgroundBillboardCollection.coarseDepthTestDistance;
|
|
784
|
+
},
|
|
785
|
+
set: function (value) {
|
|
786
|
+
//>>includeStart('debug', pragmas.debug);
|
|
787
|
+
Check.typeOf.number("coarseDepthTestDistance", value);
|
|
788
|
+
//>>includeEnd('debug');
|
|
789
|
+
this._backgroundBillboardCollection.coarseDepthTestDistance = value;
|
|
790
|
+
this._glyphBillboardCollection.coarseDepthTestDistance = value;
|
|
791
|
+
},
|
|
792
|
+
},
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* The distance from the camera, within which, labels with a {@link Label#heightReference} value
|
|
796
|
+
* of {@link HeightReference.CLAMP_TO_GROUND} or {@link HeightReference.CLAMP_TO_TERRAIN} are depth tested
|
|
797
|
+
* against three key points. This ensures that if any key point of the label is visible, the whole
|
|
798
|
+
* label will be visible. When set to <code>0</code>, this feature is disabled and portions of a
|
|
799
|
+
* label behind terrain be clipped.
|
|
800
|
+
* <br/><br/>
|
|
801
|
+
* This setting only applies when a labels's {@link Label#disableDepthTestDistance} value would
|
|
802
|
+
* otherwise allow depth testing—i.e., distance from the camera to the label is less than the
|
|
803
|
+
* labels's {@link Label#disableDepthTestDistance} value.
|
|
804
|
+
* @see {@link https://cesium.com/blog/2018/07/30/billboards-on-terrain-improvements/|Billboards and Labels on Terrain Improvements}
|
|
805
|
+
* @memberof LabelCollection.prototype
|
|
806
|
+
* @type {number}
|
|
807
|
+
*/
|
|
808
|
+
threePointDepthTestDistance: {
|
|
809
|
+
get: function () {
|
|
810
|
+
return this._backgroundBillboardCollection.threePointDepthTestDistance;
|
|
811
|
+
},
|
|
812
|
+
set: function (value) {
|
|
813
|
+
//>>includeStart('debug', pragmas.debug);
|
|
814
|
+
Check.typeOf.number("threePointDepthTestDistance", value);
|
|
815
|
+
//>>includeEnd('debug');
|
|
816
|
+
this._backgroundBillboardCollection.threePointDepthTestDistance = value;
|
|
817
|
+
this._glyphBillboardCollection.threePointDepthTestDistance = value;
|
|
818
|
+
},
|
|
819
|
+
},
|
|
762
820
|
});
|
|
763
821
|
|
|
764
822
|
/**
|