@cesium/engine 2.4.1 → 3.0.1
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/{BoxGeometry-af7d05ef.js → BoxGeometry-7aa4ce7f.js} +1 -1
- package/Build/Workers/{CylinderGeometry-dbaa1678.js → CylinderGeometry-8fc7c44b.js} +1 -1
- package/Build/Workers/{EllipseGeometry-6508b78b.js → EllipseGeometry-16b3736a.js} +1 -1
- package/Build/Workers/{EllipseOutlineGeometry-2a2510bb.js → EllipseOutlineGeometry-05d35d18.js} +1 -1
- package/Build/Workers/{EllipsoidGeometry-8155e3a2.js → EllipsoidGeometry-a503d1d6.js} +1 -1
- package/Build/Workers/{EllipsoidOutlineGeometry-c045678d.js → EllipsoidOutlineGeometry-7b09f24d.js} +1 -1
- package/Build/Workers/{FrustumGeometry-d3ff16d0.js → FrustumGeometry-87ce8622.js} +1 -1
- package/Build/Workers/{GeometryAttribute-13da9466.js → GeometryAttribute-8fcff0d5.js} +1 -1
- package/Build/Workers/{GeometryPipeline-03bc5709.js → GeometryPipeline-70d69a43.js} +1 -1
- package/Build/Workers/{PolygonGeometryLibrary-d447448d.js → PolygonGeometryLibrary-bad6329a.js} +1 -1
- package/Build/Workers/{PolygonPipeline-460cce4e.js → PolygonPipeline-dd13ee78.js} +1 -1
- package/Build/Workers/{PrimitivePipeline-e648752b.js → PrimitivePipeline-111ee29f.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/createVerticesFromQuantizedTerrainMesh.js +0 -22
- 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/Source/Core/ArcGISTiledElevationTerrainProvider.js +0 -75
- package/Source/Core/CesiumTerrainProvider.js +0 -75
- package/Source/Core/CustomHeightmapTerrainProvider.js +0 -38
- package/Source/Core/EllipsoidTerrainProvider.js +0 -37
- package/Source/Core/Geometry.js +1 -1
- package/Source/Core/GoogleEarthEnterpriseMetadata.js +0 -53
- package/Source/Core/GoogleEarthEnterpriseTerrainProvider.js +1 -101
- package/Source/Core/GoogleMaps.js +1 -1
- package/Source/Core/Ion.js +1 -2
- package/Source/Core/TerrainProvider.js +0 -22
- package/Source/Core/VRTheWorldTerrainProvider.js +0 -59
- package/Source/Core/sampleTerrain.js +0 -7
- package/Source/Core/sampleTerrainMostDetailed.js +0 -7
- package/Source/DataSources/Cesium3DTilesetVisualizer.js +6 -5
- package/Source/DataSources/KmlTour.js +1 -12
- package/Source/DataSources/ModelVisualizer.js +0 -12
- package/Source/Renderer/Context.js +10 -2
- package/Source/Scene/ArcGisMapServerImageryProvider.js +7 -335
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Billboard.js +7 -0
- package/Source/Scene/BingMapsImageryProvider.js +0 -326
- package/Source/Scene/{parseBoundingVolumeSemantics.js → BoundingVolumeSemantics.js} +71 -15
- package/Source/Scene/Camera.js +1 -1
- package/Source/Scene/Cesium3DTile.js +35 -18
- package/Source/Scene/Cesium3DTileContent.js +0 -16
- package/Source/Scene/Cesium3DTilesVoxelProvider.js +0 -123
- package/Source/Scene/Cesium3DTileset.js +183 -184
- package/Source/Scene/Cesium3DTilesetBaseTraversal.js +1 -1
- package/Source/Scene/Cesium3DTilesetCache.js +1 -3
- package/Source/Scene/Cesium3DTilesetSkipTraversal.js +5 -2
- package/Source/Scene/Cesium3DTilesetTraversal.js +2 -2
- package/Source/Scene/ClassificationPrimitive.js +5 -43
- package/Source/Scene/Composite3DTileContent.js +0 -27
- package/Source/Scene/CreditDisplay.js +0 -54
- package/Source/Scene/DerivedCommand.js +15 -10
- package/Source/Scene/Empty3DTileContent.js +0 -21
- package/Source/Scene/Geometry3DTileContent.js +0 -29
- package/Source/Scene/Globe.js +1 -9
- package/Source/Scene/GlobeSurfaceTile.js +13 -8
- package/Source/Scene/GlobeSurfaceTileProvider.js +8 -60
- package/Source/Scene/GltfPipeline/removeUnusedElements.js +27 -0
- package/Source/Scene/GltfPipeline/updateVersion.js +21 -4
- package/Source/Scene/GoogleEarthEnterpriseImageryProvider.js +1 -339
- package/Source/Scene/GoogleEarthEnterpriseMapsProvider.js +0 -326
- package/Source/Scene/GridImageryProvider.js +0 -274
- package/Source/Scene/GroundPolylinePrimitive.js +5 -38
- package/Source/Scene/GroundPrimitive.js +5 -43
- package/Source/Scene/I3SDataProvider.js +4 -99
- package/Source/Scene/I3SLayer.js +15 -22
- package/Source/Scene/Imagery.js +1 -9
- package/Source/Scene/ImageryLayer.js +1 -40
- package/Source/Scene/ImageryProvider.js +0 -138
- package/Source/Scene/Implicit3DTileContent.js +4 -25
- package/Source/Scene/IonImageryProvider.js +1 -369
- package/Source/Scene/MapboxImageryProvider.js +0 -276
- package/Source/Scene/MapboxStyleImageryProvider.js +0 -274
- package/Source/Scene/Model/CustomShaderPipelineStage.js +178 -164
- package/Source/Scene/Model/Model.js +9 -250
- package/Source/Scene/Model/Model3DTileContent.js +0 -50
- package/Source/Scene/Model/ModelAnimationCollection.js +1 -1
- package/Source/Scene/Model/PointCloudStylingPipelineStage.js +1 -1
- package/Source/Scene/Multiple3DTileContent.js +0 -27
- package/Source/Scene/Primitive.js +10 -38
- package/Source/Scene/QuadtreePrimitive.js +3 -5
- package/Source/Scene/QuadtreeTileProvider.js +0 -10
- package/Source/Scene/Scene.js +3 -3
- package/Source/Scene/ScreenSpaceCameraController.js +5 -5
- package/Source/Scene/SingleTileImageryProvider.js +6 -302
- package/Source/Scene/TileCoordinatesImageryProvider.js +0 -273
- package/Source/Scene/TileMapServiceImageryProvider.js +3 -48
- package/Source/Scene/Tileset3DTileContent.js +0 -22
- package/Source/Scene/TimeDynamicPointCloud.js +0 -28
- package/Source/Scene/UrlTemplateImageryProvider.js +0 -375
- package/Source/Scene/Vector3DTileContent.js +0 -29
- package/Source/Scene/VoxelPrimitive.js +9 -49
- package/Source/Scene/VoxelProvider.js +0 -24
- package/Source/Scene/WebMapServiceImageryProvider.js +0 -274
- package/Source/Scene/WebMapTileServiceImageryProvider.js +0 -274
- package/Source/Scene/computeFlyToLocationForRectangle.js +0 -6
- package/Source/Scene/createGooglePhotorealistic3DTileset.js +5 -0
- package/Source/Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates.glsl +1 -1
- package/Source/Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates.js +1 -1
- package/Source/Shaders/EllipsoidFS.glsl +1 -1
- package/Source/Shaders/EllipsoidFS.js +1 -1
- package/Source/Shaders/GlobeFS.glsl +1 -1
- package/Source/Shaders/GlobeFS.js +1 -1
- package/Source/Widget/CesiumWidget.js +2 -19
- package/index.d.ts +62 -1183
- package/index.js +63 -66
- package/package.json +2 -2
- package/Source/Core/createWorldTerrain.js +0 -61
- package/Source/Scene/createOsmBuildings.js +0 -82
- package/Source/Scene/createWorldImagery.js +0 -47
|
@@ -2,7 +2,6 @@ import Cartesian3 from "../Core/Cartesian3.js";
|
|
|
2
2
|
import Check from "../Core/Check.js";
|
|
3
3
|
import defaultValue from "../Core/defaultValue.js";
|
|
4
4
|
import defined from "../Core/defined.js";
|
|
5
|
-
import deprecationWarning from "../Core/deprecationWarning.js";
|
|
6
5
|
import Ellipsoid from "../Core/Ellipsoid.js";
|
|
7
6
|
import Matrix4 from "../Core/Matrix4.js";
|
|
8
7
|
import OrientedBoundingBox from "../Core/OrientedBoundingBox.js";
|
|
@@ -37,7 +36,6 @@ import VoxelShapeType from "./VoxelShapeType.js";
|
|
|
37
36
|
* @augments VoxelProvider
|
|
38
37
|
*
|
|
39
38
|
* @param {object} options Object with the following properties:
|
|
40
|
-
* @param {Resource|string|Promise<Resource>|Promise<string>} [options.url] The URL to a tileset JSON file. Deprecated.
|
|
41
39
|
*
|
|
42
40
|
* @see Cesium3DTilesVoxelProvider.fromUrl
|
|
43
41
|
* @see VoxelProvider
|
|
@@ -48,7 +46,6 @@ import VoxelShapeType from "./VoxelShapeType.js";
|
|
|
48
46
|
*/
|
|
49
47
|
function Cesium3DTilesVoxelProvider(options) {
|
|
50
48
|
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
51
|
-
this._ready = false;
|
|
52
49
|
|
|
53
50
|
/** @inheritdoc */
|
|
54
51
|
this.shapeTransform = undefined;
|
|
@@ -94,125 +91,8 @@ function Cesium3DTilesVoxelProvider(options) {
|
|
|
94
91
|
|
|
95
92
|
this._implicitTileset = undefined;
|
|
96
93
|
this._subtreeCache = new ImplicitSubtreeCache();
|
|
97
|
-
|
|
98
|
-
const that = this;
|
|
99
|
-
let tilesetJson;
|
|
100
|
-
|
|
101
|
-
if (defined(options.url)) {
|
|
102
|
-
deprecationWarning(
|
|
103
|
-
"Cesium3DTilesVoxelProvider options.url",
|
|
104
|
-
"Cesium3DTilesVoxelProvider constructor parameter options.url was deprecated in CesiumJS 1.104. It will be removed in 1.107. Use Cesium3DTilesVoxelProvider.fromUrl instead."
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
this._readyPromise = Promise.resolve(options.url).then(function (url) {
|
|
108
|
-
const resource = Resource.createIfNeeded(url);
|
|
109
|
-
return resource
|
|
110
|
-
.fetchJson()
|
|
111
|
-
.then(function (tileset) {
|
|
112
|
-
tilesetJson = tileset;
|
|
113
|
-
validate(tilesetJson);
|
|
114
|
-
const schemaLoader = getMetadataSchemaLoader(tilesetJson, resource);
|
|
115
|
-
return schemaLoader.load();
|
|
116
|
-
})
|
|
117
|
-
.then(function (schemaLoader) {
|
|
118
|
-
const root = tilesetJson.root;
|
|
119
|
-
const voxel = root.content.extensions["3DTILES_content_voxels"];
|
|
120
|
-
const className = voxel.class;
|
|
121
|
-
|
|
122
|
-
const metadataJson = hasExtension(tilesetJson, "3DTILES_metadata")
|
|
123
|
-
? tilesetJson.extensions["3DTILES_metadata"]
|
|
124
|
-
: tilesetJson;
|
|
125
|
-
|
|
126
|
-
const metadataSchema = schemaLoader.schema;
|
|
127
|
-
const metadata = new Cesium3DTilesetMetadata({
|
|
128
|
-
metadataJson: metadataJson,
|
|
129
|
-
schema: metadataSchema,
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
addAttributeInfo(that, metadata, className);
|
|
133
|
-
|
|
134
|
-
const implicitTileset = new ImplicitTileset(
|
|
135
|
-
resource,
|
|
136
|
-
root,
|
|
137
|
-
metadataSchema
|
|
138
|
-
);
|
|
139
|
-
|
|
140
|
-
const {
|
|
141
|
-
shape,
|
|
142
|
-
minBounds,
|
|
143
|
-
maxBounds,
|
|
144
|
-
shapeTransform,
|
|
145
|
-
globalTransform,
|
|
146
|
-
} = getShape(root);
|
|
147
|
-
|
|
148
|
-
that.shape = shape;
|
|
149
|
-
that.minBounds = minBounds;
|
|
150
|
-
that.maxBounds = maxBounds;
|
|
151
|
-
that.dimensions = Cartesian3.unpack(voxel.dimensions);
|
|
152
|
-
that.shapeTransform = shapeTransform;
|
|
153
|
-
that.globalTransform = globalTransform;
|
|
154
|
-
that.maximumTileCount = getTileCount(metadata);
|
|
155
|
-
|
|
156
|
-
let paddingBefore;
|
|
157
|
-
let paddingAfter;
|
|
158
|
-
|
|
159
|
-
if (defined(voxel.padding)) {
|
|
160
|
-
paddingBefore = Cartesian3.unpack(voxel.padding.before);
|
|
161
|
-
paddingAfter = Cartesian3.unpack(voxel.padding.after);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
that.paddingBefore = paddingBefore;
|
|
165
|
-
that.paddingAfter = paddingAfter;
|
|
166
|
-
|
|
167
|
-
that._implicitTileset = implicitTileset;
|
|
168
|
-
|
|
169
|
-
ResourceCache.unload(schemaLoader);
|
|
170
|
-
|
|
171
|
-
that._ready = true;
|
|
172
|
-
return that;
|
|
173
|
-
});
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
94
|
}
|
|
177
95
|
|
|
178
|
-
Object.defineProperties(Cesium3DTilesVoxelProvider.prototype, {
|
|
179
|
-
/**
|
|
180
|
-
* Gets the promise that will be resolved when the provider is ready for use.
|
|
181
|
-
*
|
|
182
|
-
* @memberof Cesium3DTilesVoxelProvider.prototype
|
|
183
|
-
* @type {Promise<Cesium3DTilesVoxelProvider>}
|
|
184
|
-
* @readonly
|
|
185
|
-
* @deprecated
|
|
186
|
-
*/
|
|
187
|
-
readyPromise: {
|
|
188
|
-
get: function () {
|
|
189
|
-
deprecationWarning(
|
|
190
|
-
"Cesium3DTilesVoxelProvider.readyPromise",
|
|
191
|
-
"Cesium3DTilesVoxelProvider.readyPromise was deprecated in CesiumJS 1.104. It will be removed in 1.107. Use Cesium3DTilesVoxelProvider.fromUrl instead."
|
|
192
|
-
);
|
|
193
|
-
return this._readyPromise;
|
|
194
|
-
},
|
|
195
|
-
},
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Gets a value indicating whether or not the provider is ready for use.
|
|
199
|
-
*
|
|
200
|
-
* @memberof Cesium3DTilesVoxelProvider.prototype
|
|
201
|
-
* @type {boolean}
|
|
202
|
-
* @readonly
|
|
203
|
-
* @deprecated
|
|
204
|
-
*/
|
|
205
|
-
ready: {
|
|
206
|
-
get: function () {
|
|
207
|
-
deprecationWarning(
|
|
208
|
-
"Cesium3DTilesVoxelProvider.ready",
|
|
209
|
-
"Cesium3DTilesVoxelProvider.ready was deprecated in CesiumJS 1.104. It will be removed in 1.107. Use Cesium3DTilesVoxelProvider.fromUrl instead."
|
|
210
|
-
);
|
|
211
|
-
return this._ready;
|
|
212
|
-
},
|
|
213
|
-
},
|
|
214
|
-
});
|
|
215
|
-
|
|
216
96
|
/**
|
|
217
97
|
* Creates a {@link VoxelProvider} that fetches voxel data from a 3D Tiles tileset.
|
|
218
98
|
*
|
|
@@ -289,9 +169,6 @@ Cesium3DTilesVoxelProvider.fromUrl = async function (url) {
|
|
|
289
169
|
|
|
290
170
|
ResourceCache.unload(schemaLoader);
|
|
291
171
|
|
|
292
|
-
provider._ready = true;
|
|
293
|
-
provider._readyPromise = Promise.resolve(provider);
|
|
294
|
-
|
|
295
172
|
return provider;
|
|
296
173
|
};
|
|
297
174
|
|
|
@@ -61,14 +61,15 @@ import Cesium3DTilesetSkipTraversal from "./Cesium3DTilesetSkipTraversal.js";
|
|
|
61
61
|
*
|
|
62
62
|
* Initialization options for the Cesium3DTileset constructor
|
|
63
63
|
*
|
|
64
|
-
* @property {Resource|string|Promise<Resource>|Promise<string>} [.url] The url to a tileset JSON file. Deprecated.
|
|
65
64
|
* @property {boolean} [show=true] Determines if the tileset will be shown.
|
|
66
65
|
* @property {Matrix4} [modelMatrix=Matrix4.IDENTITY] A 4x4 transformation matrix that transforms the tileset's root tile.
|
|
67
66
|
* @property {Axis} [modelUpAxis=Axis.Y] Which axis is considered up when loading models for tile contents.
|
|
68
67
|
* @property {Axis} [modelForwardAxis=Axis.X] Which axis is considered forward when loading models for tile contents.
|
|
69
68
|
* @property {ShadowMode} [shadows=ShadowMode.ENABLED] Determines whether the tileset casts or receives shadows from light sources.
|
|
70
69
|
* @property {number} [maximumScreenSpaceError=16] The maximum screen space error used to drive level of detail refinement.
|
|
71
|
-
* @property {number} [maximumMemoryUsage=512] The maximum amount of memory in MB that can be used by the tileset.
|
|
70
|
+
* @property {number} [maximumMemoryUsage=512] The maximum amount of memory in MB that can be used by the tileset. Deprecated.
|
|
71
|
+
* @property {number} [cacheBytes=536870912] The size (in bytes) to which the tile cache will be trimmed, if the cache contains tiles not needed for the current view.
|
|
72
|
+
* @property {number} [maximumCacheOverflowBytes=536870912] The maximum additional memory (in bytes) to allow for cache headroom, if more than {@link Cesium3DTileset#cacheBytes} are needed for the current view.
|
|
72
73
|
* @property {boolean} [cullWithChildrenBounds=true] Optimization option. Whether to cull tiles using the union of their children bounding volumes.
|
|
73
74
|
* @property {boolean} [cullRequestsWhileMoving=true] Optimization option. Don't request tiles that will likely be unused when they come back because of the camera's movement. This optimization only applies to stationary tilesets.
|
|
74
75
|
* @property {number} [cullRequestsWhileMovingMultiplier=60.0] Optimization option. Multiplier used in culling requests while moving. Larger is more aggressive culling, smaller less aggressive culling.
|
|
@@ -221,7 +222,33 @@ function Cesium3DTileset(options) {
|
|
|
221
222
|
options.maximumScreenSpaceError,
|
|
222
223
|
16
|
|
223
224
|
);
|
|
224
|
-
this.
|
|
225
|
+
this._memoryAdjustedScreenSpaceError = this._maximumScreenSpaceError;
|
|
226
|
+
|
|
227
|
+
let defaultCacheBytes = 512 * 1024 * 1024;
|
|
228
|
+
if (defined(options.maximumMemoryUsage)) {
|
|
229
|
+
deprecationWarning(
|
|
230
|
+
"Cesium3DTileset.maximumMemoryUsage",
|
|
231
|
+
"Cesium3DTileset.maximumMemoryUsage was deprecated in CesiumJS 1.107. It will be removed in CesiumJS 1.110. Use Cesium3DTileset.cacheBytes instead."
|
|
232
|
+
);
|
|
233
|
+
defaultCacheBytes = options.maximumMemoryUsage * 1024 * 1024;
|
|
234
|
+
}
|
|
235
|
+
this._cacheBytes = defaultValue(options.cacheBytes, defaultCacheBytes);
|
|
236
|
+
//>>includeStart('debug', pragmas.debug);
|
|
237
|
+
Check.typeOf.number.greaterThanOrEquals("cacheBytes", this._cacheBytes, 0);
|
|
238
|
+
//>>includeEnd('debug');
|
|
239
|
+
|
|
240
|
+
const maximumCacheOverflowBytes = defaultValue(
|
|
241
|
+
options.maximumCacheOverflowBytes,
|
|
242
|
+
512 * 1024 * 1024
|
|
243
|
+
);
|
|
244
|
+
//>>includeStart('debug', pragmas.debug);
|
|
245
|
+
Check.typeOf.number.greaterThanOrEquals(
|
|
246
|
+
"maximumCacheOverflowBytes",
|
|
247
|
+
maximumCacheOverflowBytes,
|
|
248
|
+
0
|
|
249
|
+
);
|
|
250
|
+
//>>includeEnd('debug');
|
|
251
|
+
this._maximumCacheOverflowBytes = maximumCacheOverflowBytes;
|
|
225
252
|
|
|
226
253
|
this._styleEngine = new Cesium3DTileStyleEngine();
|
|
227
254
|
this._styleApplied = false;
|
|
@@ -590,7 +617,7 @@ function Cesium3DTileset(options) {
|
|
|
590
617
|
* console.log('A tile was unloaded from the cache.');
|
|
591
618
|
* });
|
|
592
619
|
*
|
|
593
|
-
* @see Cesium3DTileset#
|
|
620
|
+
* @see Cesium3DTileset#cacheBytes
|
|
594
621
|
* @see Cesium3DTileset#trimLoadedTiles
|
|
595
622
|
*/
|
|
596
623
|
this.tileUnload = new Event();
|
|
@@ -990,124 +1017,6 @@ function Cesium3DTileset(options) {
|
|
|
990
1017
|
instanceFeatureIdLabel = `instanceFeatureId_${instanceFeatureIdLabel}`;
|
|
991
1018
|
}
|
|
992
1019
|
this._instanceFeatureIdLabel = instanceFeatureIdLabel;
|
|
993
|
-
|
|
994
|
-
if (defined(options.url)) {
|
|
995
|
-
deprecationWarning(
|
|
996
|
-
"Cesium3DTileset options.url",
|
|
997
|
-
"Cesium3DTileset constructor parameter options.url was deprecated in CesiumJS 1.104. It will be removed in 1.107. Use Cesium3DTileset.fromUrl instead."
|
|
998
|
-
);
|
|
999
|
-
const that = this;
|
|
1000
|
-
let resource;
|
|
1001
|
-
this._readyPromise = Promise.resolve(options.url)
|
|
1002
|
-
.then(function (url) {
|
|
1003
|
-
let basePath;
|
|
1004
|
-
resource = Resource.createIfNeeded(url);
|
|
1005
|
-
that._resource = resource;
|
|
1006
|
-
|
|
1007
|
-
// ion resources have a credits property we can use for additional attribution.
|
|
1008
|
-
that._credits = resource.credits;
|
|
1009
|
-
|
|
1010
|
-
if (resource.extension === "json") {
|
|
1011
|
-
basePath = resource.getBaseUri(true);
|
|
1012
|
-
} else if (resource.isDataUri) {
|
|
1013
|
-
basePath = "";
|
|
1014
|
-
}
|
|
1015
|
-
|
|
1016
|
-
that._url = resource.url;
|
|
1017
|
-
that._basePath = basePath;
|
|
1018
|
-
|
|
1019
|
-
return Cesium3DTileset.loadJson(resource);
|
|
1020
|
-
})
|
|
1021
|
-
.then(function (tilesetJson) {
|
|
1022
|
-
if (that.isDestroyed()) {
|
|
1023
|
-
return;
|
|
1024
|
-
}
|
|
1025
|
-
|
|
1026
|
-
// This needs to be called before loadTileset() so tile metadata
|
|
1027
|
-
// can be initialized synchronously in the Cesium3DTile constructor
|
|
1028
|
-
return processMetadataExtension(resource, tilesetJson).then(
|
|
1029
|
-
(metadata) => {
|
|
1030
|
-
that._metadataExtension = metadata;
|
|
1031
|
-
return tilesetJson;
|
|
1032
|
-
}
|
|
1033
|
-
);
|
|
1034
|
-
})
|
|
1035
|
-
.then(function (tilesetJson) {
|
|
1036
|
-
if (that.isDestroyed()) {
|
|
1037
|
-
return;
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1040
|
-
// Set these before loading the tileset since _geometricError
|
|
1041
|
-
// and _scaledGeometricError get accessed during tile creation
|
|
1042
|
-
that._geometricError = tilesetJson.geometricError;
|
|
1043
|
-
that._scaledGeometricError = tilesetJson.geometricError;
|
|
1044
|
-
|
|
1045
|
-
that._root = that.loadTileset(resource, tilesetJson);
|
|
1046
|
-
|
|
1047
|
-
// Handle legacy gltfUpAxis option
|
|
1048
|
-
const gltfUpAxis = defined(tilesetJson.asset.gltfUpAxis)
|
|
1049
|
-
? Axis.fromName(tilesetJson.asset.gltfUpAxis)
|
|
1050
|
-
: Axis.Y;
|
|
1051
|
-
const modelUpAxis = defaultValue(options.modelUpAxis, gltfUpAxis);
|
|
1052
|
-
const modelForwardAxis = defaultValue(options.modelForwardAxis, Axis.X);
|
|
1053
|
-
|
|
1054
|
-
const asset = tilesetJson.asset;
|
|
1055
|
-
that._asset = asset;
|
|
1056
|
-
that._properties = tilesetJson.properties;
|
|
1057
|
-
that._extensionsUsed = tilesetJson.extensionsUsed;
|
|
1058
|
-
that._extensions = tilesetJson.extensions;
|
|
1059
|
-
that._modelUpAxis = modelUpAxis;
|
|
1060
|
-
that._modelForwardAxis = modelForwardAxis;
|
|
1061
|
-
that._extras = tilesetJson.extras;
|
|
1062
|
-
|
|
1063
|
-
const extras = asset.extras;
|
|
1064
|
-
if (
|
|
1065
|
-
defined(extras) &&
|
|
1066
|
-
defined(extras.cesium) &&
|
|
1067
|
-
defined(extras.cesium.credits)
|
|
1068
|
-
) {
|
|
1069
|
-
const extraCredits = extras.cesium.credits;
|
|
1070
|
-
let credits = that._credits;
|
|
1071
|
-
if (!defined(credits)) {
|
|
1072
|
-
credits = [];
|
|
1073
|
-
that._credits = credits;
|
|
1074
|
-
}
|
|
1075
|
-
for (let i = 0; i < extraCredits.length; ++i) {
|
|
1076
|
-
const credit = extraCredits[i];
|
|
1077
|
-
credits.push(new Credit(credit.html, that._showCreditsOnScreen));
|
|
1078
|
-
}
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
|
-
// Save the original, untransformed bounding volume position so we can apply
|
|
1082
|
-
// the tile transform and model matrix at run time
|
|
1083
|
-
const boundingVolume = that._root.createBoundingVolume(
|
|
1084
|
-
tilesetJson.root.boundingVolume,
|
|
1085
|
-
Matrix4.IDENTITY
|
|
1086
|
-
);
|
|
1087
|
-
const clippingPlanesOrigin = boundingVolume.boundingSphere.center;
|
|
1088
|
-
// If this origin is above the surface of the earth
|
|
1089
|
-
// we want to apply an ENU orientation as our best guess of orientation.
|
|
1090
|
-
// Otherwise, we assume it gets its position/orientation completely from the
|
|
1091
|
-
// root tile transform and the tileset's model matrix
|
|
1092
|
-
const originCartographic = that._ellipsoid.cartesianToCartographic(
|
|
1093
|
-
clippingPlanesOrigin
|
|
1094
|
-
);
|
|
1095
|
-
if (
|
|
1096
|
-
defined(originCartographic) &&
|
|
1097
|
-
originCartographic.height >
|
|
1098
|
-
ApproximateTerrainHeights._defaultMinTerrainHeight
|
|
1099
|
-
) {
|
|
1100
|
-
that._initialClippingPlanesOriginMatrix = Transforms.eastNorthUpToFixedFrame(
|
|
1101
|
-
clippingPlanesOrigin
|
|
1102
|
-
);
|
|
1103
|
-
}
|
|
1104
|
-
that._clippingPlanesOriginMatrix = Matrix4.clone(
|
|
1105
|
-
that._initialClippingPlanesOriginMatrix
|
|
1106
|
-
);
|
|
1107
|
-
|
|
1108
|
-
return that;
|
|
1109
|
-
});
|
|
1110
|
-
}
|
|
1111
1020
|
}
|
|
1112
1021
|
|
|
1113
1022
|
Object.defineProperties(Cesium3DTileset.prototype, {
|
|
@@ -1196,59 +1105,6 @@ Object.defineProperties(Cesium3DTileset.prototype, {
|
|
|
1196
1105
|
},
|
|
1197
1106
|
},
|
|
1198
1107
|
|
|
1199
|
-
/**
|
|
1200
|
-
* When <code>true</code>, the tileset's root tile is loaded and the tileset is ready to render.
|
|
1201
|
-
*
|
|
1202
|
-
* @memberof Cesium3DTileset.prototype
|
|
1203
|
-
*
|
|
1204
|
-
* @type {boolean}
|
|
1205
|
-
* @readonly
|
|
1206
|
-
*
|
|
1207
|
-
* @default false
|
|
1208
|
-
*/
|
|
1209
|
-
ready: {
|
|
1210
|
-
get: function () {
|
|
1211
|
-
deprecationWarning(
|
|
1212
|
-
"Cesium3DTileset.ready",
|
|
1213
|
-
"Cesium3DTileset.ready was deprecated in CesiumJS 1.104. It will be removed in 1.107. Use Cesium3DTileset.fromUrl instead."
|
|
1214
|
-
);
|
|
1215
|
-
return defined(this._root);
|
|
1216
|
-
},
|
|
1217
|
-
},
|
|
1218
|
-
|
|
1219
|
-
/**
|
|
1220
|
-
* Gets the promise that will be resolved when the tileset's root tile is loaded and the tileset is ready to render.
|
|
1221
|
-
* <p>
|
|
1222
|
-
* This promise is resolved at the end of the frame before the first frame the tileset is rendered in.
|
|
1223
|
-
* </p>
|
|
1224
|
-
*
|
|
1225
|
-
* @memberof Cesium3DTileset.prototype
|
|
1226
|
-
*
|
|
1227
|
-
* @type {Promise<Cesium3DTileset>}
|
|
1228
|
-
* @readonly
|
|
1229
|
-
* @deprecated
|
|
1230
|
-
*
|
|
1231
|
-
* @example
|
|
1232
|
-
* tileset.readyPromise.then(function(tileset) {
|
|
1233
|
-
* // tile.properties is not defined until readyPromise resolves.
|
|
1234
|
-
* const properties = tileset.properties;
|
|
1235
|
-
* if (Cesium.defined(properties)) {
|
|
1236
|
-
* for (const name in properties) {
|
|
1237
|
-
* console.log(properties[name]);
|
|
1238
|
-
* }
|
|
1239
|
-
* }
|
|
1240
|
-
* });
|
|
1241
|
-
*/
|
|
1242
|
-
readyPromise: {
|
|
1243
|
-
get: function () {
|
|
1244
|
-
deprecationWarning(
|
|
1245
|
-
"Cesium3DTileset.readyPromise",
|
|
1246
|
-
"Cesium3DTileset.readyPromise was deprecated in CesiumJS 1.104. It will be removed in 1.107. Use Cesium3DTileset.fromUrl instead."
|
|
1247
|
-
);
|
|
1248
|
-
return this._readyPromise;
|
|
1249
|
-
},
|
|
1250
|
-
},
|
|
1251
|
-
|
|
1252
1108
|
/**
|
|
1253
1109
|
* When <code>true</code>, all tiles that meet the screen space error this frame are loaded. The tileset is
|
|
1254
1110
|
* completely loaded for this view.
|
|
@@ -1516,6 +1372,7 @@ Object.defineProperties(Cesium3DTileset.prototype, {
|
|
|
1516
1372
|
//>>includeEnd('debug');
|
|
1517
1373
|
|
|
1518
1374
|
this._maximumScreenSpaceError = value;
|
|
1375
|
+
this._memoryAdjustedScreenSpaceError = value;
|
|
1519
1376
|
},
|
|
1520
1377
|
},
|
|
1521
1378
|
|
|
@@ -1545,17 +1402,122 @@ Object.defineProperties(Cesium3DTileset.prototype, {
|
|
|
1545
1402
|
*
|
|
1546
1403
|
* @exception {DeveloperError} <code>maximumMemoryUsage</code> must be greater than or equal to zero.
|
|
1547
1404
|
* @see Cesium3DTileset#totalMemoryUsageInBytes
|
|
1405
|
+
*
|
|
1406
|
+
* @deprecated
|
|
1548
1407
|
*/
|
|
1549
1408
|
maximumMemoryUsage: {
|
|
1550
1409
|
get: function () {
|
|
1410
|
+
deprecationWarning(
|
|
1411
|
+
"Cesium3DTileset.maximumMemoryUsage",
|
|
1412
|
+
"Cesium3DTileset.maximumMemoryUsage was deprecated in CesiumJS 1.107. It will be removed in CesiumJS 1.110. Use Cesium3DTileset.cacheBytes instead."
|
|
1413
|
+
);
|
|
1551
1414
|
return this._maximumMemoryUsage;
|
|
1552
1415
|
},
|
|
1553
1416
|
set: function (value) {
|
|
1417
|
+
deprecationWarning(
|
|
1418
|
+
"Cesium3DTileset.maximumMemoryUsage",
|
|
1419
|
+
"Cesium3DTileset.maximumMemoryUsage was deprecated in CesiumJS 1.107. It will be removed in CesiumJS 1.110. Use Cesium3DTileset.cacheBytes instead."
|
|
1420
|
+
);
|
|
1554
1421
|
//>>includeStart('debug', pragmas.debug);
|
|
1555
1422
|
Check.typeOf.number.greaterThanOrEquals("value", value, 0);
|
|
1556
1423
|
//>>includeEnd('debug');
|
|
1557
1424
|
|
|
1558
1425
|
this._maximumMemoryUsage = value;
|
|
1426
|
+
this._cacheBytes = value * 1024 * 1024;
|
|
1427
|
+
},
|
|
1428
|
+
},
|
|
1429
|
+
|
|
1430
|
+
/**
|
|
1431
|
+
* The amount of GPU memory (in bytes) used to cache tiles. This memory usage is estimated from
|
|
1432
|
+
* geometry, textures, and batch table textures of loaded tiles. For point clouds, this value also
|
|
1433
|
+
* includes per-point metadata.
|
|
1434
|
+
* <p>
|
|
1435
|
+
* Tiles not in view are unloaded to enforce this.
|
|
1436
|
+
* </p>
|
|
1437
|
+
* <p>
|
|
1438
|
+
* If decreasing this value results in unloading tiles, the tiles are unloaded the next frame.
|
|
1439
|
+
* </p>
|
|
1440
|
+
* <p>
|
|
1441
|
+
* If tiles sized more than <code>cacheBytes</code> are needed to meet the
|
|
1442
|
+
* desired screen space error, determined by {@link Cesium3DTileset#maximumScreenSpaceError},
|
|
1443
|
+
* for the current view, then the memory usage of the tiles loaded will exceed
|
|
1444
|
+
* <code>cacheBytes</code> by up to <code>maximumCacheOverflowBytes</code>.
|
|
1445
|
+
* For example, if <code>cacheBytes</code> is 500000, but 600000 bytes
|
|
1446
|
+
* of tiles are needed to meet the screen space error, then 600000 bytes of tiles
|
|
1447
|
+
* may be loaded (if <code>maximumCacheOverflowBytes</code> is at least 100000).
|
|
1448
|
+
* When these tiles go out of view, they will be unloaded.
|
|
1449
|
+
* </p>
|
|
1450
|
+
*
|
|
1451
|
+
* @memberof Cesium3DTileset.prototype
|
|
1452
|
+
*
|
|
1453
|
+
* @type {number}
|
|
1454
|
+
* @default 536870912
|
|
1455
|
+
*
|
|
1456
|
+
* @exception {DeveloperError} <code>cacheBytes</code> must be typeof 'number' and greater than or equal to 0
|
|
1457
|
+
* @see Cesium3DTileset#totalMemoryUsageInBytes
|
|
1458
|
+
*/
|
|
1459
|
+
cacheBytes: {
|
|
1460
|
+
get: function () {
|
|
1461
|
+
return this._cacheBytes;
|
|
1462
|
+
},
|
|
1463
|
+
set: function (value) {
|
|
1464
|
+
//>>includeStart('debug', pragmas.debug);
|
|
1465
|
+
Check.typeOf.number.greaterThanOrEquals("value", value, 0);
|
|
1466
|
+
//>>includeEnd('debug');
|
|
1467
|
+
|
|
1468
|
+
this._cacheBytes = value;
|
|
1469
|
+
},
|
|
1470
|
+
},
|
|
1471
|
+
|
|
1472
|
+
/**
|
|
1473
|
+
* The maximum additional amount of GPU memory (in bytes) that will be used to cache tiles.
|
|
1474
|
+
* <p>
|
|
1475
|
+
* If tiles sized more than <code>cacheBytes</code> plus <code>maximumCacheOverflowBytes</code>
|
|
1476
|
+
* are needed to meet the desired screen space error, determined by
|
|
1477
|
+
* {@link Cesium3DTileset#maximumScreenSpaceError} for the current view, then
|
|
1478
|
+
* {@link Cesium3DTileset#memoryAdjustedScreenSpaceError} will be adjusted
|
|
1479
|
+
* until the tiles required to meet the adjusted screen space error use less
|
|
1480
|
+
* than <code>cacheBytes</code> plus <code>maximumCacheOverflowBytes</code>.
|
|
1481
|
+
* </p>
|
|
1482
|
+
*
|
|
1483
|
+
* @memberof Cesium3DTileset.prototype
|
|
1484
|
+
*
|
|
1485
|
+
* @type {number}
|
|
1486
|
+
* @default 536870912
|
|
1487
|
+
*
|
|
1488
|
+
* @exception {DeveloperError} <code>maximumCacheOverflowBytes</code> must be typeof 'number' and greater than or equal to 0
|
|
1489
|
+
* @see Cesium3DTileset#totalMemoryUsageInBytes
|
|
1490
|
+
*/
|
|
1491
|
+
maximumCacheOverflowBytes: {
|
|
1492
|
+
get: function () {
|
|
1493
|
+
return this._maximumCacheOverflowBytes;
|
|
1494
|
+
},
|
|
1495
|
+
set: function (value) {
|
|
1496
|
+
//>>includeStart('debug', pragmas.debug);
|
|
1497
|
+
Check.typeOf.number.greaterThanOrEquals("value", value, 0);
|
|
1498
|
+
//>>includeEnd('debug');
|
|
1499
|
+
|
|
1500
|
+
this._maximumCacheOverflowBytes = value;
|
|
1501
|
+
},
|
|
1502
|
+
},
|
|
1503
|
+
|
|
1504
|
+
/**
|
|
1505
|
+
* If loading the level of detail required by @{link Cesium3DTileset#maximumScreenSpaceError}
|
|
1506
|
+
* results in the memory usage exceeding @{link Cesium3DTileset#cacheBytes}
|
|
1507
|
+
* plus @{link Cesium3DTileset#maximumCacheOverflowBytes}, level of detail refinement
|
|
1508
|
+
* will instead use this (larger) adjusted screen space error to achieve the
|
|
1509
|
+
* best possible visual quality within the available memory
|
|
1510
|
+
*
|
|
1511
|
+
* @memberof Cesium3DTileset.prototype
|
|
1512
|
+
*
|
|
1513
|
+
* @type {number}
|
|
1514
|
+
* @readonly
|
|
1515
|
+
*
|
|
1516
|
+
* @private
|
|
1517
|
+
*/
|
|
1518
|
+
memoryAdjustedScreenSpaceError: {
|
|
1519
|
+
get: function () {
|
|
1520
|
+
return this._memoryAdjustedScreenSpaceError;
|
|
1559
1521
|
},
|
|
1560
1522
|
},
|
|
1561
1523
|
|
|
@@ -1665,7 +1627,7 @@ Object.defineProperties(Cesium3DTileset.prototype, {
|
|
|
1665
1627
|
* @type {number}
|
|
1666
1628
|
* @readonly
|
|
1667
1629
|
*
|
|
1668
|
-
* @see Cesium3DTileset#
|
|
1630
|
+
* @see Cesium3DTileset#cacheBytes
|
|
1669
1631
|
*/
|
|
1670
1632
|
totalMemoryUsageInBytes: {
|
|
1671
1633
|
get: function () {
|
|
@@ -2167,8 +2129,6 @@ Cesium3DTileset.fromUrl = async function (url, options) {
|
|
|
2167
2129
|
tileset._initialClippingPlanesOriginMatrix
|
|
2168
2130
|
);
|
|
2169
2131
|
|
|
2170
|
-
tileset._readyPromise = Promise.resolve(tileset);
|
|
2171
|
-
tileset._ready = true;
|
|
2172
2132
|
return tileset;
|
|
2173
2133
|
};
|
|
2174
2134
|
|
|
@@ -2524,7 +2484,7 @@ function requestContent(tileset, tile) {
|
|
|
2524
2484
|
tileset._requestedTilesInFlight.push(tile);
|
|
2525
2485
|
}
|
|
2526
2486
|
|
|
2527
|
-
function
|
|
2487
|
+
function sortTilesByPriority(a, b) {
|
|
2528
2488
|
return a._priority - b._priority;
|
|
2529
2489
|
}
|
|
2530
2490
|
|
|
@@ -2627,7 +2587,7 @@ function cancelOutOfViewRequests(tileset, frameState) {
|
|
|
2627
2587
|
*/
|
|
2628
2588
|
function requestTiles(tileset) {
|
|
2629
2589
|
const requestedTiles = tileset._requestedTiles;
|
|
2630
|
-
requestedTiles.sort(
|
|
2590
|
+
requestedTiles.sort(sortTilesByPriority);
|
|
2631
2591
|
for (let i = 0; i < requestedTiles.length; ++i) {
|
|
2632
2592
|
requestContent(tileset, requestedTiles[i]);
|
|
2633
2593
|
}
|
|
@@ -2694,10 +2654,18 @@ function filterProcessingQueue(tileset) {
|
|
|
2694
2654
|
function processTiles(tileset, frameState) {
|
|
2695
2655
|
filterProcessingQueue(tileset);
|
|
2696
2656
|
const tiles = tileset._processingQueue;
|
|
2697
|
-
|
|
2698
|
-
|
|
2657
|
+
|
|
2658
|
+
const { cacheBytes, maximumCacheOverflowBytes, statistics } = tileset;
|
|
2659
|
+
const cacheByteLimit = cacheBytes + maximumCacheOverflowBytes;
|
|
2660
|
+
|
|
2661
|
+
let memoryExceeded = false;
|
|
2699
2662
|
for (let i = 0; i < tiles.length; ++i) {
|
|
2700
|
-
|
|
2663
|
+
if (tileset.totalMemoryUsageInBytes > cacheByteLimit) {
|
|
2664
|
+
memoryExceeded = true;
|
|
2665
|
+
break;
|
|
2666
|
+
}
|
|
2667
|
+
|
|
2668
|
+
const tile = tiles[i];
|
|
2701
2669
|
try {
|
|
2702
2670
|
tile.process(tileset, frameState);
|
|
2703
2671
|
|
|
@@ -2710,6 +2678,37 @@ function processTiles(tileset, frameState) {
|
|
|
2710
2678
|
handleTileFailure(error, tileset, tile);
|
|
2711
2679
|
}
|
|
2712
2680
|
}
|
|
2681
|
+
|
|
2682
|
+
if (tileset.totalMemoryUsageInBytes < cacheBytes) {
|
|
2683
|
+
decreaseScreenSpaceError(tileset);
|
|
2684
|
+
} else if (memoryExceeded && tiles.length > 0) {
|
|
2685
|
+
increaseScreenSpaceError(tileset);
|
|
2686
|
+
}
|
|
2687
|
+
}
|
|
2688
|
+
|
|
2689
|
+
function increaseScreenSpaceError(tileset) {
|
|
2690
|
+
//>>includeStart('debug', pragmas.debug);
|
|
2691
|
+
oneTimeWarning(
|
|
2692
|
+
"increase-screenSpaceError",
|
|
2693
|
+
`The tiles needed to meet maximumScreenSpaceError would use more memory than allocated for this tileset.
|
|
2694
|
+
The tileset will be rendered with a larger screen space error (see memoryAdjustedScreenSpaceError).
|
|
2695
|
+
Consider using larger values for cacheBytes and maximumCacheOverflowBytes.`
|
|
2696
|
+
);
|
|
2697
|
+
//>>includeEnd('debug');
|
|
2698
|
+
|
|
2699
|
+
tileset._memoryAdjustedScreenSpaceError *= 1.02;
|
|
2700
|
+
const tiles = tileset._processingQueue;
|
|
2701
|
+
for (let i = 0; i < tiles.length; ++i) {
|
|
2702
|
+
tiles[i].updatePriority();
|
|
2703
|
+
}
|
|
2704
|
+
tiles.sort(sortTilesByPriority);
|
|
2705
|
+
}
|
|
2706
|
+
|
|
2707
|
+
function decreaseScreenSpaceError(tileset) {
|
|
2708
|
+
tileset._memoryAdjustedScreenSpaceError = Math.max(
|
|
2709
|
+
tileset.memoryAdjustedScreenSpaceError / 1.02,
|
|
2710
|
+
tileset.maximumScreenSpaceError
|
|
2711
|
+
);
|
|
2713
2712
|
}
|
|
2714
2713
|
|
|
2715
2714
|
const scratchCartesian = new Cartesian3();
|
|
@@ -3057,7 +3056,7 @@ function destroyTile(tileset, tile) {
|
|
|
3057
3056
|
/**
|
|
3058
3057
|
* Unloads all tiles that weren't selected the previous frame. This can be used to
|
|
3059
3058
|
* explicitly manage the tile cache and reduce the total number of tiles loaded below
|
|
3060
|
-
* {@link Cesium3DTileset#
|
|
3059
|
+
* {@link Cesium3DTileset#cacheBytes}.
|
|
3061
3060
|
* <p>
|
|
3062
3061
|
* Tile unloads occur at the next frame to keep all the WebGL delete calls
|
|
3063
3062
|
* within the render loop.
|
|
@@ -58,8 +58,6 @@ Cesium3DTilesetCache.prototype.unloadTiles = function (
|
|
|
58
58
|
|
|
59
59
|
const list = this._list;
|
|
60
60
|
|
|
61
|
-
const maximumMemoryUsageInBytes = tileset.maximumMemoryUsage * 1024 * 1024;
|
|
62
|
-
|
|
63
61
|
// Traverse the list only to the sentinel since tiles/nodes to the
|
|
64
62
|
// right of the sentinel were used this frame.
|
|
65
63
|
//
|
|
@@ -68,7 +66,7 @@ Cesium3DTilesetCache.prototype.unloadTiles = function (
|
|
|
68
66
|
let node = list.head;
|
|
69
67
|
while (
|
|
70
68
|
node !== sentinel &&
|
|
71
|
-
(tileset.totalMemoryUsageInBytes >
|
|
69
|
+
(tileset.totalMemoryUsageInBytes > tileset.cacheBytes || trimTiles)
|
|
72
70
|
) {
|
|
73
71
|
const tile = node.item;
|
|
74
72
|
node = node.next;
|
|
@@ -61,7 +61,7 @@ Cesium3DTilesetSkipTraversal.selectTiles = function (tileset, frameState) {
|
|
|
61
61
|
|
|
62
62
|
if (
|
|
63
63
|
root.getScreenSpaceError(frameState, true) <=
|
|
64
|
-
tileset.
|
|
64
|
+
tileset.memoryAdjustedScreenSpaceError
|
|
65
65
|
) {
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
@@ -267,7 +267,10 @@ function executeTraversal(root, frameState) {
|
|
|
267
267
|
const { tileset } = root;
|
|
268
268
|
const baseScreenSpaceError = tileset.immediatelyLoadDesiredLevelOfDetail
|
|
269
269
|
? Number.MAX_VALUE
|
|
270
|
-
: Math.max(
|
|
270
|
+
: Math.max(
|
|
271
|
+
tileset.baseScreenSpaceError,
|
|
272
|
+
tileset.memoryAdjustedScreenSpaceError
|
|
273
|
+
);
|
|
271
274
|
const {
|
|
272
275
|
canTraverse,
|
|
273
276
|
loadTile,
|