@@ -310,6 +310,16 @@ define([
310
310
*/
311
311
this . _optimChildrenWithinParent = Cesium3DTileOptimizationHint . NOT_COMPUTED ;
312
312
313
+ /**
314
+ * Tracks if the tile's relationship with a ClippingPlaneCollection has changed with regards
315
+ * to the ClippingPlaneCollection's state.
316
+ *
317
+ * @type {Boolean }
318
+ *
319
+ * @private
320
+ */
321
+ this . clippingPlanesDirty = false ;
322
+
313
323
// Members that are updated every frame for tree traversal and rendering optimizations:
314
324
this . _distanceToCamera = 0 ;
315
325
this . _visibilityPlaneMask = 0 ;
@@ -1049,33 +1059,36 @@ define([
1049
1059
content . update ( tileset , frameState ) ;
1050
1060
}
1051
1061
1052
- /**
1053
- * Get the draw commands needed to render this tile.
1054
- *
1055
- * @private
1056
- */
1057
- Cesium3DTile . prototype . update = function ( tileset , frameState ) {
1062
+ function updateClippingPlanes ( tile , tileset ) {
1058
1063
// Compute and compare ClippingPlanes state:
1059
1064
// - enabled-ness - are clipping planes enabled? is this tile clipped?
1060
1065
// - clipping plane count
1061
1066
// - clipping function (union v. intersection)
1062
1067
var clippingPlanes = tileset . clippingPlanes ;
1063
1068
var currentClippingPlanesState = 0 ;
1064
- if ( defined ( clippingPlanes ) && this . _isClipped && clippingPlanes . enabled ) {
1069
+ if ( defined ( clippingPlanes ) && tile . _isClipped && clippingPlanes . enabled ) {
1065
1070
currentClippingPlanesState = clippingPlanes . clippingPlanesState ( ) ;
1066
1071
}
1067
- // If clippingPlaneState for this tile changed, mark content as clippingPlanesDirty
1068
- if ( currentClippingPlanesState !== this . _clippingPlanesState ) {
1069
- this . _clippingPlanesState = currentClippingPlanesState ;
1070
- this . _content . clippingPlanesDirty = true ;
1072
+ // If clippingPlaneState for tile changed, mark clippingPlanesDirty so content can update
1073
+ if ( currentClippingPlanesState !== tile . _clippingPlanesState ) {
1074
+ tile . _clippingPlanesState = currentClippingPlanesState ;
1075
+ tile . clippingPlanesDirty = true ;
1071
1076
}
1077
+ }
1072
1078
1079
+ /**
1080
+ * Get the draw commands needed to render this tile.
1081
+ *
1082
+ * @private
1083
+ */
1084
+ Cesium3DTile . prototype . update = function ( tileset , frameState ) {
1073
1085
var initCommandLength = frameState . commandList . length ;
1086
+ updateClippingPlanes ( this , tileset ) ;
1074
1087
applyDebugSettings ( this , tileset , frameState ) ;
1075
1088
updateContent ( this , tileset , frameState ) ;
1076
1089
this . _commandsLength = frameState . commandList . length - initCommandLength ;
1077
1090
1078
- this . _content . clippingPlanesDirty = false ; // reset after content update
1091
+ this . clippingPlanesDirty = false ; // reset after content update
1079
1092
} ;
1080
1093
1081
1094
var scratchCommandList = [ ] ;
0 commit comments