@cesium/engine 2.1.0 → 2.2.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/{AxisAlignedBoundingBox-a6f9f0e5.js → AxisAlignedBoundingBox-379015ef.js} +1 -1
- package/Build/Workers/{BoundingRectangle-b0a68595.js → BoundingRectangle-57f2b24f.js} +1 -1
- package/Build/Workers/{BoxGeometry-baedd794.js → BoxGeometry-ecabfc78.js} +1 -1
- package/Build/Workers/{Color-f85df1be.js → Color-14d1a36d.js} +1 -1
- package/Build/Workers/{CoplanarPolygonGeometryLibrary-30516950.js → CoplanarPolygonGeometryLibrary-048c3c14.js} +1 -1
- package/Build/Workers/{CorridorGeometryLibrary-5d5d3b3a.js → CorridorGeometryLibrary-520c8619.js} +1 -1
- package/Build/Workers/{CylinderGeometry-d899ae26.js → CylinderGeometry-119068b8.js} +1 -1
- package/Build/Workers/{EllipseGeometry-a49f8449.js → EllipseGeometry-2dfc3523.js} +1 -1
- package/Build/Workers/{EllipseGeometryLibrary-cba7edde.js → EllipseGeometryLibrary-0a1e0170.js} +1 -1
- package/Build/Workers/{EllipseOutlineGeometry-8095c8cb.js → EllipseOutlineGeometry-c5251669.js} +1 -1
- package/Build/Workers/{EllipsoidGeometry-ed93f571.js → EllipsoidGeometry-d10a5221.js} +1 -1
- package/Build/Workers/{EllipsoidOutlineGeometry-e4854854.js → EllipsoidOutlineGeometry-7039a0ae.js} +1 -1
- package/Build/Workers/{EllipsoidTangentPlane-7ae1aa9a.js → EllipsoidTangentPlane-857186be.js} +1 -1
- package/Build/Workers/{FrustumGeometry-b62db3e3.js → FrustumGeometry-400fa1b7.js} +2 -2
- package/Build/Workers/{GeometryAttribute-780af4fa.js → GeometryAttribute-7a2de5c6.js} +1 -1
- package/Build/Workers/{GeometryPipeline-36b61c99.js → GeometryPipeline-916636fa.js} +1 -1
- package/Build/Workers/{IntersectionTests-e889fcf0.js → IntersectionTests-b4d02d4d.js} +1 -1
- package/Build/Workers/{OrientedBoundingBox-43478ac8.js → OrientedBoundingBox-96fe1752.js} +5 -3
- package/Build/Workers/{PolygonGeometryLibrary-38a98276.js → PolygonGeometryLibrary-931f1ec6.js} +1 -1
- package/Build/Workers/{PolygonPipeline-d31ff61c.js → PolygonPipeline-32fc92cc.js} +1 -1
- package/Build/Workers/{PolylinePipeline-30e4cec9.js → PolylinePipeline-6d5c63e5.js} +1 -1
- package/Build/Workers/{PolylineVolumeGeometryLibrary-90551d26.js → PolylineVolumeGeometryLibrary-f068c1fb.js} +1 -1
- package/Build/Workers/{PrimitivePipeline-558d9cb0.js → PrimitivePipeline-879f996a.js} +1 -1
- package/Build/Workers/{RectangleGeometryLibrary-815c68df.js → RectangleGeometryLibrary-2d6f36f3.js} +1 -1
- package/Build/Workers/{TerrainEncoding-341ead52.js → TerrainEncoding-82882059.js} +1 -1
- package/Build/Workers/{Transforms-9e9df299.js → Transforms-9052372a.js} +6 -5
- package/Build/Workers/{WallGeometryLibrary-ccf90976.js → WallGeometryLibrary-db7a64fb.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/createVectorTileGeometries.js +1 -1
- package/Build/Workers/createVectorTilePolygons.js +1 -1
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +1 -1
- package/Build/Workers/createVerticesFromHeightmap.js +1 -1
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +10 -15
- package/Build/Workers/createWallGeometry.js +1 -1
- package/Build/Workers/createWallOutlineGeometry.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/ArcGISTiledElevationTerrainProvider.js +291 -191
- package/Source/Core/CesiumTerrainProvider.js +571 -434
- package/Source/Core/CustomHeightmapTerrainProvider.js +12 -0
- package/Source/Core/EllipsoidTerrainProvider.js +17 -10
- package/Source/Core/FrustumGeometry.js +1 -1
- package/Source/Core/GoogleEarthEnterpriseMetadata.js +86 -34
- package/Source/Core/GoogleEarthEnterpriseTerrainProvider.js +119 -82
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/IonResource.js +14 -3
- package/Source/Core/OrientedBoundingBox.js +4 -2
- package/Source/Core/RequestScheduler.js +1 -1
- package/Source/Core/Resource.js +2 -2
- package/Source/Core/TerrainProvider.js +9 -14
- package/Source/Core/TileProviderError.js +8 -8
- package/Source/Core/VRTheWorldTerrainProvider.js +193 -124
- package/Source/Core/buildModuleUrl.js +4 -3
- package/Source/Core/createWorldTerrain.js +20 -2
- package/Source/Core/createWorldTerrainAsync.js +48 -0
- package/Source/Core/sampleTerrain.js +9 -10
- package/Source/Core/sampleTerrainMostDetailed.js +66 -72
- package/Source/DataSources/Cesium3DTilesetVisualizer.js +37 -26
- package/Source/DataSources/Entity.js +6 -1
- package/Source/DataSources/ModelVisualizer.js +99 -31
- package/Source/DataSources/PolygonGraphics.js +1 -1
- package/Source/Scene/ArcGisMapServerImageryProvider.js +552 -376
- package/Source/Scene/BingMapsImageryProvider.js +511 -305
- package/Source/Scene/BufferLoader.js +29 -34
- package/Source/Scene/Cesium3DTile.js +388 -251
- package/Source/Scene/Cesium3DTileBatchTable.js +2 -2
- package/Source/Scene/Cesium3DTileContent.js +16 -0
- package/Source/Scene/Cesium3DTileContentFactory.js +4 -4
- package/Source/Scene/Cesium3DTilePass.js +8 -11
- package/Source/Scene/Cesium3DTileStyleEngine.js +1 -1
- package/Source/Scene/Cesium3DTilesVoxelProvider.js +225 -117
- package/Source/Scene/Cesium3DTileset.js +755 -481
- package/Source/Scene/Cesium3DTilesetBaseTraversal.js +301 -0
- package/Source/Scene/Cesium3DTilesetMostDetailedTraversal.js +33 -46
- package/Source/Scene/Cesium3DTilesetSkipTraversal.js +421 -0
- package/Source/Scene/Cesium3DTilesetTraversal.js +219 -671
- package/Source/Scene/ClassificationPrimitive.js +7 -0
- package/Source/Scene/Composite3DTileContent.js +69 -26
- package/Source/Scene/CreditDisplay.js +20 -4
- package/Source/Scene/DepthPlane.js +1 -1
- package/Source/Scene/Empty3DTileContent.js +31 -1
- package/Source/Scene/Geometry3DTileContent.js +47 -7
- package/Source/Scene/Globe.js +5 -1
- package/Source/Scene/GlobeSurfaceTile.js +2 -1
- package/Source/Scene/GlobeSurfaceTileProvider.js +50 -27
- package/Source/Scene/GltfBufferViewLoader.js +47 -91
- package/Source/Scene/GltfDracoLoader.js +110 -112
- package/Source/Scene/GltfImageLoader.js +71 -78
- package/Source/Scene/GltfIndexBufferLoader.js +108 -121
- package/Source/Scene/GltfJsonLoader.js +75 -74
- package/Source/Scene/GltfLoader.js +392 -280
- package/Source/Scene/GltfStructuralMetadataLoader.js +109 -110
- package/Source/Scene/GltfTextureLoader.js +97 -96
- package/Source/Scene/GltfVertexBufferLoader.js +128 -133
- package/Source/Scene/GoogleEarthEnterpriseImageryProvider.js +353 -225
- package/Source/Scene/GoogleEarthEnterpriseMapsProvider.js +491 -331
- package/Source/Scene/GridImageryProvider.js +267 -104
- package/Source/Scene/GroundPolylinePrimitive.js +12 -1
- package/Source/Scene/GroundPrimitive.js +8 -1
- package/Source/Scene/I3SDataProvider.js +214 -113
- package/Source/Scene/I3SFeature.js +7 -6
- package/Source/Scene/I3SLayer.js +26 -37
- package/Source/Scene/I3SNode.js +59 -66
- package/Source/Scene/Imagery.js +6 -1
- package/Source/Scene/ImageryLayer.js +299 -48
- package/Source/Scene/ImageryLayerCollection.js +26 -0
- package/Source/Scene/ImageryProvider.js +129 -111
- package/Source/Scene/Implicit3DTileContent.js +72 -23
- package/Source/Scene/ImplicitSubtree.js +66 -45
- package/Source/Scene/IonImageryProvider.js +471 -264
- package/Source/Scene/MapboxImageryProvider.js +272 -112
- package/Source/Scene/MapboxStyleImageryProvider.js +270 -111
- package/Source/Scene/MetadataSchemaLoader.js +26 -36
- package/Source/Scene/Model/B3dmLoader.js +42 -46
- package/Source/Scene/Model/GeoJsonLoader.js +8 -32
- package/Source/Scene/Model/I3dmLoader.js +48 -74
- package/Source/Scene/Model/Model.js +470 -132
- package/Source/Scene/Model/Model3DTileContent.js +83 -31
- package/Source/Scene/Model/ModelAnimationCollection.js +3 -3
- package/Source/Scene/Model/ModelDrawCommand.js +15 -26
- package/Source/Scene/Model/ModelUtility.js +16 -16
- package/Source/Scene/Model/PntsLoader.js +27 -32
- package/Source/Scene/Multiple3DTileContent.js +134 -115
- package/Source/Scene/PointCloud.js +11 -19
- package/Source/Scene/Primitive.js +20 -0
- package/Source/Scene/QuadtreePrimitive.js +2 -0
- package/Source/Scene/QuadtreeTileProvider.js +4 -8
- package/Source/Scene/ResourceCache.js +47 -105
- package/Source/Scene/ResourceCacheStatistics.js +24 -58
- package/Source/Scene/ResourceLoader.js +5 -17
- package/Source/Scene/ResourceLoaderState.js +12 -4
- package/Source/Scene/Scene.js +65 -0
- package/Source/Scene/ScreenSpaceCameraController.js +1 -1
- package/Source/Scene/SingleTileImageryProvider.js +382 -209
- package/Source/Scene/Terrain.js +196 -0
- package/Source/Scene/TileCoordinatesImageryProvider.js +267 -104
- package/Source/Scene/TileMapServiceImageryProvider.js +177 -85
- package/Source/Scene/Tileset3DTileContent.js +47 -5
- package/Source/Scene/TimeDynamicPointCloud.js +15 -2
- package/Source/Scene/UrlTemplateImageryProvider.js +343 -215
- package/Source/Scene/Vector3DTileClampedPolylines.js +96 -84
- package/Source/Scene/Vector3DTileContent.js +47 -22
- package/Source/Scene/Vector3DTileGeometry.js +57 -52
- package/Source/Scene/Vector3DTilePoints.js +72 -68
- package/Source/Scene/Vector3DTilePolygons.js +118 -117
- package/Source/Scene/Vector3DTilePolylines.js +86 -82
- package/Source/Scene/Vector3DTilePrimitive.js +0 -1
- package/Source/Scene/VoxelContent.js +61 -63
- package/Source/Scene/VoxelPrimitive.js +39 -91
- package/Source/Scene/VoxelProvider.js +2 -2
- package/Source/Scene/WebMapServiceImageryProvider.js +272 -111
- package/Source/Scene/WebMapTileServiceImageryProvider.js +270 -107
- package/Source/Scene/computeFlyToLocationForRectangle.js +33 -37
- package/Source/Scene/createOsmBuildings.js +6 -0
- package/Source/Scene/createOsmBuildingsAsync.js +82 -0
- package/Source/Scene/createWorldImagery.js +14 -5
- package/Source/Scene/createWorldImageryAsync.js +39 -0
- package/Source/Widget/CesiumWidget.js +55 -27
- package/index.d.ts +2158 -1395
- package/index.js +58 -51
- package/package.json +1 -1
|
@@ -69,20 +69,17 @@ ResourceCache.get = function (cacheKey) {
|
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
72
|
+
* Adds it to the cache.
|
|
73
73
|
*
|
|
74
|
-
* @param {
|
|
75
|
-
* @
|
|
74
|
+
* @param {ResourceLoader} resourceLoader The resource.
|
|
75
|
+
* @returns {ResourceLoader} The resource.
|
|
76
76
|
*
|
|
77
|
-
* @exception {DeveloperError} Resource with this cacheKey is already in the
|
|
77
|
+
* @exception {DeveloperError} Resource with this cacheKey is already in the cache
|
|
78
78
|
* @private
|
|
79
79
|
*/
|
|
80
|
-
ResourceCache.
|
|
81
|
-
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
82
|
-
const resourceLoader = options.resourceLoader;
|
|
83
|
-
|
|
80
|
+
ResourceCache.add = function (resourceLoader) {
|
|
84
81
|
//>>includeStart('debug', pragmas.debug);
|
|
85
|
-
Check.typeOf.object("
|
|
82
|
+
Check.typeOf.object("resourceLoader", resourceLoader);
|
|
86
83
|
//>>includeEnd('debug');
|
|
87
84
|
|
|
88
85
|
const cacheKey = resourceLoader.cacheKey;
|
|
@@ -99,7 +96,7 @@ ResourceCache.load = function (options) {
|
|
|
99
96
|
|
|
100
97
|
ResourceCache.cacheEntries[cacheKey] = new CacheEntry(resourceLoader);
|
|
101
98
|
|
|
102
|
-
resourceLoader
|
|
99
|
+
return resourceLoader;
|
|
103
100
|
};
|
|
104
101
|
|
|
105
102
|
/**
|
|
@@ -136,18 +133,18 @@ ResourceCache.unload = function (resourceLoader) {
|
|
|
136
133
|
};
|
|
137
134
|
|
|
138
135
|
/**
|
|
139
|
-
*
|
|
136
|
+
* Gets an existing schema loader from the cache, or creates a new loader if one does not already exist.
|
|
140
137
|
*
|
|
141
138
|
* @param {object} options Object with the following properties:
|
|
142
139
|
* @param {object} [options.schema] An object that explicitly defines a schema JSON. Mutually exclusive with options.resource.
|
|
143
140
|
* @param {Resource} [options.resource] The {@link Resource} pointing to the schema JSON. Mutually exclusive with options.schema.
|
|
144
141
|
*
|
|
145
|
-
* @returns {MetadataSchemaLoader} The schema resource.
|
|
142
|
+
* @returns {MetadataSchemaLoader} The cached schema resource.
|
|
146
143
|
*
|
|
147
144
|
* @exception {DeveloperError} One of options.schema and options.resource must be defined.
|
|
148
145
|
* @private
|
|
149
146
|
*/
|
|
150
|
-
ResourceCache.
|
|
147
|
+
ResourceCache.getSchemaLoader = function (options) {
|
|
151
148
|
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
152
149
|
const schema = options.schema;
|
|
153
150
|
const resource = options.resource;
|
|
@@ -176,25 +173,21 @@ ResourceCache.loadSchema = function (options) {
|
|
|
176
173
|
cacheKey: cacheKey,
|
|
177
174
|
});
|
|
178
175
|
|
|
179
|
-
ResourceCache.
|
|
180
|
-
resourceLoader: schemaLoader,
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
return schemaLoader;
|
|
176
|
+
return ResourceCache.add(schemaLoader);
|
|
184
177
|
};
|
|
185
178
|
|
|
186
179
|
/**
|
|
187
|
-
*
|
|
180
|
+
* Gets an existing embedded buffer loader from the cache, or creates a new loader if one does not already exist.
|
|
188
181
|
*
|
|
189
182
|
* @param {object} options Object with the following properties:
|
|
190
183
|
* @param {Resource} options.parentResource The {@link Resource} containing the embedded buffer.
|
|
191
184
|
* @param {number} options.bufferId A unique identifier of the embedded buffer within the parent resource.
|
|
192
185
|
* @param {Uint8Array} [options.typedArray] The typed array containing the embedded buffer contents.
|
|
193
186
|
*
|
|
194
|
-
* @returns {BufferLoader} The buffer loader.
|
|
187
|
+
* @returns {BufferLoader} The cached buffer loader.
|
|
195
188
|
* @private
|
|
196
189
|
*/
|
|
197
|
-
ResourceCache.
|
|
190
|
+
ResourceCache.getEmbeddedBufferLoader = function (options) {
|
|
198
191
|
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
199
192
|
const parentResource = options.parentResource;
|
|
200
193
|
const bufferId = options.bufferId;
|
|
@@ -224,23 +217,19 @@ ResourceCache.loadEmbeddedBuffer = function (options) {
|
|
|
224
217
|
cacheKey: cacheKey,
|
|
225
218
|
});
|
|
226
219
|
|
|
227
|
-
ResourceCache.
|
|
228
|
-
resourceLoader: bufferLoader,
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
return bufferLoader;
|
|
220
|
+
return ResourceCache.add(bufferLoader);
|
|
232
221
|
};
|
|
233
222
|
|
|
234
223
|
/**
|
|
235
|
-
*
|
|
224
|
+
* Gets an existing external buffer from loader the cache, or creates a new loader if one does not already exist.
|
|
236
225
|
*
|
|
237
226
|
* @param {object} options Object with the following properties:
|
|
238
227
|
* @param {Resource} options.resource The {@link Resource} pointing to the external buffer.
|
|
239
228
|
*
|
|
240
|
-
* @returns {BufferLoader} The buffer loader.
|
|
229
|
+
* @returns {BufferLoader} The cached buffer loader.
|
|
241
230
|
* @private
|
|
242
231
|
*/
|
|
243
|
-
ResourceCache.
|
|
232
|
+
ResourceCache.getExternalBufferLoader = function (options) {
|
|
244
233
|
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
245
234
|
const resource = options.resource;
|
|
246
235
|
|
|
@@ -262,15 +251,11 @@ ResourceCache.loadExternalBuffer = function (options) {
|
|
|
262
251
|
cacheKey: cacheKey,
|
|
263
252
|
});
|
|
264
253
|
|
|
265
|
-
ResourceCache.
|
|
266
|
-
resourceLoader: bufferLoader,
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
return bufferLoader;
|
|
254
|
+
return ResourceCache.add(bufferLoader);
|
|
270
255
|
};
|
|
271
256
|
|
|
272
257
|
/**
|
|
273
|
-
*
|
|
258
|
+
* Gets an existing glTF JSON loader from the cache, or creates a new loader if one does not already exist.
|
|
274
259
|
*
|
|
275
260
|
* @param {object} options Object with the following properties:
|
|
276
261
|
* @param {Resource} options.gltfResource The {@link Resource} containing the glTF.
|
|
@@ -278,10 +263,10 @@ ResourceCache.loadExternalBuffer = function (options) {
|
|
|
278
263
|
* @param {Uint8Array} [options.typedArray] The typed array containing the glTF contents.
|
|
279
264
|
* @param {object} [options.gltfJson] The parsed glTF JSON contents.
|
|
280
265
|
*
|
|
281
|
-
* @returns {GltfJsonLoader} The glTF JSON.
|
|
266
|
+
* @returns {GltfJsonLoader} The cached glTF JSON loader.
|
|
282
267
|
* @private
|
|
283
268
|
*/
|
|
284
|
-
ResourceCache.
|
|
269
|
+
ResourceCache.getGltfJsonLoader = function (options) {
|
|
285
270
|
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
286
271
|
const gltfResource = options.gltfResource;
|
|
287
272
|
const baseResource = options.baseResource;
|
|
@@ -311,15 +296,11 @@ ResourceCache.loadGltfJson = function (options) {
|
|
|
311
296
|
cacheKey: cacheKey,
|
|
312
297
|
});
|
|
313
298
|
|
|
314
|
-
ResourceCache.
|
|
315
|
-
resourceLoader: gltfJsonLoader,
|
|
316
|
-
});
|
|
317
|
-
|
|
318
|
-
return gltfJsonLoader;
|
|
299
|
+
return ResourceCache.add(gltfJsonLoader);
|
|
319
300
|
};
|
|
320
301
|
|
|
321
302
|
/**
|
|
322
|
-
*
|
|
303
|
+
* Gets an existing glTF buffer view from the cache, or creates a new loader if one does not already exist.
|
|
323
304
|
*
|
|
324
305
|
* @param {object} options Object with the following properties:
|
|
325
306
|
* @param {object} options.gltf The glTF JSON.
|
|
@@ -327,10 +308,10 @@ ResourceCache.loadGltfJson = function (options) {
|
|
|
327
308
|
* @param {Resource} options.gltfResource The {@link Resource} containing the glTF.
|
|
328
309
|
* @param {Resource} options.baseResource The {@link Resource} that paths in the glTF JSON are relative to.
|
|
329
310
|
*
|
|
330
|
-
* @returns {GltfBufferViewLoader} The buffer view loader.
|
|
311
|
+
* @returns {GltfBufferViewLoader} The cached buffer view loader.
|
|
331
312
|
* @private
|
|
332
313
|
*/
|
|
333
|
-
ResourceCache.
|
|
314
|
+
ResourceCache.getBufferViewLoader = function (options) {
|
|
334
315
|
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
335
316
|
const gltf = options.gltf;
|
|
336
317
|
const bufferViewId = options.bufferViewId;
|
|
@@ -365,15 +346,11 @@ ResourceCache.loadBufferView = function (options) {
|
|
|
365
346
|
cacheKey: cacheKey,
|
|
366
347
|
});
|
|
367
348
|
|
|
368
|
-
ResourceCache.
|
|
369
|
-
resourceLoader: bufferViewLoader,
|
|
370
|
-
});
|
|
371
|
-
|
|
372
|
-
return bufferViewLoader;
|
|
349
|
+
return ResourceCache.add(bufferViewLoader);
|
|
373
350
|
};
|
|
374
351
|
|
|
375
352
|
/**
|
|
376
|
-
*
|
|
353
|
+
* Gets an existing Draco data from the cache, or creates a new loader if one does not already exist.
|
|
377
354
|
*
|
|
378
355
|
* @param {object} options Object with the following properties:
|
|
379
356
|
* @param {object} options.gltf The glTF JSON.
|
|
@@ -381,10 +358,10 @@ ResourceCache.loadBufferView = function (options) {
|
|
|
381
358
|
* @param {Resource} options.gltfResource The {@link Resource} containing the glTF.
|
|
382
359
|
* @param {Resource} options.baseResource The {@link Resource} that paths in the glTF JSON are relative to.
|
|
383
360
|
*
|
|
384
|
-
* @returns {GltfDracoLoader} The Draco loader.
|
|
361
|
+
* @returns {GltfDracoLoader} The cached Draco loader.
|
|
385
362
|
* @private
|
|
386
363
|
*/
|
|
387
|
-
ResourceCache.
|
|
364
|
+
ResourceCache.getDracoLoader = function (options) {
|
|
388
365
|
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
389
366
|
const gltf = options.gltf;
|
|
390
367
|
const draco = options.draco;
|
|
@@ -419,15 +396,11 @@ ResourceCache.loadDraco = function (options) {
|
|
|
419
396
|
cacheKey: cacheKey,
|
|
420
397
|
});
|
|
421
398
|
|
|
422
|
-
ResourceCache.
|
|
423
|
-
resourceLoader: dracoLoader,
|
|
424
|
-
});
|
|
425
|
-
|
|
426
|
-
return dracoLoader;
|
|
399
|
+
return ResourceCache.add(dracoLoader);
|
|
427
400
|
};
|
|
428
401
|
|
|
429
402
|
/**
|
|
430
|
-
*
|
|
403
|
+
* Gets an existing glTF vertex buffer from the cache, or creates a new loader if one does not already exist.
|
|
431
404
|
*
|
|
432
405
|
* @param {object} options Object with the following properties:
|
|
433
406
|
* @param {object} options.gltf The glTF JSON.
|
|
@@ -446,10 +419,10 @@ ResourceCache.loadDraco = function (options) {
|
|
|
446
419
|
* @exception {DeveloperError} When options.draco is defined options.attributeSemantic must also be defined.
|
|
447
420
|
* @exception {DeveloperError} When options.draco is defined options.accessorId must also be defined.
|
|
448
421
|
*
|
|
449
|
-
* @returns {GltfVertexBufferLoader} The vertex buffer loader.
|
|
422
|
+
* @returns {GltfVertexBufferLoader} The cached vertex buffer loader.
|
|
450
423
|
* @private
|
|
451
424
|
*/
|
|
452
|
-
ResourceCache.
|
|
425
|
+
ResourceCache.getVertexBufferLoader = function (options) {
|
|
453
426
|
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
454
427
|
const gltf = options.gltf;
|
|
455
428
|
const gltfResource = options.gltfResource;
|
|
@@ -539,18 +512,7 @@ ResourceCache.loadVertexBuffer = function (options) {
|
|
|
539
512
|
loadTypedArray: loadTypedArray,
|
|
540
513
|
});
|
|
541
514
|
|
|
542
|
-
ResourceCache.
|
|
543
|
-
resourceLoader: vertexBufferLoader,
|
|
544
|
-
});
|
|
545
|
-
|
|
546
|
-
const promise = ResourceCache.statistics.addGeometryLoader(
|
|
547
|
-
vertexBufferLoader
|
|
548
|
-
);
|
|
549
|
-
|
|
550
|
-
// Needed for unit testing
|
|
551
|
-
ResourceCache.cacheEntries[cacheKey]._statisticsPromise = promise;
|
|
552
|
-
|
|
553
|
-
return vertexBufferLoader;
|
|
515
|
+
return ResourceCache.add(vertexBufferLoader);
|
|
554
516
|
};
|
|
555
517
|
|
|
556
518
|
function hasDracoCompression(draco, semantic) {
|
|
@@ -562,7 +524,7 @@ function hasDracoCompression(draco, semantic) {
|
|
|
562
524
|
}
|
|
563
525
|
|
|
564
526
|
/**
|
|
565
|
-
*
|
|
527
|
+
* Gets an existing glTF index buffer from the cache, or creates a new loader if one does not already exist.
|
|
566
528
|
*
|
|
567
529
|
* @param {object} options Object with the following properties:
|
|
568
530
|
* @param {object} options.gltf The glTF JSON.
|
|
@@ -574,10 +536,10 @@ function hasDracoCompression(draco, semantic) {
|
|
|
574
536
|
* @param {boolean} [options.asynchronous=true] Determines if WebGL resource creation will be spread out over several frames or block until all WebGL resources are created.
|
|
575
537
|
* @param {boolean} [options.loadBuffer=false] Load index buffer as a GPU index buffer.
|
|
576
538
|
* @param {boolean} [options.loadTypedArray=false] Load index buffer as a typed array.
|
|
577
|
-
* @returns {GltfIndexBufferLoader} The index buffer loader.
|
|
539
|
+
* @returns {GltfIndexBufferLoader} The cached index buffer loader.
|
|
578
540
|
* @private
|
|
579
541
|
*/
|
|
580
|
-
ResourceCache.
|
|
542
|
+
ResourceCache.getIndexBufferLoader = function (options) {
|
|
581
543
|
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
582
544
|
const gltf = options.gltf;
|
|
583
545
|
const accessorId = options.accessorId;
|
|
@@ -631,19 +593,11 @@ ResourceCache.loadIndexBuffer = function (options) {
|
|
|
631
593
|
loadTypedArray: loadTypedArray,
|
|
632
594
|
});
|
|
633
595
|
|
|
634
|
-
ResourceCache.
|
|
635
|
-
resourceLoader: indexBufferLoader,
|
|
636
|
-
});
|
|
637
|
-
const promise = ResourceCache.statistics.addGeometryLoader(indexBufferLoader);
|
|
638
|
-
|
|
639
|
-
// Needed for unit testing
|
|
640
|
-
ResourceCache.cacheEntries[cacheKey]._statisticsPromise = promise;
|
|
641
|
-
|
|
642
|
-
return indexBufferLoader;
|
|
596
|
+
return ResourceCache.add(indexBufferLoader);
|
|
643
597
|
};
|
|
644
598
|
|
|
645
599
|
/**
|
|
646
|
-
*
|
|
600
|
+
* Gets an existing glTF image from the cache, or creates a new loader if one does not already exist.
|
|
647
601
|
*
|
|
648
602
|
* @param {object} options Object with the following properties:
|
|
649
603
|
* @param {object} options.gltf The glTF JSON.
|
|
@@ -651,10 +605,10 @@ ResourceCache.loadIndexBuffer = function (options) {
|
|
|
651
605
|
* @param {Resource} options.gltfResource The {@link Resource} containing the glTF.
|
|
652
606
|
* @param {Resource} options.baseResource The {@link Resource} that paths in the glTF JSON are relative to.
|
|
653
607
|
*
|
|
654
|
-
* @returns {GltfImageLoader} The image loader.
|
|
608
|
+
* @returns {GltfImageLoader} The cached image loader.
|
|
655
609
|
* @private
|
|
656
610
|
*/
|
|
657
|
-
ResourceCache.
|
|
611
|
+
ResourceCache.getImageLoader = function (options) {
|
|
658
612
|
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
659
613
|
const gltf = options.gltf;
|
|
660
614
|
const imageId = options.imageId;
|
|
@@ -689,15 +643,11 @@ ResourceCache.loadImage = function (options) {
|
|
|
689
643
|
cacheKey: cacheKey,
|
|
690
644
|
});
|
|
691
645
|
|
|
692
|
-
ResourceCache.
|
|
693
|
-
resourceLoader: imageLoader,
|
|
694
|
-
});
|
|
695
|
-
|
|
696
|
-
return imageLoader;
|
|
646
|
+
return ResourceCache.add(imageLoader);
|
|
697
647
|
};
|
|
698
648
|
|
|
699
649
|
/**
|
|
700
|
-
*
|
|
650
|
+
* Gets an existing glTF texture from the cache, or creates a new loader if one does not already exist.
|
|
701
651
|
*
|
|
702
652
|
* @param {object} options Object with the following properties:
|
|
703
653
|
* @param {object} options.gltf The glTF JSON.
|
|
@@ -708,10 +658,10 @@ ResourceCache.loadImage = function (options) {
|
|
|
708
658
|
* @param {FrameState} options.frameState The frame state.
|
|
709
659
|
* @param {boolean} [options.asynchronous=true] Determines if WebGL resource creation will be spread out over several frames or block until all WebGL resources are created.
|
|
710
660
|
*
|
|
711
|
-
* @returns {GltfTextureLoader} The texture loader.
|
|
661
|
+
* @returns {GltfTextureLoader} The cached texture loader.
|
|
712
662
|
* @private
|
|
713
663
|
*/
|
|
714
|
-
ResourceCache.
|
|
664
|
+
ResourceCache.getTextureLoader = function (options) {
|
|
715
665
|
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
716
666
|
const gltf = options.gltf;
|
|
717
667
|
const textureInfo = options.textureInfo;
|
|
@@ -755,15 +705,7 @@ ResourceCache.loadTexture = function (options) {
|
|
|
755
705
|
asynchronous: asynchronous,
|
|
756
706
|
});
|
|
757
707
|
|
|
758
|
-
ResourceCache.
|
|
759
|
-
resourceLoader: textureLoader,
|
|
760
|
-
});
|
|
761
|
-
const promise = ResourceCache.statistics.addTextureLoader(textureLoader);
|
|
762
|
-
|
|
763
|
-
// Needed for unit testing
|
|
764
|
-
ResourceCache.cacheEntries[cacheKey]._statisticsPromise = promise;
|
|
765
|
-
|
|
766
|
-
return textureLoader;
|
|
708
|
+
return ResourceCache.add(textureLoader);
|
|
767
709
|
};
|
|
768
710
|
|
|
769
711
|
/**
|
|
@@ -47,17 +47,14 @@ ResourceCacheStatistics.prototype.clear = function () {
|
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
|
-
* Track the resources for a vertex or index buffer loader. This is
|
|
51
|
-
*
|
|
50
|
+
* Track the resources for a vertex or index buffer loader. This should be called after a loader is ready; that
|
|
51
|
+
* is it has been loaded and processed.
|
|
52
52
|
* This method handles the following cases gracefully:
|
|
53
53
|
* <ul>
|
|
54
54
|
* <li>If the loader is added twice, its resources will not be double-counted</li>
|
|
55
55
|
* <li>If the geometry has a CPU copy of the GPU buffer, it will be added to the count</li>
|
|
56
|
-
* <li>If the resource loading failed, its resources will not be counted</li>
|
|
57
|
-
* <li>If removeLoader() was called before the loader promise resolves, its resources will not be counted</li>
|
|
58
56
|
* </ul>
|
|
59
57
|
* @param {GltfVertexBufferLoader|GltfIndexBufferLoader} loader The geometry buffer with resources to track
|
|
60
|
-
* @returns {Promise} A promise that resolves once the count is updated.
|
|
61
58
|
*
|
|
62
59
|
* @private
|
|
63
60
|
*/
|
|
@@ -75,47 +72,29 @@ ResourceCacheStatistics.prototype.addGeometryLoader = function (loader) {
|
|
|
75
72
|
|
|
76
73
|
this._geometrySizes[cacheKey] = 0;
|
|
77
74
|
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (defined(typedArray)) {
|
|
96
|
-
totalSize += typedArray.byteLength;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
that.geometryByteLength += totalSize;
|
|
100
|
-
that._geometrySizes[cacheKey] = totalSize;
|
|
101
|
-
})
|
|
102
|
-
.catch(function () {
|
|
103
|
-
// If the resource failed to load, remove it from the cache
|
|
104
|
-
delete that._geometrySizes[cacheKey];
|
|
105
|
-
});
|
|
75
|
+
const buffer = loader.buffer;
|
|
76
|
+
const typedArray = loader.typedArray;
|
|
77
|
+
|
|
78
|
+
let totalSize = 0;
|
|
79
|
+
|
|
80
|
+
if (defined(buffer)) {
|
|
81
|
+
totalSize += buffer.sizeInBytes;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (defined(typedArray)) {
|
|
85
|
+
totalSize += typedArray.byteLength;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
this.geometryByteLength += totalSize;
|
|
89
|
+
this._geometrySizes[cacheKey] = totalSize;
|
|
106
90
|
};
|
|
107
91
|
|
|
108
92
|
/**
|
|
109
|
-
* Track the resources for a texture loader. This is
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
* <li>If the loader is added twice, its resources will not be double-counted</li>
|
|
114
|
-
* <li>If the resource loading failed, its resources will not be counted</li>
|
|
115
|
-
* <li>If removeLoader() was called before the loader promise resolves, its resources will not be counted</li>
|
|
116
|
-
* </ul>
|
|
93
|
+
* Track the resources for a texture loader. This should be called after a loader is ready; that
|
|
94
|
+
* is it has been loaded and processed.
|
|
95
|
+
* If the loader is added twice, its resources will not be double-counted.
|
|
96
|
+
*
|
|
117
97
|
* @param {GltfTextureLoader} loader The texture loader with resources to track
|
|
118
|
-
* @returns {Promise} A promise that resolves once the count is updated.
|
|
119
98
|
*
|
|
120
99
|
* @private
|
|
121
100
|
*/
|
|
@@ -132,22 +111,9 @@ ResourceCacheStatistics.prototype.addTextureLoader = function (loader) {
|
|
|
132
111
|
}
|
|
133
112
|
|
|
134
113
|
this._textureSizes[cacheKey] = 0;
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
.then(function (loader) {
|
|
139
|
-
// loader was unloaded before its promise resolved
|
|
140
|
-
if (!that._textureSizes.hasOwnProperty(cacheKey)) {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
const totalSize = loader.texture.sizeInBytes;
|
|
145
|
-
that.texturesByteLength += loader.texture.sizeInBytes;
|
|
146
|
-
that._textureSizes[cacheKey] = totalSize;
|
|
147
|
-
})
|
|
148
|
-
.catch(function () {
|
|
149
|
-
delete that._textureSizes[cacheKey];
|
|
150
|
-
});
|
|
114
|
+
const totalSize = loader.texture.sizeInBytes;
|
|
115
|
+
this.texturesByteLength += loader.texture.sizeInBytes;
|
|
116
|
+
this._textureSizes[cacheKey] = totalSize;
|
|
151
117
|
};
|
|
152
118
|
|
|
153
119
|
/**
|
|
@@ -20,21 +20,6 @@ import RuntimeError from "../Core/RuntimeError.js";
|
|
|
20
20
|
function ResourceLoader() {}
|
|
21
21
|
|
|
22
22
|
Object.defineProperties(ResourceLoader.prototype, {
|
|
23
|
-
/**
|
|
24
|
-
* A promise that resolves to the resource when the resource is ready, or undefined if the resource hasn't started loading.
|
|
25
|
-
*
|
|
26
|
-
* @memberof ResourceLoader.prototype
|
|
27
|
-
*
|
|
28
|
-
* @type {Promise<ResourceLoader>|undefined}
|
|
29
|
-
* @readonly
|
|
30
|
-
* @private
|
|
31
|
-
*/
|
|
32
|
-
promise: {
|
|
33
|
-
// eslint-disable-next-line getter-return
|
|
34
|
-
get: function () {
|
|
35
|
-
DeveloperError.throwInstantiationError();
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
23
|
/**
|
|
39
24
|
* The cache key of the resource.
|
|
40
25
|
*
|
|
@@ -71,9 +56,12 @@ ResourceLoader.prototype.unload = function () {};
|
|
|
71
56
|
* Processes the resource until it becomes ready.
|
|
72
57
|
*
|
|
73
58
|
* @param {FrameState} frameState The frame state.
|
|
59
|
+
* @returns {boolean} true once all resourced are ready.
|
|
74
60
|
* @private
|
|
75
61
|
*/
|
|
76
|
-
ResourceLoader.prototype.process = function (frameState) {
|
|
62
|
+
ResourceLoader.prototype.process = function (frameState) {
|
|
63
|
+
return false;
|
|
64
|
+
};
|
|
77
65
|
|
|
78
66
|
/**
|
|
79
67
|
* Constructs a {@link RuntimeError} from an errorMessage and an error.
|
|
@@ -89,7 +77,7 @@ ResourceLoader.prototype.getError = function (errorMessage, error) {
|
|
|
89
77
|
Check.typeOf.string("errorMessage", errorMessage);
|
|
90
78
|
//>>includeEnd('debug');
|
|
91
79
|
|
|
92
|
-
if (defined(error)) {
|
|
80
|
+
if (defined(error) && defined(error.message)) {
|
|
93
81
|
errorMessage += `\n${error.message}`;
|
|
94
82
|
}
|
|
95
83
|
|
|
@@ -21,13 +21,21 @@ const ResourceLoaderState = {
|
|
|
21
21
|
*/
|
|
22
22
|
LOADING: 1,
|
|
23
23
|
/**
|
|
24
|
-
* The resource has finished loading, but requires further processing.
|
|
24
|
+
* The resource has finished loading, but requires further processing.
|
|
25
25
|
*
|
|
26
26
|
* @type {number}
|
|
27
27
|
* @constant
|
|
28
28
|
* @private
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
LOADED: 2,
|
|
31
|
+
/**
|
|
32
|
+
* The resource is processing. GPU resources are allocated in this state as needed.
|
|
33
|
+
*
|
|
34
|
+
* @type {Number}
|
|
35
|
+
* @constant
|
|
36
|
+
* @private
|
|
37
|
+
*/
|
|
38
|
+
PROCESSING: 3,
|
|
31
39
|
/**
|
|
32
40
|
* The resource has finished loading and processing; the results are ready to be used.
|
|
33
41
|
*
|
|
@@ -35,7 +43,7 @@ const ResourceLoaderState = {
|
|
|
35
43
|
* @constant
|
|
36
44
|
* @private
|
|
37
45
|
*/
|
|
38
|
-
READY:
|
|
46
|
+
READY: 4,
|
|
39
47
|
/**
|
|
40
48
|
* The resource loading or processing has failed due to an error.
|
|
41
49
|
*
|
|
@@ -43,6 +51,6 @@ const ResourceLoaderState = {
|
|
|
43
51
|
* @constant
|
|
44
52
|
* @private
|
|
45
53
|
*/
|
|
46
|
-
FAILED:
|
|
54
|
+
FAILED: 5,
|
|
47
55
|
};
|
|
48
56
|
export default Object.freeze(ResourceLoaderState);
|
package/Source/Scene/Scene.js
CHANGED
|
@@ -3,6 +3,7 @@ import BoundingSphere from "../Core/BoundingSphere.js";
|
|
|
3
3
|
import BoxGeometry from "../Core/BoxGeometry.js";
|
|
4
4
|
import Cartesian3 from "../Core/Cartesian3.js";
|
|
5
5
|
import Cartographic from "../Core/Cartographic.js";
|
|
6
|
+
import Check from "../Core/Check.js";
|
|
6
7
|
import clone from "../Core/clone.js";
|
|
7
8
|
import Color from "../Core/Color.js";
|
|
8
9
|
import ColorGeometryInstanceAttribute from "../Core/ColorGeometryInstanceAttribute.js";
|
|
@@ -638,6 +639,7 @@ function Scene(options) {
|
|
|
638
639
|
requestRenderAfterFrame(this)
|
|
639
640
|
);
|
|
640
641
|
this._removeGlobeCallbacks = [];
|
|
642
|
+
this._removeTerrainProviderReadyListener = undefined;
|
|
641
643
|
|
|
642
644
|
const viewport = new BoundingRectangle(
|
|
643
645
|
0,
|
|
@@ -1104,6 +1106,11 @@ Object.defineProperties(Scene.prototype, {
|
|
|
1104
1106
|
return this.globe.terrainProvider;
|
|
1105
1107
|
},
|
|
1106
1108
|
set: function (terrainProvider) {
|
|
1109
|
+
// Cancel any in-progress terrain update
|
|
1110
|
+
this._removeTerrainProviderReadyListener =
|
|
1111
|
+
this._removeTerrainProviderReadyListener &&
|
|
1112
|
+
this._removeTerrainProviderReadyListener();
|
|
1113
|
+
|
|
1107
1114
|
if (defined(this.globe)) {
|
|
1108
1115
|
this.globe.terrainProvider = terrainProvider;
|
|
1109
1116
|
}
|
|
@@ -4377,6 +4384,61 @@ Scene.prototype.morphTo3D = function (duration) {
|
|
|
4377
4384
|
this._transitioner.morphTo3D(duration, ellipsoid);
|
|
4378
4385
|
};
|
|
4379
4386
|
|
|
4387
|
+
function setTerrain(scene, terrain) {
|
|
4388
|
+
// Cancel any in-progress terrain update
|
|
4389
|
+
scene._removeTerrainProviderReadyListener =
|
|
4390
|
+
scene._removeTerrainProviderReadyListener &&
|
|
4391
|
+
scene._removeTerrainProviderReadyListener();
|
|
4392
|
+
|
|
4393
|
+
// If the terrain is already loaded, set it immediately
|
|
4394
|
+
if (terrain.ready) {
|
|
4395
|
+
if (defined(scene.globe)) {
|
|
4396
|
+
scene.globe.terrainProvider = terrain.provider;
|
|
4397
|
+
}
|
|
4398
|
+
return;
|
|
4399
|
+
}
|
|
4400
|
+
// Otherwise, set a placeholder
|
|
4401
|
+
scene.globe.terrainProvider = undefined;
|
|
4402
|
+
scene._removeTerrainProviderReadyListener = terrain.readyEvent.addEventListener(
|
|
4403
|
+
(provider) => {
|
|
4404
|
+
if (defined(scene) && defined(scene.globe)) {
|
|
4405
|
+
scene.globe.terrainProvider = provider;
|
|
4406
|
+
}
|
|
4407
|
+
|
|
4408
|
+
scene._removeTerrainProviderReadyListener();
|
|
4409
|
+
}
|
|
4410
|
+
);
|
|
4411
|
+
}
|
|
4412
|
+
|
|
4413
|
+
/**
|
|
4414
|
+
* Update the terrain providing surface geometry for the globe.
|
|
4415
|
+
*
|
|
4416
|
+
* @param {Terrain} terrain The terrain provider async helper
|
|
4417
|
+
* @returns {Terrain} terrain The terrain provider async helper
|
|
4418
|
+
*
|
|
4419
|
+
* @example
|
|
4420
|
+
* // Use Cesium World Terrain
|
|
4421
|
+
* scene.setTerrain(Cesium.Terrain.fromWorldTerrain());
|
|
4422
|
+
*
|
|
4423
|
+
* @example
|
|
4424
|
+
* // Use a custom terrain provider
|
|
4425
|
+
* const terrain = new Cesium.Terrain(Cesium.CesiumTerrainProvider.fromUrl("https://myTestTerrain.com"));
|
|
4426
|
+
* scene.setTerrain(terrain);
|
|
4427
|
+
*
|
|
4428
|
+
* terrain.errorEvent.addEventListener(error => {
|
|
4429
|
+
* alert(`Encountered an error while creating terrain! ${error}`);
|
|
4430
|
+
* });
|
|
4431
|
+
*/
|
|
4432
|
+
Scene.prototype.setTerrain = function (terrain) {
|
|
4433
|
+
//>>includeStart('debug', pragmas.debug);
|
|
4434
|
+
Check.typeOf.object("terrain", terrain);
|
|
4435
|
+
//>>includeEnd('debug');
|
|
4436
|
+
|
|
4437
|
+
setTerrain(this, terrain);
|
|
4438
|
+
|
|
4439
|
+
return terrain;
|
|
4440
|
+
};
|
|
4441
|
+
|
|
4380
4442
|
/**
|
|
4381
4443
|
* Returns true if this object was destroyed; otherwise, false.
|
|
4382
4444
|
* <br /><br />
|
|
@@ -4421,6 +4483,9 @@ Scene.prototype.destroy = function () {
|
|
|
4421
4483
|
this._groundPrimitives =
|
|
4422
4484
|
this._groundPrimitives && this._groundPrimitives.destroy();
|
|
4423
4485
|
this._globe = this._globe && this._globe.destroy();
|
|
4486
|
+
this._removeTerrainProviderReadyListener =
|
|
4487
|
+
this._removeTerrainProviderReadyListener &&
|
|
4488
|
+
this._removeTerrainProviderReadyListener();
|
|
4424
4489
|
this.skyBox = this.skyBox && this.skyBox.destroy();
|
|
4425
4490
|
this.skyAtmosphere = this.skyAtmosphere && this.skyAtmosphere.destroy();
|
|
4426
4491
|
this._debugSphere = this._debugSphere && this._debugSphere.destroy();
|
|
@@ -245,7 +245,7 @@ function ScreenSpaceCameraController(scene) {
|
|
|
245
245
|
this.minimumTrackBallHeight = 7500000.0;
|
|
246
246
|
this._minimumTrackBallHeight = this.minimumTrackBallHeight;
|
|
247
247
|
/**
|
|
248
|
-
*
|
|
248
|
+
* When disabled, the values of <code>maximumZoomDistance</code> and <code>minimumZoomDistance</code> are ignored.
|
|
249
249
|
* @type {boolean}
|
|
250
250
|
* @default true
|
|
251
251
|
*/
|