Просмотр исходного кода

InstanceNode: Honor `updateRanges`. (#31816)

Michael Herzog 8 месяцев назад
Родитель
Сommit
787ba7ed07
1 измененных файлов с 22 добавлено и 4 удалено
  1. 22 4
      src/nodes/accessors/InstanceNode.js

+ 22 - 4
src/nodes/accessors/InstanceNode.js

@@ -195,15 +195,33 @@ class InstanceNode extends Node {
 	 */
 	update( /*frame*/ ) {
 
-		if ( this.instanceMatrix.usage !== DynamicDrawUsage && this.buffer !== null && this.instanceMatrix.version !== this.buffer.version ) {
+		if ( this.buffer !== null ) {
 
-			this.buffer.version = this.instanceMatrix.version;
+			// keep update ranges in sync
+
+			this.buffer.clearUpdateRanges();
+			this.buffer.updateRanges.push( ... this.instanceMatrix.updateRanges );
+
+			// update version if necessary
+
+			if ( this.instanceMatrix.usage !== DynamicDrawUsage && this.instanceMatrix.version !== this.buffer.version ) {
+
+				this.buffer.version = this.instanceMatrix.version;
+
+			}
 
 		}
 
-		if ( this.instanceColor && this.instanceColor.usage !== DynamicDrawUsage && this.bufferColor !== null && this.instanceColor.version !== this.bufferColor.version ) {
+		if ( this.instanceColor && this.bufferColor !== null ) {
+
+			this.bufferColor.clearUpdateRanges();
+			this.bufferColor.updateRanges.push( ... this.instanceColor.updateRanges );
+
+			if ( this.instanceColor.usage !== DynamicDrawUsage && this.instanceColor.version !== this.bufferColor.version ) {
 
-			this.bufferColor.version = this.instanceColor.version;
+				this.bufferColor.version = this.instanceColor.version;
+
+			}
 
 		}
 

粤ICP备19079148号