@@ -120,8 +120,6 @@ define([
120
120
*/
121
121
this . computedTransform = computedTransform ;
122
122
123
- this . _transformDirty = true ;
124
-
125
123
this . _boundingVolume = this . createBoundingVolume ( header . boundingVolume , computedTransform ) ;
126
124
this . _boundingVolume2D = undefined ;
127
125
@@ -422,20 +420,6 @@ define([
422
420
}
423
421
} ,
424
422
425
- /**
426
- * Whether the computedTransform has changed this frame.
427
- *
428
- * @memberof Cesium3DTile.prototype
429
- *
430
- * @type {Boolean }
431
- * @readonly
432
- */
433
- transformDirty : {
434
- get : function ( ) {
435
- return this . _transformDirty ;
436
- }
437
- } ,
438
-
439
423
/**
440
424
* @readonly
441
425
* @private
@@ -550,15 +534,20 @@ define([
550
534
551
535
var scratchJulianDate = new JulianDate ( ) ;
552
536
553
- function updateExpiration ( tile ) {
554
- if ( defined ( tile . expireDate ) && tile . contentReady && ! tile . hasEmptyContent ) {
537
+ /**
538
+ * Update whether the tile has expired.
539
+ *
540
+ * @private
541
+ */
542
+ Cesium3DTile . prototype . updateExpiration = function ( ) {
543
+ if ( defined ( this . expireDate ) && this . contentReady && ! this . hasEmptyContent ) {
555
544
var now = JulianDate . now ( scratchJulianDate ) ;
556
- if ( JulianDate . lessThan ( tile . expireDate , now ) ) {
557
- tile . _contentState = Cesium3DTileContentState . EXPIRED ;
558
- tile . _expiredContent = tile . _content ;
545
+ if ( JulianDate . lessThan ( this . expireDate , now ) ) {
546
+ this . _contentState = Cesium3DTileContentState . EXPIRED ;
547
+ this . _expiredContent = this . _content ;
559
548
}
560
549
}
561
- }
550
+ } ;
562
551
563
552
function updateExpireDate ( tile ) {
564
553
if ( defined ( tile . expireDuration ) ) {
@@ -620,9 +609,9 @@ define([
620
609
621
610
promise . then ( function ( arrayBuffer ) {
622
611
if ( that . isDestroyed ( ) ) {
623
- return when . reject ( 'tileset is destroyed' ) ;
612
+ // Tile is unloaded before the content finishes loading
613
+ return when . reject ( 'tile is destroyed' ) ;
624
614
}
625
-
626
615
var uint8Array = new Uint8Array ( arrayBuffer ) ;
627
616
var magic = getMagic ( uint8Array ) ;
628
617
var contentFactory = Cesium3DTileContentFactory [ magic ] ;
@@ -642,6 +631,11 @@ define([
642
631
that . _contentReadyToProcessPromise . resolve ( content ) ;
643
632
644
633
content . readyPromise . then ( function ( content ) {
634
+ if ( that . isDestroyed ( ) ) {
635
+ // Tile is unloaded before the content finishes processing
636
+ that . _content . destroy ( ) ;
637
+ return when . reject ( 'tile is destroyed' ) ;
638
+ }
645
639
updateExpireDate ( that ) ;
646
640
that . _contentState = Cesium3DTileContentState . READY ;
647
641
that . _contentReadyPromise . resolve ( content ) ;
@@ -883,9 +877,8 @@ define([
883
877
Cesium3DTile . prototype . updateTransform = function ( parentTransform ) {
884
878
parentTransform = defaultValue ( parentTransform , Matrix4 . IDENTITY ) ;
885
879
var computedTransform = Matrix4 . multiply ( parentTransform , this . transform , scratchTransform ) ;
886
- var transformDirty = ! Matrix4 . equals ( computedTransform , this . computedTransform ) ;
887
- if ( transformDirty ) {
888
- this . _transformDirty = true ;
880
+ var transformChanged = ! Matrix4 . equals ( computedTransform , this . computedTransform ) ;
881
+ if ( transformChanged ) {
889
882
Matrix4 . clone ( computedTransform , this . computedTransform ) ;
890
883
891
884
// Update the bounding volumes
@@ -969,9 +962,7 @@ define([
969
962
*/
970
963
Cesium3DTile . prototype . update = function ( tileset , frameState ) {
971
964
applyDebugSettings ( this , tileset , frameState ) ;
972
- updateExpiration ( this ) ;
973
965
updateContent ( this , tileset , frameState ) ;
974
- this . _transformDirty = false ;
975
966
} ;
976
967
977
968
var scratchCommandList = [ ] ;
@@ -1006,10 +997,11 @@ define([
1006
997
*/
1007
998
Cesium3DTile . prototype . destroy = function ( ) {
1008
999
this . _content = this . _content && this . _content . destroy ( ) ;
1009
- this . _expiredContent = this . _expiredContent && this . _expiredContent . destroy ( ) ;
1000
+ this . _expiredContent = this . _expiredContent && ! this . _expiredContent . isDestroyed ( ) && this . _expiredContent . destroy ( ) ;
1010
1001
this . _debugBoundingVolume = this . _debugBoundingVolume && this . _debugBoundingVolume . destroy ( ) ;
1011
1002
this . _debugContentBoundingVolume = this . _debugContentBoundingVolume && this . _debugContentBoundingVolume . destroy ( ) ;
1012
1003
this . _debugViewerRequestVolume = this . _debugViewerRequestVolume && this . _debugViewerRequestVolume . destroy ( ) ;
1004
+
1013
1005
return destroyObject ( this ) ;
1014
1006
} ;
1015
1007
0 commit comments