2
0
Эх сурвалжийг харах

FBXLoader2: Removed yet more GC.

Mr.doob 8 жил өмнө
parent
commit
eeb7000da8

+ 7 - 7
examples/js/loaders/FBXLoader2.js

@@ -2985,6 +2985,9 @@
 
 
 	}
 	}
 
 
+	var euler = new THREE.Euler();
+	var quaternion = new THREE.Quaternion();
+
 	/**
 	/**
 	 * @param {THREE.Bone} bone
 	 * @param {THREE.Bone} bone
 	 */
 	 */
@@ -2997,11 +3000,7 @@
 			scl: bone.scale.toArray()
 			scl: bone.scale.toArray()
 		};
 		};
 
 
-		if ( animationNode === undefined ) {
-
-			return key;
-
-		}
+		if ( animationNode === undefined ) return key;
 
 
 		try {
 		try {
 
 
@@ -3016,8 +3015,9 @@
 				var rotationX = animationNode.R.curves.x.values[ frame ];
 				var rotationX = animationNode.R.curves.x.values[ frame ];
 				var rotationY = animationNode.R.curves.y.values[ frame ];
 				var rotationY = animationNode.R.curves.y.values[ frame ];
 				var rotationZ = animationNode.R.curves.z.values[ frame ];
 				var rotationZ = animationNode.R.curves.z.values[ frame ];
-				var euler = new THREE.Euler( rotationX, rotationY, rotationZ, 'ZYX' );
-				key.rot = new THREE.Quaternion().setFromEuler( euler ).toArray();
+
+				quaternion.setFromEuler( euler.set( rotationX, rotationY, rotationZ, 'ZYX' ) );
+				key.rot = quaternion.toArray();
 
 
 			}
 			}