@@ -742,6 +742,7 @@ export class CoreNode extends EventEmitter {
742742 public calcZIndex = 0 ;
743743 public hasRTTupdates = false ;
744744 public parentHasRenderTexture = false ;
745+ public rttParent : CoreNode | null = null ;
745746
746747 constructor ( readonly stage : Stage , props : CoreNodeProps ) {
747748 super ( ) ;
@@ -1134,7 +1135,18 @@ export class CoreNode extends EventEmitter {
11341135 continue ;
11351136 }
11361137
1137- child . update ( delta , this . clippingRect ) ;
1138+ let childClippingRect = this . clippingRect ;
1139+ if ( this . rtt === true ) {
1140+ childClippingRect = {
1141+ x : 0 ,
1142+ y : 0 ,
1143+ width : 0 ,
1144+ height : 0 ,
1145+ valid : false ,
1146+ } ;
1147+ }
1148+
1149+ child . update ( delta , childClippingRect ) ;
11381150 }
11391151 }
11401152
@@ -1165,17 +1177,20 @@ export class CoreNode extends EventEmitter {
11651177 this . childUpdateType = 0 ;
11661178 }
11671179
1168- private notifyParentRTTOfUpdate ( ) {
1169- if ( this . parent === null ) {
1170- return ;
1171- }
1172-
1180+ private findParentRTTNode ( ) : CoreNode | null {
11731181 let rttNode : CoreNode | null = this . parent ;
1174- // Traverse up to find the RTT root node
11751182 while ( rttNode && ! rttNode . rtt ) {
11761183 rttNode = rttNode . parent ;
11771184 }
1185+ return rttNode ;
1186+ }
1187+
1188+ private notifyParentRTTOfUpdate ( ) {
1189+ if ( this . parent === null ) {
1190+ return ;
1191+ }
11781192
1193+ const rttNode = this . rttParent || this . findParentRTTNode ( ) ;
11791194 if ( ! rttNode ) {
11801195 return ;
11811196 }
@@ -1266,6 +1281,11 @@ export class CoreNode extends EventEmitter {
12661281 return CoreNodeRenderState . InViewport ;
12671282 }
12681283
1284+ // if we are part of a parent render texture, we're always in bounds
1285+ if ( this . parentHasRenderTexture === true ) {
1286+ return CoreNodeRenderState . InBounds ;
1287+ }
1288+
12691289 // check if we dont have dimensions, take our parent's render state
12701290 if (
12711291 this . parent !== null &&
@@ -1991,7 +2011,7 @@ export class CoreNode extends EventEmitter {
19912011 }
19922012 this . props . rtt = value ;
19932013
1994- if ( value ) {
2014+ if ( value === true ) {
19952015 this . initRenderTexture ( ) ;
19962016 this . markChildrenWithRTT ( ) ;
19972017 } else {
@@ -2000,7 +2020,7 @@ export class CoreNode extends EventEmitter {
20002020
20012021 this . setUpdateType ( UpdateType . RenderTexture ) ;
20022022
2003- if ( this . parentHasRenderTexture ) {
2023+ if ( this . parentHasRenderTexture === true ) {
20042024 this . notifyParentRTTOfUpdate ( ) ;
20052025 }
20062026 }
@@ -2054,6 +2074,7 @@ export class CoreNode extends EventEmitter {
20542074 for ( const child of this . children ) {
20552075 // force child to update everything as the RTT inheritance has changed
20562076 child . parentHasRenderTexture = false ;
2077+ child . rttParent = null ;
20572078 child . setUpdateType ( UpdateType . All ) ;
20582079 child . clearRTTInheritance ( ) ;
20592080 }
0 commit comments