소스 검색

added fromArray and toArray to Matrix3

Martin Wicke 12 년 전
부모
커밋
5389b0c415
1개의 변경된 파일21개의 추가작업 그리고 1개의 파일을 삭제
  1. 21 1
      src/math/Matrix3.js

+ 21 - 1
src/math/Matrix3.js

@@ -148,7 +148,7 @@ THREE.Matrix3.prototype = {
 
 			if ( throwOnInvertible || false ) {
 
-				throw new Error( msg ); 
+				throw new Error( msg );
 
 			} else {
 
@@ -208,6 +208,26 @@ THREE.Matrix3.prototype = {
 
 	},
 
+	fromArray: function ( array ) {
+
+		this.elements.set( array );
+
+		return this;
+
+	},
+
+	toArray: function () {
+
+		var te = this.elements;
+
+		return [
+			te[ 0 ], te[ 1 ], te[ 2 ],
+			te[ 3 ], te[ 4 ], te[ 5 ],
+			te[ 6 ], te[ 7 ], te[ 8 ]
+		];
+
+	},
+
 	clone: function () {
 
 		var te = this.elements;