Explorar o código

XRHandPrimitiveModel: Clean up.

Mr.doob %!s(int64=4) %!d(string=hai) anos
pai
achega
b3df09a0d0
Modificáronse 1 ficheiros con 6 adicións e 6 borrados
  1. 6 6
      examples/jsm/webxr/XRHandPrimitiveModel.js

+ 6 - 6
examples/jsm/webxr/XRHandPrimitiveModel.js

@@ -8,6 +8,9 @@ import {
 	Vector3
 } from '../../../build/three.module.js';
 
+const _matrix = new Matrix4();
+const _vector = new Vector3();
+
 class XRHandPrimitiveModel {
 
 	constructor( handModel, controller, path, handedness, options ) {
@@ -64,9 +67,6 @@ class XRHandPrimitiveModel {
 			'pinky-finger-tip'
 		];
 
-		this.tempMat = new Matrix4();
-		this.tempVec = new Vector3();
-
 	}
 
 	updateMesh() {
@@ -82,9 +82,9 @@ class XRHandPrimitiveModel {
 
 			if ( joint.visible ) {
 
-				this.tempVec.setScalar( joint.jointRadius || defaultRadius );
-				this.tempMat.compose( joint.position, joint.quaternion, this.tempVec );
-				this.handMesh.setMatrixAt( i, this.tempMat );
+				_vector.setScalar( joint.jointRadius || defaultRadius );
+				_matrix.compose( joint.position, joint.quaternion, _vector );
+				this.handMesh.setMatrixAt( i, _matrix );
 
 				count ++;