@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
|
@@ -52,15 +52,29 @@ function Vector3DTilePoints(options) {
|
|
|
52
52
|
this._polylineCollection = new PolylineCollection();
|
|
53
53
|
this._polylineCollection._useHighlightColor = true;
|
|
54
54
|
|
|
55
|
-
this._verticesPromise = undefined;
|
|
56
55
|
this._packedBuffer = undefined;
|
|
57
56
|
|
|
58
57
|
this._ready = false;
|
|
59
|
-
this.
|
|
60
|
-
this.
|
|
58
|
+
this._promise = undefined;
|
|
59
|
+
this._error = undefined;
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
Object.defineProperties(Vector3DTilePoints.prototype, {
|
|
63
|
+
/**
|
|
64
|
+
* Returns true if the points are ready to render
|
|
65
|
+
*
|
|
66
|
+
* @memberof Vector3DTilePoints.prototype
|
|
67
|
+
*
|
|
68
|
+
* @type {boolean}
|
|
69
|
+
* @readonly
|
|
70
|
+
* @private
|
|
71
|
+
*/
|
|
72
|
+
ready: {
|
|
73
|
+
get: function () {
|
|
74
|
+
return this._ready;
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
|
|
64
78
|
/**
|
|
65
79
|
* Gets the number of points.
|
|
66
80
|
*
|
|
@@ -68,6 +82,7 @@ Object.defineProperties(Vector3DTilePoints.prototype, {
|
|
|
68
82
|
*
|
|
69
83
|
* @type {number}
|
|
70
84
|
* @readonly
|
|
85
|
+
* @private
|
|
71
86
|
*/
|
|
72
87
|
pointsLength: {
|
|
73
88
|
get: function () {
|
|
@@ -82,6 +97,7 @@ Object.defineProperties(Vector3DTilePoints.prototype, {
|
|
|
82
97
|
*
|
|
83
98
|
* @type {number}
|
|
84
99
|
* @readonly
|
|
100
|
+
* @private
|
|
85
101
|
*/
|
|
86
102
|
texturesByteLength: {
|
|
87
103
|
get: function () {
|
|
@@ -91,18 +107,6 @@ Object.defineProperties(Vector3DTilePoints.prototype, {
|
|
|
91
107
|
return billboardSize + labelSize;
|
|
92
108
|
},
|
|
93
109
|
},
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Gets a promise that resolves when the primitive is ready to render.
|
|
97
|
-
* @memberof Vector3DTilePoints.prototype
|
|
98
|
-
* @type {Promise<void>}
|
|
99
|
-
* @readonly
|
|
100
|
-
*/
|
|
101
|
-
readyPromise: {
|
|
102
|
-
get: function () {
|
|
103
|
-
return this._readyPromise;
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
110
|
});
|
|
107
111
|
|
|
108
112
|
function packBuffer(points, ellipsoid) {
|
|
@@ -132,35 +136,38 @@ const createVerticesTaskProcessor = new TaskProcessor(
|
|
|
132
136
|
const scratchPosition = new Cartesian3();
|
|
133
137
|
|
|
134
138
|
function createPoints(points, ellipsoid) {
|
|
135
|
-
let positions;
|
|
136
|
-
|
|
137
|
-
positions = points._positions;
|
|
138
|
-
let packedBuffer = points._packedBuffer;
|
|
139
|
+
let positions = points._positions;
|
|
140
|
+
let packedBuffer = points._packedBuffer;
|
|
139
141
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
if (!defined(packedBuffer)) {
|
|
143
|
+
// Copy because they may be the views on the same buffer.
|
|
144
|
+
positions = points._positions = positions.slice();
|
|
145
|
+
points._batchIds = points._batchIds.slice();
|
|
144
146
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
+
packedBuffer = points._packedBuffer = packBuffer(points, ellipsoid);
|
|
148
|
+
}
|
|
147
149
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
150
|
+
const transferrableObjects = [positions.buffer, packedBuffer.buffer];
|
|
151
|
+
const parameters = {
|
|
152
|
+
positions: positions.buffer,
|
|
153
|
+
packedBuffer: packedBuffer.buffer,
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const verticesPromise = createVerticesTaskProcessor.scheduleTask(
|
|
157
|
+
parameters,
|
|
158
|
+
transferrableObjects
|
|
159
|
+
);
|
|
160
|
+
if (!defined(verticesPromise)) {
|
|
161
|
+
// Postponed
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return verticesPromise
|
|
166
|
+
.then((result) => {
|
|
167
|
+
if (points.isDestroyed()) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
162
170
|
|
|
163
|
-
return verticesPromise.then(function (result) {
|
|
164
171
|
points._positions = new Float64Array(result.positions);
|
|
165
172
|
const billboardCollection = points._billboardCollection;
|
|
166
173
|
const labelCollection = points._labelCollection;
|
|
@@ -190,8 +197,15 @@ function createPoints(points, ellipsoid) {
|
|
|
190
197
|
points._positions = undefined;
|
|
191
198
|
points._packedBuffer = undefined;
|
|
192
199
|
points._ready = true;
|
|
200
|
+
})
|
|
201
|
+
.catch((error) => {
|
|
202
|
+
if (points.isDestroyed()) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Throw the error next frame
|
|
207
|
+
points._error = error;
|
|
193
208
|
});
|
|
194
|
-
}
|
|
195
209
|
}
|
|
196
210
|
|
|
197
211
|
/**
|
|
@@ -460,37 +474,27 @@ Vector3DTilePoints.prototype.applyStyle = function (style, features) {
|
|
|
460
474
|
}
|
|
461
475
|
};
|
|
462
476
|
|
|
463
|
-
function initialize(points) {
|
|
464
|
-
return new Promise(function (resolve, reject) {
|
|
465
|
-
points._update = function (points, frameState) {
|
|
466
|
-
const promise = createPoints(points, frameState.mapProjection.ellipsoid);
|
|
467
|
-
|
|
468
|
-
if (points._ready) {
|
|
469
|
-
points._polylineCollection.update(frameState);
|
|
470
|
-
points._billboardCollection.update(frameState);
|
|
471
|
-
points._labelCollection.update(frameState);
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
if (!defined(promise)) {
|
|
475
|
-
return;
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
promise
|
|
479
|
-
.then(function () {
|
|
480
|
-
resolve();
|
|
481
|
-
})
|
|
482
|
-
.catch(function (e) {
|
|
483
|
-
reject(e);
|
|
484
|
-
});
|
|
485
|
-
};
|
|
486
|
-
});
|
|
487
|
-
}
|
|
488
|
-
|
|
489
477
|
/**
|
|
490
478
|
* @private
|
|
491
479
|
*/
|
|
492
480
|
Vector3DTilePoints.prototype.update = function (frameState) {
|
|
493
|
-
this.
|
|
481
|
+
if (!this._ready) {
|
|
482
|
+
if (!defined(this._promise)) {
|
|
483
|
+
this._promise = createPoints(this, frameState.mapProjection.ellipsoid);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
if (defined(this._error)) {
|
|
487
|
+
const error = this._error;
|
|
488
|
+
this._error = undefined;
|
|
489
|
+
throw error;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
this._polylineCollection.update(frameState);
|
|
496
|
+
this._billboardCollection.update(frameState);
|
|
497
|
+
this._labelCollection.update(frameState);
|
|
494
498
|
};
|
|
495
499
|
|
|
496
500
|
/**
|
|
@@ -40,8 +40,7 @@ import Vector3DTilePrimitive from "./Vector3DTilePrimitive.js";
|
|
|
40
40
|
* @private
|
|
41
41
|
*/
|
|
42
42
|
function Vector3DTilePolygons(options) {
|
|
43
|
-
// All of the private properties will be released except
|
|
44
|
-
// and _primitive after the Vector3DTilePrimitive is created.
|
|
43
|
+
// All of the private properties will be released except _primitive after the Vector3DTilePrimitive is created.
|
|
45
44
|
this._batchTable = options.batchTable;
|
|
46
45
|
|
|
47
46
|
this._batchIds = options.batchIds;
|
|
@@ -75,10 +74,8 @@ function Vector3DTilePolygons(options) {
|
|
|
75
74
|
this._batchedIndices = undefined;
|
|
76
75
|
|
|
77
76
|
this._ready = false;
|
|
78
|
-
this.
|
|
79
|
-
this.
|
|
80
|
-
this._verticesPromise = undefined;
|
|
81
|
-
|
|
77
|
+
this._promise = undefined;
|
|
78
|
+
this._error = undefined;
|
|
82
79
|
this._primitive = undefined;
|
|
83
80
|
|
|
84
81
|
/**
|
|
@@ -111,6 +108,7 @@ Object.defineProperties(Vector3DTilePolygons.prototype, {
|
|
|
111
108
|
*
|
|
112
109
|
* @type {number}
|
|
113
110
|
* @readonly
|
|
111
|
+
* @private
|
|
114
112
|
*/
|
|
115
113
|
trianglesLength: {
|
|
116
114
|
get: function () {
|
|
@@ -128,6 +126,7 @@ Object.defineProperties(Vector3DTilePolygons.prototype, {
|
|
|
128
126
|
*
|
|
129
127
|
* @type {number}
|
|
130
128
|
* @readonly
|
|
129
|
+
* @private
|
|
131
130
|
*/
|
|
132
131
|
geometryByteLength: {
|
|
133
132
|
get: function () {
|
|
@@ -139,14 +138,15 @@ Object.defineProperties(Vector3DTilePolygons.prototype, {
|
|
|
139
138
|
},
|
|
140
139
|
|
|
141
140
|
/**
|
|
142
|
-
*
|
|
141
|
+
* Returns true when the primitive is ready to render.
|
|
143
142
|
* @memberof Vector3DTilePolygons.prototype
|
|
144
|
-
* @type {
|
|
143
|
+
* @type {boolean}
|
|
145
144
|
* @readonly
|
|
145
|
+
* @private
|
|
146
146
|
*/
|
|
147
|
-
|
|
147
|
+
ready: {
|
|
148
148
|
get: function () {
|
|
149
|
-
return this.
|
|
149
|
+
return this._ready;
|
|
150
150
|
},
|
|
151
151
|
},
|
|
152
152
|
});
|
|
@@ -224,85 +224,89 @@ function createPrimitive(polygons) {
|
|
|
224
224
|
return;
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
batchTableColors[i] = color.toRgba();
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
packedBuffer = polygons._packedBuffer = packBuffer(polygons);
|
|
227
|
+
let positions = polygons._positions;
|
|
228
|
+
let counts = polygons._counts;
|
|
229
|
+
let indexCounts = polygons._indexCounts;
|
|
230
|
+
let indices = polygons._indices;
|
|
231
|
+
|
|
232
|
+
let batchIds = polygons._transferrableBatchIds;
|
|
233
|
+
let batchTableColors = polygons._batchTableColors;
|
|
234
|
+
|
|
235
|
+
let packedBuffer = polygons._packedBuffer;
|
|
236
|
+
|
|
237
|
+
if (!defined(batchTableColors)) {
|
|
238
|
+
// Copy because they may be the views on the same buffer.
|
|
239
|
+
positions = polygons._positions = polygons._positions.slice();
|
|
240
|
+
counts = polygons._counts = polygons._counts.slice();
|
|
241
|
+
indexCounts = polygons._indexCounts = polygons._indexCounts.slice();
|
|
242
|
+
indices = polygons._indices = polygons._indices.slice();
|
|
243
|
+
|
|
244
|
+
polygons._center = polygons._ellipsoid.cartographicToCartesian(
|
|
245
|
+
Rectangle.center(polygons._rectangle)
|
|
246
|
+
);
|
|
247
|
+
|
|
248
|
+
batchIds = polygons._transferrableBatchIds = new Uint32Array(
|
|
249
|
+
polygons._batchIds
|
|
250
|
+
);
|
|
251
|
+
batchTableColors = polygons._batchTableColors = new Uint32Array(
|
|
252
|
+
batchIds.length
|
|
253
|
+
);
|
|
254
|
+
const batchTable = polygons._batchTable;
|
|
255
|
+
|
|
256
|
+
const length = batchTableColors.length;
|
|
257
|
+
for (let i = 0; i < length; ++i) {
|
|
258
|
+
const color = batchTable.getColor(i, scratchColor);
|
|
259
|
+
batchTableColors[i] = color.toRgba();
|
|
264
260
|
}
|
|
265
261
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
counts.buffer,
|
|
269
|
-
indexCounts.buffer,
|
|
270
|
-
indices.buffer,
|
|
271
|
-
batchIds.buffer,
|
|
272
|
-
batchTableColors.buffer,
|
|
273
|
-
packedBuffer.buffer,
|
|
274
|
-
];
|
|
275
|
-
const parameters = {
|
|
276
|
-
packedBuffer: packedBuffer.buffer,
|
|
277
|
-
positions: positions.buffer,
|
|
278
|
-
counts: counts.buffer,
|
|
279
|
-
indexCounts: indexCounts.buffer,
|
|
280
|
-
indices: indices.buffer,
|
|
281
|
-
batchIds: batchIds.buffer,
|
|
282
|
-
batchTableColors: batchTableColors.buffer,
|
|
283
|
-
};
|
|
284
|
-
|
|
285
|
-
let minimumHeights = polygons._polygonMinimumHeights;
|
|
286
|
-
let maximumHeights = polygons._polygonMaximumHeights;
|
|
287
|
-
if (defined(minimumHeights) && defined(maximumHeights)) {
|
|
288
|
-
minimumHeights = minimumHeights.slice();
|
|
289
|
-
maximumHeights = maximumHeights.slice();
|
|
290
|
-
|
|
291
|
-
transferrableObjects.push(minimumHeights.buffer, maximumHeights.buffer);
|
|
292
|
-
parameters.minimumHeights = minimumHeights;
|
|
293
|
-
parameters.maximumHeights = maximumHeights;
|
|
294
|
-
}
|
|
262
|
+
packedBuffer = polygons._packedBuffer = packBuffer(polygons);
|
|
263
|
+
}
|
|
295
264
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
265
|
+
const transferrableObjects = [
|
|
266
|
+
positions.buffer,
|
|
267
|
+
counts.buffer,
|
|
268
|
+
indexCounts.buffer,
|
|
269
|
+
indices.buffer,
|
|
270
|
+
batchIds.buffer,
|
|
271
|
+
batchTableColors.buffer,
|
|
272
|
+
packedBuffer.buffer,
|
|
273
|
+
];
|
|
274
|
+
const parameters = {
|
|
275
|
+
packedBuffer: packedBuffer.buffer,
|
|
276
|
+
positions: positions.buffer,
|
|
277
|
+
counts: counts.buffer,
|
|
278
|
+
indexCounts: indexCounts.buffer,
|
|
279
|
+
indices: indices.buffer,
|
|
280
|
+
batchIds: batchIds.buffer,
|
|
281
|
+
batchTableColors: batchTableColors.buffer,
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
let minimumHeights = polygons._polygonMinimumHeights;
|
|
285
|
+
let maximumHeights = polygons._polygonMaximumHeights;
|
|
286
|
+
if (defined(minimumHeights) && defined(maximumHeights)) {
|
|
287
|
+
minimumHeights = minimumHeights.slice();
|
|
288
|
+
maximumHeights = maximumHeights.slice();
|
|
289
|
+
|
|
290
|
+
transferrableObjects.push(minimumHeights.buffer, maximumHeights.buffer);
|
|
291
|
+
parameters.minimumHeights = minimumHeights;
|
|
292
|
+
parameters.maximumHeights = maximumHeights;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
const verticesPromise = createVerticesTaskProcessor.scheduleTask(
|
|
296
|
+
parameters,
|
|
297
|
+
transferrableObjects
|
|
298
|
+
);
|
|
299
|
+
if (!defined(verticesPromise)) {
|
|
300
|
+
// Postponed
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
return verticesPromise
|
|
305
|
+
.then((result) => {
|
|
306
|
+
if (polygons.isDestroyed()) {
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
304
309
|
|
|
305
|
-
return verticesPromise.then(function (result) {
|
|
306
310
|
polygons._positions = undefined;
|
|
307
311
|
polygons._counts = undefined;
|
|
308
312
|
polygons._polygonMinimumHeights = undefined;
|
|
@@ -323,13 +327,22 @@ function createPrimitive(polygons) {
|
|
|
323
327
|
polygons._batchedPositions = new Float32Array(result.positions);
|
|
324
328
|
polygons._vertexBatchIds = new Uint16Array(result.batchIds);
|
|
325
329
|
|
|
330
|
+
finishPrimitive(polygons);
|
|
331
|
+
|
|
326
332
|
polygons._ready = true;
|
|
333
|
+
})
|
|
334
|
+
.catch((error) => {
|
|
335
|
+
if (polygons.isDestroyed()) {
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// Throw the error next frame
|
|
340
|
+
polygons._error = error;
|
|
327
341
|
});
|
|
328
|
-
}
|
|
329
342
|
}
|
|
330
343
|
|
|
331
344
|
function finishPrimitive(polygons) {
|
|
332
|
-
if (
|
|
345
|
+
if (!defined(polygons._primitive)) {
|
|
333
346
|
polygons._primitive = new Vector3DTilePrimitive({
|
|
334
347
|
batchTable: polygons._batchTable,
|
|
335
348
|
positions: polygons._batchedPositions,
|
|
@@ -366,7 +379,6 @@ function finishPrimitive(polygons) {
|
|
|
366
379
|
polygons._boundingVolume = undefined;
|
|
367
380
|
polygons._boundingVolumes = undefined;
|
|
368
381
|
polygons._batchedIndices = undefined;
|
|
369
|
-
polygons._verticesPromise = undefined;
|
|
370
382
|
}
|
|
371
383
|
}
|
|
372
384
|
|
|
@@ -411,41 +423,30 @@ Vector3DTilePolygons.prototype.updateCommands = function (batchId, color) {
|
|
|
411
423
|
this._primitive.updateCommands(batchId, color);
|
|
412
424
|
};
|
|
413
425
|
|
|
414
|
-
function initialize(polygons) {
|
|
415
|
-
return new Promise(function (resolve, reject) {
|
|
416
|
-
polygons._update = function (polygons, frameState) {
|
|
417
|
-
const promise = createPrimitive(polygons);
|
|
418
|
-
|
|
419
|
-
if (polygons._ready) {
|
|
420
|
-
polygons._primitive.debugWireframe = polygons.debugWireframe;
|
|
421
|
-
polygons._primitive.forceRebatch = polygons.forceRebatch;
|
|
422
|
-
polygons._primitive.classificationType = polygons.classificationType;
|
|
423
|
-
polygons._primitive.update(frameState);
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
if (!defined(promise)) {
|
|
427
|
-
return;
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
promise
|
|
431
|
-
.then(function () {
|
|
432
|
-
finishPrimitive(polygons);
|
|
433
|
-
resolve(polygons);
|
|
434
|
-
})
|
|
435
|
-
.catch(function (e) {
|
|
436
|
-
reject(e);
|
|
437
|
-
});
|
|
438
|
-
};
|
|
439
|
-
});
|
|
440
|
-
}
|
|
441
|
-
|
|
442
426
|
/**
|
|
443
427
|
* Updates the batches and queues the commands for rendering.
|
|
444
428
|
*
|
|
445
429
|
* @param {FrameState} frameState The current frame state.
|
|
446
430
|
*/
|
|
447
431
|
Vector3DTilePolygons.prototype.update = function (frameState) {
|
|
448
|
-
this.
|
|
432
|
+
if (!this._ready) {
|
|
433
|
+
if (!defined(this._promise)) {
|
|
434
|
+
this._promise = createPrimitive(this);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
if (defined(this._error)) {
|
|
438
|
+
const error = this._error;
|
|
439
|
+
this._error = undefined;
|
|
440
|
+
throw error;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
this._primitive.debugWireframe = this.debugWireframe;
|
|
447
|
+
this._primitive.forceRebatch = this.forceRebatch;
|
|
448
|
+
this._primitive.classificationType = this.classificationType;
|
|
449
|
+
this._primitive.update(frameState);
|
|
449
450
|
};
|
|
450
451
|
|
|
451
452
|
/**
|