瀏覽代碼

Color: Added offset to fromArray.

Mr.doob 10 年之前
父節點
當前提交
a5cbf8854a
共有 1 個文件被更改,包括 6 次插入4 次删除
  1. 6 4
      src/math/Color.js

+ 6 - 4
src/math/Color.js

@@ -476,11 +476,13 @@ THREE.Color.prototype = {
 
 	},
 
-	fromArray: function ( array ) {
+	fromArray: function ( array, offset ) {
 
-		this.r = array[ 0 ];
-		this.g = array[ 1 ];
-		this.b = array[ 2 ];
+		if ( offset === undefined ) offset = 0;
+
+		this.r = array[ offset ];
+		this.g = array[ offset + 1 ];
+		this.b = array[ offset + 2 ];
 
 		return this;