@@ -212,6 +212,7 @@ define([
212
212
this . _contentState = contentState ;
213
213
this . _contentReadyToProcessPromise = undefined ;
214
214
this . _contentReadyPromise = undefined ;
215
+ this . _expiredContent = undefined ;
215
216
216
217
this . _requestServer = requestServer ;
217
218
@@ -445,6 +446,22 @@ define([
445
446
}
446
447
} ,
447
448
449
+ /**
450
+ * Determines if the tile has available content to render. <code>true</code> if the tile's
451
+ * content is ready or if it has expired content that renders while new content loads; otherwise,
452
+ * <code>false</code>.
453
+ *
454
+ * @memberof Cesium3DTile.prototype
455
+ *
456
+ * @type {Boolean }
457
+ * @readonly
458
+ */
459
+ contentAvailable : {
460
+ get : function ( ) {
461
+ return this . contentReady || defined ( this . _expiredContent ) ;
462
+ }
463
+ } ,
464
+
448
465
/**
449
466
* Determines if the tile is ready to render. <code>true</code> if the tile
450
467
* is ready to render; otherwise, <code>false</code>.
@@ -538,6 +555,7 @@ define([
538
555
var now = JulianDate . now ( scratchJulianDate ) ;
539
556
if ( JulianDate . lessThan ( tile . expireDate , now ) ) {
540
557
tile . _contentState = Cesium3DTileContentState . EXPIRED ;
558
+ tile . _expiredContent = tile . _content ;
541
559
}
542
560
}
543
561
}
@@ -605,9 +623,6 @@ define([
605
623
return when . reject ( 'tileset is destroyed' ) ;
606
624
}
607
625
608
- // Destroy expired content to make way for the new content
609
- that . _content = that . _content && that . _content . destroy ( ) ;
610
-
611
626
var uint8Array = new Uint8Array ( arrayBuffer ) ;
612
627
var magic = getMagic ( uint8Array ) ;
613
628
var contentFactory = Cesium3DTileContentFactory [ magic ] ;
@@ -933,6 +948,20 @@ define([
933
948
}
934
949
}
935
950
951
+ function updateContent ( tile , tileset , frameState ) {
952
+ var content = tile . _content ;
953
+ var expiredContent = tile . _expiredContent ;
954
+
955
+ if ( defined ( expiredContent ) && ! tile . contentReady ) {
956
+ // Render the expired content while the content loads
957
+ expiredContent . update ( tileset , frameState ) ;
958
+ return ;
959
+ }
960
+
961
+ tile . _expiredContent = tile . _expiredContent && tile . _expiredContent . destroy ( ) ;
962
+ content . update ( tileset , frameState ) ;
963
+ }
964
+
936
965
/**
937
966
* Get the draw commands needed to render this tile.
938
967
*
@@ -941,7 +970,7 @@ define([
941
970
Cesium3DTile . prototype . update = function ( tileset , frameState ) {
942
971
applyDebugSettings ( this , tileset , frameState ) ;
943
972
updateExpiration ( this ) ;
944
- this . _content . update ( tileset , frameState ) ;
973
+ updateContent ( this , tileset , frameState ) ;
945
974
this . _transformDirty = false ;
946
975
} ;
947
976
@@ -977,6 +1006,7 @@ define([
977
1006
*/
978
1007
Cesium3DTile . prototype . destroy = function ( ) {
979
1008
this . _content = this . _content && this . _content . destroy ( ) ;
1009
+ this . _expiredContent = this . _expiredContent && this . _expiredContent . destroy ( ) ;
980
1010
this . _debugBoundingVolume = this . _debugBoundingVolume && this . _debugBoundingVolume . destroy ( ) ;
981
1011
this . _debugContentBoundingVolume = this . _debugContentBoundingVolume && this . _debugContentBoundingVolume . destroy ( ) ;
982
1012
this . _debugViewerRequestVolume = this . _debugViewerRequestVolume && this . _debugViewerRequestVolume . destroy ( ) ;
0 commit comments