@cesium/engine 2.1.0 → 2.3.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-a6f9f0e5.js → AxisAlignedBoundingBox-31fadcf0.js} +1 -1
- package/Build/Workers/{BoundingRectangle-b0a68595.js → BoundingRectangle-995f0079.js} +1 -1
- package/Build/Workers/{BoxGeometry-baedd794.js → BoxGeometry-7eb1af60.js} +1 -1
- package/Build/Workers/{Color-f85df1be.js → Color-2dc49658.js} +1 -1
- package/Build/Workers/{CoplanarPolygonGeometryLibrary-30516950.js → CoplanarPolygonGeometryLibrary-d7d972d6.js} +1 -1
- package/Build/Workers/{CorridorGeometryLibrary-5d5d3b3a.js → CorridorGeometryLibrary-1f5ef7b3.js} +1 -1
- package/Build/Workers/{CylinderGeometry-d899ae26.js → CylinderGeometry-23c67a6c.js} +1 -1
- package/Build/Workers/{CylinderGeometryLibrary-135b0858.js → CylinderGeometryLibrary-7bf291b4.js} +1 -1
- package/Build/Workers/{EllipseGeometry-a49f8449.js → EllipseGeometry-37014da4.js} +1 -1
- package/Build/Workers/{EllipseGeometryLibrary-cba7edde.js → EllipseGeometryLibrary-92ab6b1e.js} +1 -1
- package/Build/Workers/{EllipseOutlineGeometry-8095c8cb.js → EllipseOutlineGeometry-12b6fef5.js} +1 -1
- package/Build/Workers/{EllipsoidGeodesic-dcff5cbd.js → EllipsoidGeodesic-5b3623dc.js} +1 -1
- package/Build/Workers/{EllipsoidGeometry-ed93f571.js → EllipsoidGeometry-508da15c.js} +1 -1
- package/Build/Workers/{EllipsoidOutlineGeometry-e4854854.js → EllipsoidOutlineGeometry-40d97455.js} +1 -1
- package/Build/Workers/{EllipsoidRhumbLine-b672d507.js → EllipsoidRhumbLine-ef872433.js} +1 -1
- package/Build/Workers/{EllipsoidTangentPlane-7ae1aa9a.js → EllipsoidTangentPlane-46d4d9c2.js} +1 -1
- package/Build/Workers/{EncodedCartesian3-e8bbca36.js → EncodedCartesian3-57415c8a.js} +1 -1
- package/Build/Workers/{FrustumGeometry-b62db3e3.js → FrustumGeometry-38605e69.js} +32 -4
- package/Build/Workers/{GeometryAttribute-780af4fa.js → GeometryAttribute-a466e9c7.js} +1 -1
- package/Build/Workers/{GeometryInstance-3fb607b7.js → GeometryInstance-34d9e21e.js} +1 -1
- package/Build/Workers/{GeometryPipeline-36b61c99.js → GeometryPipeline-dcf79306.js} +1 -1
- package/Build/Workers/{IndexDatatype-b8f3e09d.js → IndexDatatype-2643aa47.js} +1 -1
- package/Build/Workers/{IntersectionTests-e889fcf0.js → IntersectionTests-88c49b2e.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-43478ac8.js → OrientedBoundingBox-2dd47921.js} +5 -3
- package/Build/Workers/{Plane-c27e1ac6.js → Plane-4c3d403b.js} +1 -1
- package/Build/Workers/{PolygonGeometryLibrary-38a98276.js → PolygonGeometryLibrary-59126025.js} +1 -1
- package/Build/Workers/PolygonPipeline-1fe328c0.js +1344 -0
- package/Build/Workers/{PolylinePipeline-30e4cec9.js → PolylinePipeline-896735cc.js} +1 -1
- package/Build/Workers/{PolylineVolumeGeometryLibrary-90551d26.js → PolylineVolumeGeometryLibrary-9c0639f7.js} +1 -1
- package/Build/Workers/{PrimitivePipeline-558d9cb0.js → PrimitivePipeline-fc1a47ff.js} +1 -1
- package/Build/Workers/{RectangleGeometryLibrary-815c68df.js → RectangleGeometryLibrary-a23c9ebe.js} +1 -1
- package/Build/Workers/{TerrainEncoding-341ead52.js → TerrainEncoding-51b8b33b.js} +1 -1
- package/Build/Workers/Transforms-bc45e707.js +14699 -0
- package/Build/Workers/{WallGeometryLibrary-ccf90976.js → WallGeometryLibrary-007e9883.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 +10 -15
- 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/ArcGISTiledElevationTerrainProvider.js +291 -191
- package/Source/Core/BingMapsGeocoderService.js +19 -1
- package/Source/Core/CartographicGeocoderService.js +15 -0
- package/Source/Core/CesiumTerrainProvider.js +571 -434
- package/Source/Core/Credit.js +1 -1
- package/Source/Core/CustomHeightmapTerrainProvider.js +12 -0
- package/Source/Core/EllipsoidTerrainProvider.js +17 -10
- package/Source/Core/FrustumGeometry.js +4 -3
- package/Source/Core/GeocoderService.js +32 -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/IonGeocoderService.js +17 -2
- package/Source/Core/IonResource.js +14 -3
- package/Source/Core/OpenCageGeocoderService.js +18 -1
- package/Source/Core/OrientedBoundingBox.js +4 -2
- 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 -5
- package/Source/Core/Resource.js +230 -236
- 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/DataSourceDisplay.js +2 -2
- package/Source/DataSources/Entity.js +6 -1
- package/Source/DataSources/EntityCluster.js +126 -128
- package/Source/DataSources/ModelVisualizer.js +104 -34
- package/Source/DataSources/PolygonGraphics.js +1 -1
- 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 +694 -376
- package/Source/Scene/ArcGisMapService.js +83 -0
- package/Source/Scene/BingMapsImageryProvider.js +511 -305
- package/Source/Scene/BufferLoader.js +29 -34
- package/Source/Scene/Camera.js +8 -7
- package/Source/Scene/Cesium3DTile.js +392 -254
- 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 +756 -482
- 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 +132 -20
- 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 +53 -30
- 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 +87 -74
- package/Source/Scene/GltfLoader.js +381 -300
- 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 +482 -275
- 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/MaterialPipelineStage.js +12 -12
- package/Source/Scene/Model/Model.js +514 -135
- 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/Model/UniformType.js +1 -1
- package/Source/Scene/Multiple3DTileContent.js +134 -115
- package/Source/Scene/Picking.js +3 -2
- package/Source/Scene/PointCloud.js +11 -19
- package/Source/Scene/Primitive.js +20 -0
- package/Source/Scene/QuadtreePrimitive.js +5 -2
- 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/SceneTransforms.js +3 -2
- package/Source/Scene/ScreenSpaceCameraController.js +2 -2
- 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 +97 -81
- 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/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 +67 -27
- package/index.d.ts +2429 -1475
- package/index.js +324 -315
- package/package.json +4 -4
- package/Build/Workers/PolygonPipeline-d31ff61c.js +0 -1345
- package/Build/Workers/Transforms-9e9df299.js +0 -14714
|
@@ -2,6 +2,7 @@ import Color from "../../Core/Color.js";
|
|
|
2
2
|
import combine from "../../Core/combine.js";
|
|
3
3
|
import defined from "../../Core/defined.js";
|
|
4
4
|
import destroyObject from "../../Core/destroyObject.js";
|
|
5
|
+
import deprecationWarning from "../../Core/deprecationWarning.js";
|
|
5
6
|
import DeveloperError from "../../Core/DeveloperError.js";
|
|
6
7
|
import Pass from "../../Renderer/Pass.js";
|
|
7
8
|
import ModelAnimationLoop from "../ModelAnimationLoop.js";
|
|
@@ -14,6 +15,8 @@ import Model from "./Model.js";
|
|
|
14
15
|
* <p>
|
|
15
16
|
* Implements the {@link Cesium3DTileContent} interface.
|
|
16
17
|
* </p>
|
|
18
|
+
* This object is normally not instantiated directly, use {@link Model3DTileContent.fromGltf}, {@link Model3DTileContent.fromB3dm}, {@link Model3DTileContent.fromI3dm}, {@link Model3DTileContent.fromPnts}, or {@link Model3DTileContent.fromGeoJson}.
|
|
19
|
+
*
|
|
17
20
|
* @alias Model3DTileContent
|
|
18
21
|
* @constructor
|
|
19
22
|
* @private
|
|
@@ -24,9 +27,12 @@ function Model3DTileContent(tileset, tile, resource) {
|
|
|
24
27
|
this._resource = resource;
|
|
25
28
|
|
|
26
29
|
this._model = undefined;
|
|
27
|
-
this._readyPromise = undefined;
|
|
28
30
|
this._metadata = undefined;
|
|
29
31
|
this._group = undefined;
|
|
32
|
+
this._ready = false;
|
|
33
|
+
|
|
34
|
+
this._resolveContent = undefined;
|
|
35
|
+
this._readyPromise = undefined;
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
Object.defineProperties(Model3DTileContent.prototype, {
|
|
@@ -83,8 +89,37 @@ Object.defineProperties(Model3DTileContent.prototype, {
|
|
|
83
89
|
},
|
|
84
90
|
},
|
|
85
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Returns true when the tile's content is ready to render; otherwise false
|
|
94
|
+
*
|
|
95
|
+
* @memberof Model3DTileContent.prototype
|
|
96
|
+
*
|
|
97
|
+
* @type {boolean}
|
|
98
|
+
* @readonly
|
|
99
|
+
* @private
|
|
100
|
+
*/
|
|
101
|
+
ready: {
|
|
102
|
+
get: function () {
|
|
103
|
+
return this._ready;
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Gets the promise that will be resolved when the tile's content is ready to render.
|
|
109
|
+
*
|
|
110
|
+
* @memberof Model3DTileContent.prototype
|
|
111
|
+
*
|
|
112
|
+
* @type {Promise<Model3DTileContent>}
|
|
113
|
+
* @readonly
|
|
114
|
+
* @deprecated
|
|
115
|
+
* @private
|
|
116
|
+
*/
|
|
86
117
|
readyPromise: {
|
|
87
118
|
get: function () {
|
|
119
|
+
deprecationWarning(
|
|
120
|
+
"Model3DTileContent.readyPromise",
|
|
121
|
+
"Model3DTileContent.readyPromise was deprecated in CesiumJS 1.104. It will be removed in 1.107. Wait for Model3DTileContent.ready to return true instead."
|
|
122
|
+
);
|
|
88
123
|
return this._readyPromise;
|
|
89
124
|
},
|
|
90
125
|
},
|
|
@@ -244,6 +279,16 @@ Model3DTileContent.prototype.update = function (tileset, frameState) {
|
|
|
244
279
|
}
|
|
245
280
|
|
|
246
281
|
model.update(frameState);
|
|
282
|
+
|
|
283
|
+
if (!this._ready && model.ready) {
|
|
284
|
+
// Animation can only be added once the model is ready
|
|
285
|
+
model.activeAnimations.addAll({
|
|
286
|
+
loop: ModelAnimationLoop.REPEAT,
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
this._ready = true;
|
|
290
|
+
this._resolveContent = this._resolveContent && this._resolveContent(this);
|
|
291
|
+
}
|
|
247
292
|
};
|
|
248
293
|
|
|
249
294
|
Model3DTileContent.prototype.isDestroyed = function () {
|
|
@@ -255,7 +300,7 @@ Model3DTileContent.prototype.destroy = function () {
|
|
|
255
300
|
return destroyObject(this);
|
|
256
301
|
};
|
|
257
302
|
|
|
258
|
-
Model3DTileContent.fromGltf = function (tileset, tile, resource, gltf) {
|
|
303
|
+
Model3DTileContent.fromGltf = async function (tileset, tile, resource, gltf) {
|
|
259
304
|
const content = new Model3DTileContent(tileset, tile, resource);
|
|
260
305
|
|
|
261
306
|
const additionalOptions = {
|
|
@@ -276,20 +321,18 @@ Model3DTileContent.fromGltf = function (tileset, tile, resource, gltf) {
|
|
|
276
321
|
|
|
277
322
|
modelOptions.classificationType = classificationType;
|
|
278
323
|
|
|
279
|
-
const model = Model.
|
|
324
|
+
const model = await Model.fromGltfAsync(modelOptions);
|
|
280
325
|
content._model = model;
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
});
|
|
286
|
-
return model;
|
|
326
|
+
|
|
327
|
+
// This is for backwards compatibility. It can be removed once readyPromise is removed.
|
|
328
|
+
content._readyPromise = new Promise((resolve) => {
|
|
329
|
+
content._resolveContent = resolve;
|
|
287
330
|
});
|
|
288
331
|
|
|
289
332
|
return content;
|
|
290
333
|
};
|
|
291
334
|
|
|
292
|
-
Model3DTileContent.fromB3dm = function (
|
|
335
|
+
Model3DTileContent.fromB3dm = async function (
|
|
293
336
|
tileset,
|
|
294
337
|
tile,
|
|
295
338
|
resource,
|
|
@@ -317,20 +360,18 @@ Model3DTileContent.fromB3dm = function (
|
|
|
317
360
|
|
|
318
361
|
modelOptions.classificationType = classificationType;
|
|
319
362
|
|
|
320
|
-
const model = Model.fromB3dm(modelOptions);
|
|
363
|
+
const model = await Model.fromB3dm(modelOptions);
|
|
321
364
|
content._model = model;
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
});
|
|
327
|
-
return model;
|
|
365
|
+
|
|
366
|
+
// This is for backwards compatibility. It can be removed once readyPromise is removed.
|
|
367
|
+
content._readyPromise = new Promise((resolve) => {
|
|
368
|
+
content._resolveContent = resolve;
|
|
328
369
|
});
|
|
329
370
|
|
|
330
371
|
return content;
|
|
331
372
|
};
|
|
332
373
|
|
|
333
|
-
Model3DTileContent.fromI3dm = function (
|
|
374
|
+
Model3DTileContent.fromI3dm = async function (
|
|
334
375
|
tileset,
|
|
335
376
|
tile,
|
|
336
377
|
resource,
|
|
@@ -352,20 +393,18 @@ Model3DTileContent.fromI3dm = function (
|
|
|
352
393
|
additionalOptions
|
|
353
394
|
);
|
|
354
395
|
|
|
355
|
-
const model = Model.fromI3dm(modelOptions);
|
|
396
|
+
const model = await Model.fromI3dm(modelOptions);
|
|
356
397
|
content._model = model;
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
});
|
|
362
|
-
return model;
|
|
398
|
+
|
|
399
|
+
// This is for backwards compatibility. It can be removed once readyPromise is removed.
|
|
400
|
+
content._readyPromise = new Promise((resolve) => {
|
|
401
|
+
content._resolveContent = resolve;
|
|
363
402
|
});
|
|
364
403
|
|
|
365
404
|
return content;
|
|
366
405
|
};
|
|
367
406
|
|
|
368
|
-
Model3DTileContent.fromPnts = function (
|
|
407
|
+
Model3DTileContent.fromPnts = async function (
|
|
369
408
|
tileset,
|
|
370
409
|
tile,
|
|
371
410
|
resource,
|
|
@@ -386,14 +425,23 @@ Model3DTileContent.fromPnts = function (
|
|
|
386
425
|
content,
|
|
387
426
|
additionalOptions
|
|
388
427
|
);
|
|
389
|
-
const model = Model.fromPnts(modelOptions);
|
|
428
|
+
const model = await Model.fromPnts(modelOptions);
|
|
390
429
|
content._model = model;
|
|
391
|
-
|
|
430
|
+
|
|
431
|
+
// This is for backwards compatibility. It can be removed once readyPromise is removed.
|
|
432
|
+
content._readyPromise = new Promise((resolve) => {
|
|
433
|
+
content._resolveContent = resolve;
|
|
434
|
+
});
|
|
392
435
|
|
|
393
436
|
return content;
|
|
394
437
|
};
|
|
395
438
|
|
|
396
|
-
Model3DTileContent.fromGeoJson = function (
|
|
439
|
+
Model3DTileContent.fromGeoJson = async function (
|
|
440
|
+
tileset,
|
|
441
|
+
tile,
|
|
442
|
+
resource,
|
|
443
|
+
geoJson
|
|
444
|
+
) {
|
|
397
445
|
const content = new Model3DTileContent(tileset, tile, resource);
|
|
398
446
|
|
|
399
447
|
const additionalOptions = {
|
|
@@ -407,9 +455,13 @@ Model3DTileContent.fromGeoJson = function (tileset, tile, resource, geoJson) {
|
|
|
407
455
|
content,
|
|
408
456
|
additionalOptions
|
|
409
457
|
);
|
|
410
|
-
const model = Model.fromGeoJson(modelOptions);
|
|
458
|
+
const model = await Model.fromGeoJson(modelOptions);
|
|
411
459
|
content._model = model;
|
|
412
|
-
|
|
460
|
+
|
|
461
|
+
// This is for backwards compatibility. It can be removed once readyPromise is removed.
|
|
462
|
+
content._readyPromise = new Promise((resolve) => {
|
|
463
|
+
content._resolveContent = resolve;
|
|
464
|
+
});
|
|
413
465
|
|
|
414
466
|
return content;
|
|
415
467
|
};
|
|
@@ -123,7 +123,7 @@ function addAnimation(collection, animation, options) {
|
|
|
123
123
|
* @param {ModelAnimation.AnimationTimeCallback} [options.animationTime=undefined] If defined, computes the local animation time for this animation.
|
|
124
124
|
* @returns {ModelAnimation} The animation that was added to the collection.
|
|
125
125
|
*
|
|
126
|
-
* @exception {DeveloperError} Animations are not loaded. Wait for the {@link Model#
|
|
126
|
+
* @exception {DeveloperError} Animations are not loaded. Wait for the {@link Model#ready} to return trues.
|
|
127
127
|
* @exception {DeveloperError} options.name must be a valid animation name.
|
|
128
128
|
* @exception {DeveloperError} options.index must be a valid animation index.
|
|
129
129
|
* @exception {DeveloperError} Either options.name or options.index must be defined.
|
|
@@ -174,7 +174,7 @@ ModelAnimationCollection.prototype.add = function (options) {
|
|
|
174
174
|
//>>includeStart('debug', pragmas.debug);
|
|
175
175
|
if (!model.ready) {
|
|
176
176
|
throw new DeveloperError(
|
|
177
|
-
"Animations are not loaded. Wait for Model.
|
|
177
|
+
"Animations are not loaded. Wait for Model.ready to be true."
|
|
178
178
|
);
|
|
179
179
|
}
|
|
180
180
|
//>>includeEnd('debug');
|
|
@@ -258,7 +258,7 @@ ModelAnimationCollection.prototype.addAll = function (options) {
|
|
|
258
258
|
//>>includeStart('debug', pragmas.debug);
|
|
259
259
|
if (!model.ready) {
|
|
260
260
|
throw new DeveloperError(
|
|
261
|
-
"Animations are not loaded. Wait for Model.
|
|
261
|
+
"Animations are not loaded. Wait for Model.ready to be true."
|
|
262
262
|
);
|
|
263
263
|
}
|
|
264
264
|
|
|
@@ -437,9 +437,8 @@ function updateShadows(drawCommand) {
|
|
|
437
437
|
const receiveShadows = ShadowMode.receiveShadows(shadows);
|
|
438
438
|
|
|
439
439
|
const derivedCommands = drawCommand._derivedCommands;
|
|
440
|
-
const length = derivedCommands.length;
|
|
441
440
|
|
|
442
|
-
for (let i = 0; i < length; ++i) {
|
|
441
|
+
for (let i = 0; i < derivedCommands.length; ++i) {
|
|
443
442
|
const derivedCommand = derivedCommands[i];
|
|
444
443
|
if (derivedCommand.updateShadows) {
|
|
445
444
|
const command = derivedCommand.command;
|
|
@@ -451,11 +450,9 @@ function updateShadows(drawCommand) {
|
|
|
451
450
|
|
|
452
451
|
function updateBackFaceCulling(drawCommand) {
|
|
453
452
|
const backFaceCulling = drawCommand.backFaceCulling;
|
|
454
|
-
|
|
455
453
|
const derivedCommands = drawCommand._derivedCommands;
|
|
456
|
-
const length = derivedCommands.length;
|
|
457
454
|
|
|
458
|
-
for (let i = 0; i < length; ++i) {
|
|
455
|
+
for (let i = 0; i < derivedCommands.length; ++i) {
|
|
459
456
|
const derivedCommand = derivedCommands[i];
|
|
460
457
|
if (derivedCommand.updateBackFaceCulling) {
|
|
461
458
|
const command = derivedCommand.command;
|
|
@@ -468,11 +465,9 @@ function updateBackFaceCulling(drawCommand) {
|
|
|
468
465
|
|
|
469
466
|
function updateCullFace(drawCommand) {
|
|
470
467
|
const cullFace = drawCommand.cullFace;
|
|
471
|
-
|
|
472
468
|
const derivedCommands = drawCommand._derivedCommands;
|
|
473
|
-
const length = derivedCommands.length;
|
|
474
469
|
|
|
475
|
-
for (let i = 0; i < length; ++i) {
|
|
470
|
+
for (let i = 0; i < derivedCommands.length; ++i) {
|
|
476
471
|
const derivedCommand = derivedCommands[i];
|
|
477
472
|
if (derivedCommand.updateCullFace) {
|
|
478
473
|
const command = derivedCommand.command;
|
|
@@ -485,11 +480,9 @@ function updateCullFace(drawCommand) {
|
|
|
485
480
|
|
|
486
481
|
function updateDebugShowBoundingVolume(drawCommand) {
|
|
487
482
|
const debugShowBoundingVolume = drawCommand.debugShowBoundingVolume;
|
|
488
|
-
|
|
489
483
|
const derivedCommands = drawCommand._derivedCommands;
|
|
490
|
-
const length = derivedCommands.length;
|
|
491
484
|
|
|
492
|
-
for (let i = 0; i < length; ++i) {
|
|
485
|
+
for (let i = 0; i < derivedCommands.length; ++i) {
|
|
493
486
|
const derivedCommand = derivedCommands[i];
|
|
494
487
|
if (derivedCommand.updateDebugShowBoundingVolume) {
|
|
495
488
|
const command = derivedCommand.command;
|
|
@@ -537,15 +530,10 @@ ModelDrawCommand.prototype.pushCommands = function (frameState, result) {
|
|
|
537
530
|
}
|
|
538
531
|
|
|
539
532
|
if (this._needsSkipLevelOfDetailCommands) {
|
|
540
|
-
const
|
|
541
|
-
const tileset = content.tileset;
|
|
542
|
-
const tile = content.tile;
|
|
543
|
-
|
|
544
|
-
const hasMixedContent = tileset._hasMixedContent;
|
|
545
|
-
const finalResolution = tile._finalResolution;
|
|
533
|
+
const { tileset, tile } = this._model.content;
|
|
546
534
|
|
|
547
|
-
if (hasMixedContent) {
|
|
548
|
-
if (!
|
|
535
|
+
if (tileset.hasMixedContent) {
|
|
536
|
+
if (!tile._finalResolution) {
|
|
549
537
|
pushCommand(
|
|
550
538
|
tileset._backfaceCommands,
|
|
551
539
|
this._skipLodBackfaceCommand,
|
|
@@ -846,13 +834,14 @@ function deriveSkipLodStencilCommand(command) {
|
|
|
846
834
|
const stencilCommand = DrawCommand.shallowClone(command);
|
|
847
835
|
const renderState = clone(command.renderState, true);
|
|
848
836
|
// The stencil reference is updated dynamically; see updateSkipLodStencilCommand().
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
837
|
+
const { stencilTest } = renderState;
|
|
838
|
+
stencilTest.enabled = true;
|
|
839
|
+
stencilTest.mask = StencilConstants.SKIP_LOD_MASK;
|
|
840
|
+
stencilTest.reference = StencilConstants.CESIUM_3D_TILE_MASK;
|
|
841
|
+
stencilTest.frontFunction = StencilFunction.GREATER_OR_EQUAL;
|
|
842
|
+
stencilTest.frontOperation.zPass = StencilOperation.REPLACE;
|
|
843
|
+
stencilTest.backFunction = StencilFunction.GREATER_OR_EQUAL;
|
|
844
|
+
stencilTest.backOperation.zPass = StencilOperation.REPLACE;
|
|
856
845
|
renderState.stencilMask =
|
|
857
846
|
StencilConstants.CESIUM_3D_TILE_MASK | StencilConstants.SKIP_LOD_MASK;
|
|
858
847
|
|
|
@@ -20,29 +20,27 @@ function ModelUtility() {}
|
|
|
20
20
|
/**
|
|
21
21
|
* Create a function for reporting when a model fails to load
|
|
22
22
|
*
|
|
23
|
-
* @param {Model} model The model to report about
|
|
24
23
|
* @param {string} type The type of object to report about
|
|
25
24
|
* @param {string} path The URI of the model file
|
|
26
|
-
* @
|
|
25
|
+
* @param {Error} [error] The error which caused the failure
|
|
26
|
+
* @returns {RuntimeError} An error for the failed model
|
|
27
27
|
*
|
|
28
28
|
* @private
|
|
29
29
|
*/
|
|
30
|
-
ModelUtility.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
30
|
+
ModelUtility.getError = function (type, path, error) {
|
|
31
|
+
let message = `Failed to load ${type}: ${path}`;
|
|
32
|
+
if (defined(error) && defined(error.message)) {
|
|
33
|
+
message += `\n${error.message}`;
|
|
34
|
+
}
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
const runtimeError = new RuntimeError(message);
|
|
37
|
+
if (defined(error)) {
|
|
38
|
+
// the original call stack is often more useful than the new error's stack,
|
|
39
|
+
// so add the information here
|
|
40
|
+
runtimeError.stack = `Original stack:\n${error.stack}\nHandler stack:\n${runtimeError.stack}`;
|
|
41
|
+
}
|
|
43
42
|
|
|
44
|
-
|
|
45
|
-
};
|
|
43
|
+
return runtimeError;
|
|
46
44
|
};
|
|
47
45
|
|
|
48
46
|
/**
|
|
@@ -372,6 +370,8 @@ ModelUtility.supportedExtensions = {
|
|
|
372
370
|
* a {@link RuntimeError} with the extension name.
|
|
373
371
|
*
|
|
374
372
|
* @param {string[]} extensionsRequired The extensionsRequired array in the glTF.
|
|
373
|
+
*
|
|
374
|
+
* @exception {RuntimeError} Unsupported glTF Extension
|
|
375
375
|
*/
|
|
376
376
|
ModelUtility.checkSupportedExtensions = function (extensionsRequired) {
|
|
377
377
|
const length = extensionsRequired.length;
|
|
@@ -66,7 +66,7 @@ function PntsLoader(options) {
|
|
|
66
66
|
this._decodedAttributes = undefined;
|
|
67
67
|
|
|
68
68
|
this._promise = undefined;
|
|
69
|
-
this.
|
|
69
|
+
this._error = undefined;
|
|
70
70
|
this._state = ResourceLoaderState.UNLOADED;
|
|
71
71
|
this._buffers = [];
|
|
72
72
|
|
|
@@ -81,20 +81,6 @@ if (defined(Object.create)) {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
Object.defineProperties(PntsLoader.prototype, {
|
|
84
|
-
/**
|
|
85
|
-
* A promise that resolves to the resource when the resource is ready, or undefined if the resource hasn't started loading.
|
|
86
|
-
*
|
|
87
|
-
* @memberof PntsLoader.prototype
|
|
88
|
-
*
|
|
89
|
-
* @type {Promise<PntsLoader>|undefined}
|
|
90
|
-
* @readonly
|
|
91
|
-
* @private
|
|
92
|
-
*/
|
|
93
|
-
promise: {
|
|
94
|
-
get: function () {
|
|
95
|
-
return this._promise;
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
84
|
/**
|
|
99
85
|
* The cache key of the resource
|
|
100
86
|
*
|
|
@@ -148,28 +134,36 @@ Object.defineProperties(PntsLoader.prototype, {
|
|
|
148
134
|
* @private
|
|
149
135
|
*/
|
|
150
136
|
PntsLoader.prototype.load = function () {
|
|
137
|
+
if (defined(this._promise)) {
|
|
138
|
+
return this._promise;
|
|
139
|
+
}
|
|
140
|
+
|
|
151
141
|
this._parsedContent = PntsParser.parse(this._arrayBuffer, this._byteOffset);
|
|
152
142
|
this._state = ResourceLoaderState.PROCESSING;
|
|
153
143
|
|
|
154
|
-
|
|
155
|
-
this._promise = new Promise(function (resolve, reject) {
|
|
156
|
-
loader._process = function (frameState) {
|
|
157
|
-
if (loader._state === ResourceLoaderState.PROCESSING) {
|
|
158
|
-
if (defined(loader._decodePromise)) {
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
const decodePromise = decodeDraco(loader, frameState.context);
|
|
163
|
-
if (defined(decodePromise)) {
|
|
164
|
-
decodePromise.then(resolve).catch(reject);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
});
|
|
144
|
+
this._promise = Promise.resolve(this);
|
|
169
145
|
};
|
|
170
146
|
|
|
171
147
|
PntsLoader.prototype.process = function (frameState) {
|
|
172
|
-
this.
|
|
148
|
+
if (defined(this._error)) {
|
|
149
|
+
const error = this._error;
|
|
150
|
+
this._error = undefined;
|
|
151
|
+
throw error;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (this._state === ResourceLoaderState.READY) {
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (this._state === ResourceLoaderState.PROCESSING) {
|
|
159
|
+
if (defined(this._decodePromise)) {
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
this._decodePromise = decodeDraco(this, frameState.context);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return false;
|
|
173
167
|
};
|
|
174
168
|
|
|
175
169
|
function decodeDraco(loader, context) {
|
|
@@ -207,7 +201,8 @@ function decodeDraco(loader, context) {
|
|
|
207
201
|
loader.unload();
|
|
208
202
|
loader._state = ResourceLoaderState.FAILED;
|
|
209
203
|
const errorMessage = "Failed to load Draco pnts";
|
|
210
|
-
|
|
204
|
+
// This error will be thrown next time process is called;
|
|
205
|
+
loader._error = loader.getError(errorMessage, error);
|
|
211
206
|
});
|
|
212
207
|
}
|
|
213
208
|
|