|
@@ -757,11 +757,43 @@ THREE.BufferGeometry.prototype = {
|
|
|
*/
|
|
|
|
|
|
return offsets;
|
|
|
+
|
|
|
},
|
|
|
|
|
|
- merge: function () {
|
|
|
+ merge: function ( geometry, offset ) {
|
|
|
+
|
|
|
+ if ( geometry instanceof THREE.BufferGeometry === false ) {
|
|
|
+
|
|
|
+ console.error( 'THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.', geometry );
|
|
|
+ return;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if ( offset === undefined ) offset = 0;
|
|
|
+
|
|
|
+ var attributes = this.attributes;
|
|
|
+
|
|
|
+ for ( var key in attributes ) {
|
|
|
+
|
|
|
+ if ( geometry.attributes[ key ] === undefined ) continue;
|
|
|
+
|
|
|
+ var attribute1 = attributes[ key ];
|
|
|
+ var attributeArray1 = attribute1.array;
|
|
|
+
|
|
|
+ var attribute2 = geometry.attributes[ key ];
|
|
|
+ var attributeArray2 = attribute2.array;
|
|
|
+
|
|
|
+ var attributeSize = attribute2.itemSize;
|
|
|
+
|
|
|
+ for ( var i = 0, j = attributeSize * offset; i < attributeArray2.length; i ++, j ++ ) {
|
|
|
+
|
|
|
+ attributeArray1[ j ] = attributeArray2[ i ];
|
|
|
|
|
|
- console.log( 'BufferGeometry.merge(): TODO' );
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return this;
|
|
|
|
|
|
},
|
|
|
|