@@ -301,11 +301,6 @@ define([
301
301
302
302
BaseTraversal . prototype . getChildren = function ( tile ) {
303
303
if ( this . updateAndCheckChildren ( tile ) ) {
304
- if ( ! childrenAreVisible ( tile ) ) {
305
- ++ this . tileset . _statistics . numberOfTilesCulledWithChildrenUnion ;
306
- return emptyArray ;
307
- }
308
-
309
304
var children = tile . children ;
310
305
var childrenLength = children . length ;
311
306
var allReady = true ;
@@ -341,12 +336,12 @@ define([
341
336
}
342
337
}
343
338
344
- if ( tile . refine === Cesium3DTileRefine . ADD && tile . hasRenderableContent ) {
339
+ if ( hasAdditiveContent ( tile ) ) {
345
340
tileset . _desiredTiles . push ( tile ) ;
346
341
}
347
342
348
343
// stop traversal when we've attained the desired level of error
349
- if ( tile . _screenSpaceError <= this . baseScreenSpaceError && tile . hasRenderableContent ) {
344
+ if ( tile . _screenSpaceError <= this . baseScreenSpaceError ) {
350
345
return false ;
351
346
}
352
347
@@ -362,8 +357,12 @@ define([
362
357
} ;
363
358
364
359
BaseTraversal . prototype . leafHandler = function ( tile ) {
365
- // additive tiles have already been pushed to tileset._desiredTiles
366
- if ( tile . refine === Cesium3DTileRefine . REPLACE ) {
360
+ // if skipLODs is off, leaves of the base traversal get pushed to tileset._desiredTiles. additive tiles have already been pushed
361
+ if ( this . tileset . skipLODs || tile . refine === Cesium3DTileRefine . REPLACE ) {
362
+ if ( tile . refine === Cesium3DTileRefine . REPLACE && ! childrenAreVisible ( tile ) ) {
363
+ ++ this . tileset . _statistics . numberOfTilesCulledWithChildrenUnion ;
364
+ return ;
365
+ }
367
366
this . leaves . push ( tile ) ;
368
367
}
369
368
} ;
@@ -396,11 +395,6 @@ define([
396
395
397
396
InternalBaseTraversal . prototype . getChildren = function ( tile ) {
398
397
if ( this . updateAndCheckChildren ( tile , this . baseScreenSpaceError ) ) {
399
- if ( ! childrenAreVisible ( tile ) ) {
400
- ++ this . tileset . _statistics . numberOfTilesCulledWithChildrenUnion ;
401
- return emptyArray ;
402
- }
403
-
404
398
var children = tile . children ;
405
399
var childrenLength = children . length ;
406
400
for ( var i = 0 ; i < childrenLength ; ++ i ) {
@@ -450,7 +444,7 @@ define([
450
444
451
445
SkipTraversal . prototype . leafHandler = function ( tile ) {
452
446
// additive tiles have already been pushed
453
- if ( tile . refine === Cesium3DTileRefine . REPLACE ) {
447
+ if ( ! hasAdditiveContent ( tile ) ) {
454
448
this . tileset . _desiredTiles . push ( tile ) ;
455
449
}
456
450
} ;
@@ -481,7 +475,7 @@ define([
481
475
var maximumScreenSpaceError = tileset . _maximumScreenSpaceError ;
482
476
483
477
if ( ! tile . hasTilesetContent ) {
484
- if ( tile . refine === Cesium3DTileRefine . ADD && tile . hasRenderableContent ) {
478
+ if ( hasAdditiveContent ( tile ) ) {
485
479
tileset . _desiredTiles . push ( tile ) ;
486
480
}
487
481
@@ -500,7 +494,7 @@ define([
500
494
}
501
495
502
496
var childrenVisibility = updateChildren ( tileset , tile , this . frameState ) ;
503
- var showAdditive = tile . refine === Cesium3DTileRefine . ADD ;
497
+ var showAdditive = tile . refine === Cesium3DTileRefine . ADD && tile . _screenSpaceError > maximumScreenSpaceError ;
504
498
var showReplacement = tile . refine === Cesium3DTileRefine . REPLACE && ( childrenVisibility & Cesium3DTileChildrenVisibility . VISIBLE_IN_REQUEST_VOLUME ) !== 0 ;
505
499
506
500
// at least one child is visible, but is not in request volume. the parent must be selected
@@ -509,11 +503,6 @@ define([
509
503
}
510
504
511
505
if ( showAdditive || showReplacement || tile . hasTilesetContent ) {
512
- if ( ! childrenAreVisible ( tile ) ) {
513
- ++ this . tileset . _statistics . numberOfTilesCulledWithChildrenUnion ;
514
- return emptyArray ;
515
- }
516
-
517
506
var children = tile . children ;
518
507
var childrenLength = children . length ;
519
508
for ( var i = 0 ; i < childrenLength ; ++ i ) {
@@ -538,6 +527,10 @@ define([
538
527
539
528
InternalSkipTraversal . prototype . leafHandler = function ( tile ) {
540
529
if ( tile !== this . root ) {
530
+ if ( tile . refine === Cesium3DTileRefine . REPLACE && ! childrenAreVisible ( tile ) ) {
531
+ ++ this . tileset . _statistics . numberOfTilesCulledWithChildrenUnion ;
532
+ return ;
533
+ }
541
534
if ( ! tile . hasEmptyContent ) {
542
535
if ( this . tileset . loadSiblings ) {
543
536
var parent = tile . parent ;
@@ -551,7 +544,7 @@ define([
551
544
}
552
545
}
553
546
this . queue . push ( tile ) ;
554
- } else if ( tile . refine === Cesium3DTileRefine . REPLACE ) {
547
+ } else if ( ! hasAdditiveContent ( tile ) ) {
555
548
// additive tiles have already been pushed
556
549
this . tileset . _desiredTiles . push ( tile ) ;
557
550
}
@@ -708,6 +701,10 @@ define([
708
701
return tile . refine === Cesium3DTileRefine . ADD || tile . children . length === 0 || tile . childrenVisibility & Cesium3DTileChildrenVisibility . VISIBLE !== 0 ;
709
702
}
710
703
704
+ function hasAdditiveContent ( tile ) {
705
+ return tile . refine === Cesium3DTileRefine . ADD && tile . hasRenderableContent ;
706
+ }
707
+
711
708
function DFS ( root , options ) {
712
709
var stack = options . stack ;
713
710
0 commit comments