@@ -304,7 +304,7 @@ define([
304
304
} ;
305
305
306
306
BaseTraversal . prototype . getChildren = function ( tile ) {
307
- if ( this . updateAndCheckChildren ( tile ) ) {
307
+ if ( baseUpdateAndCheckChildren ( this . tileset , tile , this . baseScreenSpaceError , this . frameState ) ) {
308
308
var children = tile . children ;
309
309
var childrenLength = children . length ;
310
310
var allReady = true ;
@@ -331,14 +331,12 @@ define([
331
331
return emptyArray ;
332
332
} ;
333
333
334
- BaseTraversal . prototype . updateAndCheckChildren = function ( tile ) {
335
- var tileset = this . tileset ;
336
-
334
+ function baseUpdateAndCheckChildren ( tileset , tile , baseScreenSpaceError , frameState ) {
337
335
if ( tile . hasTilesetContent ) {
338
336
// load any tilesets of tilesets now because at this point we still have not achieved a base level of content
339
- loadTile ( tile , this . frameState ) ;
337
+ loadTile ( tile , frameState ) ;
340
338
if ( tile . contentReady ) {
341
- updateChildren ( tileset , tile , this . frameState ) ;
339
+ updateChildren ( tileset , tile , frameState ) ;
342
340
}
343
341
return true ;
344
342
}
@@ -348,13 +346,13 @@ define([
348
346
}
349
347
350
348
// stop traversal when we've attained the desired level of error
351
- if ( tile . _screenSpaceError <= this . baseScreenSpaceError ) {
349
+ if ( tile . _screenSpaceError <= baseScreenSpaceError ) {
352
350
// When skipping LODs, require an existing base level of content first
353
- updateChildren ( tileset , tile , this . frameState ) ;
351
+ updateChildren ( tileset , tile , frameState ) ;
354
352
return false ;
355
353
}
356
354
357
- var childrenVisibility = updateChildren ( tileset , tile , this . frameState ) ;
355
+ var childrenVisibility = updateChildren ( tileset , tile , frameState ) ;
358
356
var showAdditive = tile . refine === Cesium3DTileRefine . ADD ;
359
357
var showReplacement = tile . refine === Cesium3DTileRefine . REPLACE && ( childrenVisibility & Cesium3DTileChildrenVisibility . VISIBLE_IN_REQUEST_VOLUME ) !== 0 ;
360
358
@@ -407,7 +405,7 @@ define([
407
405
} ;
408
406
409
407
InternalBaseTraversal . prototype . getChildren = function ( tile ) {
410
- if ( this . updateAndCheckChildren ( tile , this . baseScreenSpaceError ) ) {
408
+ if ( baseUpdateAndCheckChildren ( this . tileset , tile , this . baseScreenSpaceError , this . frameState ) ) {
411
409
var children = tile . children ;
412
410
var childrenLength = children . length ;
413
411
for ( var i = 0 ; i < childrenLength ; ++ i ) {
@@ -580,12 +578,16 @@ define([
580
578
} ;
581
579
582
580
function updateChildren ( tileset , tile , frameState ) {
581
+ if ( tile . _lastVisitedFrame === frameState . frameNumber ) {
582
+ return tile . childrenVisibility ;
583
+ }
584
+
583
585
var children = tile . children ;
584
586
585
587
updateTransforms ( children , tile . computedTransform ) ;
586
588
computeDistanceToCamera ( children , frameState ) ;
587
589
588
- return computeChildrenVisibility ( tile , frameState , true ) ;
590
+ return computeChildrenVisibility ( tile , frameState ) ;
589
591
}
590
592
591
593
function visitTile ( tileset , tile , frameState , outOfCore ) {
@@ -630,7 +632,7 @@ define([
630
632
}
631
633
}
632
634
633
- function computeChildrenVisibility ( tile , frameState , checkViewerRequestVolume ) {
635
+ function computeChildrenVisibility ( tile , frameState ) {
634
636
var flag = Cesium3DTileChildrenVisibility . NONE ;
635
637
var children = tile . children ;
636
638
var childrenLength = children . length ;
@@ -644,17 +646,15 @@ define([
644
646
flag |= Cesium3DTileChildrenVisibility . VISIBLE ;
645
647
}
646
648
647
- if ( checkViewerRequestVolume ) {
648
- if ( ! child . insideViewerRequestVolume ( frameState ) ) {
649
- if ( isVisible ( visibilityMask ) ) {
650
- flag |= Cesium3DTileChildrenVisibility . VISIBLE_NOT_IN_REQUEST_VOLUME ;
651
- }
652
- visibilityMask = CullingVolume . MASK_OUTSIDE ;
653
- } else {
654
- flag |= Cesium3DTileChildrenVisibility . IN_REQUEST_VOLUME ;
655
- if ( isVisible ( visibilityMask ) ) {
656
- flag |= Cesium3DTileChildrenVisibility . VISIBLE_IN_REQUEST_VOLUME ;
657
- }
649
+ if ( ! child . insideViewerRequestVolume ( frameState ) ) {
650
+ if ( isVisible ( visibilityMask ) ) {
651
+ flag |= Cesium3DTileChildrenVisibility . VISIBLE_NOT_IN_REQUEST_VOLUME ;
652
+ }
653
+ visibilityMask = CullingVolume . MASK_OUTSIDE ;
654
+ } else {
655
+ flag |= Cesium3DTileChildrenVisibility . IN_REQUEST_VOLUME ;
656
+ if ( isVisible ( visibilityMask ) ) {
657
+ flag |= Cesium3DTileChildrenVisibility . VISIBLE_IN_REQUEST_VOLUME ;
658
658
}
659
659
}
660
660
0 commit comments