2
2
'../Core/BoundingSphere' ,
3
3
'../Core/Cartesian3' ,
4
4
'../Core/Color' ,
5
+ '../Core/ColorGeometryInstanceAttribute' ,
5
6
'../Core/CullingVolume' ,
6
7
'../Core/defaultValue' ,
7
8
'../Core/defined' ,
@@ -24,7 +25,6 @@ define([
24
25
'../Core/Resource' ,
25
26
'../Core/RuntimeError' ,
26
27
'../ThirdParty/when' ,
27
- './Cesium3DTileChildrenVisibility' ,
28
28
'./Cesium3DTileContentFactory' ,
29
29
'./Cesium3DTileContentState' ,
30
30
'./Cesium3DTileOptimizationHint' ,
@@ -38,6 +38,7 @@ define([
38
38
BoundingSphere ,
39
39
Cartesian3 ,
40
40
Color ,
41
+ ColorGeometryInstanceAttribute ,
41
42
CullingVolume ,
42
43
defaultValue ,
43
44
defined ,
@@ -60,7 +61,6 @@ define([
60
61
Resource ,
61
62
RuntimeError ,
62
63
when ,
63
- Cesium3DTileChildrenVisibility ,
64
64
Cesium3DTileContentFactory ,
65
65
Cesium3DTileContentState ,
66
66
Cesium3DTileOptimizationHint ,
@@ -235,19 +235,6 @@ define([
235
235
*/
236
236
this . hasEmptyContent = hasEmptyContent ;
237
237
238
- /**
239
- * When <code>true</code>, the tile's content is renderable.
240
- * <p>
241
- * This is <code>false</code> until the tile's content is loaded.
242
- * </p>
243
- *
244
- * @type {Boolean }
245
- * @readonly
246
- *
247
- * @private
248
- */
249
- this . hasRenderableContent = false ;
250
-
251
238
/**
252
239
* When <code>true</code>, the tile's content points to an external tileset.
253
240
* <p>
@@ -262,14 +249,16 @@ define([
262
249
this . hasTilesetContent = false ;
263
250
264
251
/**
265
- * The corresponding node in the cache replacement list.
252
+ * The node in the tileset's LRU cache, used to determine when to unload a tile's content.
253
+ *
254
+ * See {@link Cesium3DTilesetCache}
266
255
*
267
256
* @type {DoublyLinkedListNode }
268
257
* @readonly
269
258
*
270
259
* @private
271
260
*/
272
- this . replacementNode = undefined ;
261
+ this . cacheNode = undefined ;
273
262
274
263
var expire = header . expire ;
275
264
var expireDuration ;
@@ -295,15 +284,6 @@ define([
295
284
*/
296
285
this . expireDate = expireDate ;
297
286
298
- /**
299
- * Marks if the tile is selected this frame.
300
- *
301
- * @type {Boolean }
302
- *
303
- * @private
304
- */
305
- this . selected = false ;
306
-
307
287
/**
308
288
* The time when a style was last applied to this tile.
309
289
*
@@ -334,22 +314,27 @@ define([
334
314
335
315
// Members that are updated every frame for tree traversal and rendering optimizations:
336
316
this . _distanceToCamera = 0 ;
337
- this . _visibilityPlaneMask = 0 ;
338
- this . _childrenVisibility = Cesium3DTileChildrenVisibility . VISIBLE ;
339
- this . _lastSelectedFrameNumber = - 1 ;
317
+ this . _centerZDepth = 0 ;
340
318
this . _screenSpaceError = 0 ;
341
- this . _screenSpaceErrorComputedFrame = - 1 ;
319
+ this . _visibilityPlaneMask = 0 ;
320
+ this . _visible = false ;
321
+ this . _inRequestVolume = false ;
322
+
342
323
this . _finalResolution = true ;
343
324
this . _depth = 0 ;
344
- this . _centerZDepth = 0 ;
345
325
this . _stackLength = 0 ;
346
- this . _selectedFrame = - 1 ;
347
326
this . _selectionDepth = 0 ;
348
- this . _lastSelectionDepth = undefined ;
349
- this . _requestedFrame = undefined ;
350
- this . _lastVisitedFrame = undefined ;
327
+
328
+ this . _updatedVisibilityFrame = 0 ;
329
+ this . _touchedFrame = 0 ;
330
+ this . _visitedFrame = 0 ;
331
+ this . _selectedFrame = 0 ;
332
+ this . _requestedFrame = 0 ;
351
333
this . _ancestorWithContent = undefined ;
352
- this . _ancestorWithLoadedContent = undefined ;
334
+ this . _ancestorWithContentAvailable = undefined ;
335
+ this . _refines = false ;
336
+ this . _shouldSelect = false ;
337
+ this . _priority = 0.0 ;
353
338
this . _isClipped = true ;
354
339
this . _clippingPlanesState = 0 ; // encapsulates (_isClipped, clippingPlanes.enabled) and number/function
355
340
@@ -467,13 +452,13 @@ define([
467
452
*/
468
453
contentAvailable : {
469
454
get : function ( ) {
470
- return this . contentReady || ( defined ( this . _expiredContent ) && this . _contentState !== Cesium3DTileContentState . FAILED ) ;
455
+ return ( this . contentReady && ! this . hasEmptyContent && ! this . hasTilesetContent ) || ( defined ( this . _expiredContent ) && ! this . contentFailed ) ;
471
456
}
472
457
} ,
473
458
474
459
/**
475
- * Determines if the tile is ready to render. <code>true</code> if the tile
476
- * is ready to render; otherwise, <code>false</code> .
460
+ * Determines if the tile's content is ready. This is automatically <code>true</code> for
461
+ * tile's with empty content .
477
462
*
478
463
* @memberof Cesium3DTile.prototype
479
464
*
@@ -522,6 +507,23 @@ define([
522
507
}
523
508
} ,
524
509
510
+ /**
511
+ * Determines if the tile's content failed to load. <code>true</code> if the tile's
512
+ * content failed to load; otherwise, <code>false</code>.
513
+ *
514
+ * @memberof Cesium3DTile.prototype
515
+ *
516
+ * @type {Boolean }
517
+ * @readonly
518
+ *
519
+ * @private
520
+ */
521
+ contentFailed : {
522
+ get : function ( ) {
523
+ return this . _contentState === Cesium3DTileContentState . FAILED ;
524
+ }
525
+ } ,
526
+
525
527
/**
526
528
* Gets the promise that will be resolved when the tile's content is ready to process.
527
529
* This happens after the content is downloaded but before the content is ready
@@ -618,7 +620,7 @@ define([
618
620
619
621
function createPriorityFunction ( tile ) {
620
622
return function ( ) {
621
- return tile . _distanceToCamera ;
623
+ return tile . _priority ;
622
624
} ;
623
625
}
624
626
@@ -690,7 +692,6 @@ define([
690
692
691
693
if ( defined ( contentFactory ) ) {
692
694
content = contentFactory ( tileset , that , that . _contentResource , arrayBuffer , 0 ) ;
693
- that . hasRenderableContent = true ;
694
695
} else {
695
696
// The content may be json instead
696
697
content = Cesium3DTileContentFactory . json ( tileset , that , that . _contentResource , arrayBuffer , 0 ) ;
@@ -710,7 +711,7 @@ define([
710
711
updateExpireDate ( that ) ;
711
712
712
713
// Refresh style for expired content
713
- that . lastStyleTime = 0 ;
714
+ that . _selectedFrame = 0 ;
714
715
715
716
that . _contentState = Cesium3DTileContentState . READY ;
716
717
that . _contentReadyPromise . resolve ( content ) ;
@@ -735,7 +736,7 @@ define([
735
736
* @private
736
737
*/
737
738
Cesium3DTile . prototype . unloadContent = function ( ) {
738
- if ( ! this . hasRenderableContent ) {
739
+ if ( this . hasEmptyContent || this . hasTilesetContent ) {
739
740
return ;
740
741
}
741
742
@@ -744,8 +745,6 @@ define([
744
745
this . _contentReadyToProcessPromise = undefined ;
745
746
this . _contentReadyPromise = undefined ;
746
747
747
- this . replacementNode = undefined ;
748
-
749
748
this . lastStyleTime = 0 ;
750
749
this . clippingPlanesDirty = ( this . _clippingPlanesState === 0 ) ;
751
750
this . _clippingPlanesState = 0 ;
@@ -859,7 +858,7 @@ define([
859
858
* Computes the distance from the center of the tile's bounding volume to the camera.
860
859
*
861
860
* @param {FrameState } frameState The frame state.
862
- * @returns {Number } The distance, in meters, or zero if the camera is inside the bounding volume .
861
+ * @returns {Number } The distance, in meters.
863
862
*
864
863
* @private
865
864
*/
@@ -1032,14 +1031,24 @@ define([
1032
1031
1033
1032
function applyDebugSettings ( tile , tileset , frameState ) {
1034
1033
var hasContentBoundingVolume = defined ( tile . _header . content ) && defined ( tile . _header . content . boundingVolume ) ;
1034
+ var empty = tile . hasEmptyContent || tile . hasTilesetContent ;
1035
1035
1036
1036
var showVolume = tileset . debugShowBoundingVolume || ( tileset . debugShowContentBoundingVolume && ! hasContentBoundingVolume ) ;
1037
1037
if ( showVolume ) {
1038
+ var color ;
1039
+ if ( ! tile . _finalResolution ) {
1040
+ color = Color . YELLOW ;
1041
+ } else if ( empty ) {
1042
+ color = Color . DARKGRAY ;
1043
+ } else {
1044
+ color = Color . WHITE ;
1045
+ }
1038
1046
if ( ! defined ( tile . _debugBoundingVolume ) ) {
1039
- var color = tile . _finalResolution ? ( hasContentBoundingVolume ? Color . WHITE : Color . RED ) : Color . YELLOW ;
1040
1047
tile . _debugBoundingVolume = tile . _boundingVolume . createDebugVolume ( color ) ;
1041
1048
}
1042
1049
tile . _debugBoundingVolume . update ( frameState ) ;
1050
+ var attributes = tile . _debugBoundingVolume . getGeometryInstanceAttributes ( 'outline' ) ;
1051
+ attributes . color = ColorGeometryInstanceAttribute . toValue ( color , attributes . color ) ;
1043
1052
} else if ( ! showVolume && defined ( tile . _debugBoundingVolume ) ) {
1044
1053
tile . _debugBoundingVolume = tile . _debugBoundingVolume . destroy ( ) ;
1045
1054
}
0 commit comments