Browse Source

BufferAttribute: Added copyAt() to simplify item copying. (Not sure about naming)

Mr.doob 11 years ago
parent
commit
34580226b2
1 changed files with 13 additions and 0 deletions
  1. 13 0
      src/core/BufferAttribute.js

+ 13 - 0
src/core/BufferAttribute.js

@@ -19,6 +19,19 @@ THREE.BufferAttribute.prototype = {
 
 	},
 
+	copyAt: function ( index1, attribute, index2 ) {
+
+		index1 *= this.itemSize;
+		index2 *= attribute.itemSize;
+
+		for ( var i = 0, l = this.itemSize; i < l; i ++ ) {
+
+			this.array[ index1 + i ] = attribute.array[ index2 + i ];
+
+		}
+
+	},
+
 	set: function ( value ) {
 
 		this.array.set( value );