Ver código fonte

InstanceNode: Sync update ranges in updateBefore. (#33615)

Co-authored-by: Michael Herzog <michael.herzog@human-interactive.org>
Justin Walsh 1 semana atrás
pai
commit
0c38bbeabe
1 arquivos alterados com 20 adições e 2 exclusões
  1. 20 2
      src/nodes/accessors/InstanceNode.js

+ 20 - 2
src/nodes/accessors/InstanceNode.js

@@ -76,6 +76,15 @@ class InstanceNode extends Node {
 		 */
 		this.instanceColorNode = null;
 
+		/**
+		 * The update type is set to `frame` for updating
+		 * velocity-related data.
+		 *
+		 * @type {string}
+		 * @default 'frame'
+		 */
+		this.updateType = NodeUpdateType.FRAME;
+
 		/**
 		 * The update type is set to `frame` since an update
 		 * of instanced buffer data must be checked per frame.
@@ -83,7 +92,7 @@ class InstanceNode extends Node {
 		 * @type {string}
 		 * @default 'frame'
 		 */
-		this.updateType = NodeUpdateType.FRAME;
+		this.updateBeforeType = NodeUpdateType.FRAME;
 
 		/**
 		 * A reference to a buffer that is used by `instanceMatrixNode`.
@@ -220,7 +229,7 @@ class InstanceNode extends Node {
 	 *
 	 * @param {NodeFrame} frame - The current node frame.
 	 */
-	update( frame ) {
+	updateBefore( /*frame*/ ) {
 
 		if ( this.buffer !== null && this.isStorageMatrix !== true ) {
 
@@ -250,6 +259,15 @@ class InstanceNode extends Node {
 
 		}
 
+	}
+
+	/**
+	 * Updates velocity-related data if necessary.
+	 *
+	 * @param {NodeFrame} frame - The current node frame.
+	 */
+	update( frame ) {
+
 		if ( this.previousInstanceMatrixNode !== null ) {
 
 			frame.object.previousInstanceMatrix.array.set( this.instanceMatrix.array );

粤ICP备19079148号