|
@@ -623,20 +623,22 @@ function mergeVertices( geometry, tolerance = 1e-4 ) {
|
|
|
const name = attributeNames[ i ];
|
|
|
const attr = geometry.attributes[ name ];
|
|
|
|
|
|
- tmpAttributes[ name ] = new BufferAttribute(
|
|
|
+ tmpAttributes[ name ] = new attr.constructor(
|
|
|
new attr.array.constructor( attr.count * attr.itemSize ),
|
|
|
attr.itemSize,
|
|
|
attr.normalized
|
|
|
);
|
|
|
|
|
|
- const morphAttr = geometry.morphAttributes[ name ];
|
|
|
- if ( morphAttr ) {
|
|
|
+ const morphAttributes = geometry.morphAttributes[ name ];
|
|
|
+ if ( morphAttributes ) {
|
|
|
|
|
|
- tmpMorphAttributes[ name ] = new BufferAttribute(
|
|
|
- new morphAttr.array.constructor( morphAttr.count * morphAttr.itemSize ),
|
|
|
- morphAttr.itemSize,
|
|
|
- morphAttr.normalized
|
|
|
- );
|
|
|
+ if ( ! tmpMorphAttributes[ name ] ) tmpMorphAttributes[ name ] = [];
|
|
|
+ morphAttributes.forEach( ( morphAttr, i ) => {
|
|
|
+
|
|
|
+ const array = new morphAttr.array.constructor( morphAttr.count * morphAttr.itemSize );
|
|
|
+ tmpMorphAttributes[ name ][ i ] = new morphAttr.constructor( array, morphAttr.itemSize, morphAttr.normalized );
|
|
|
+
|
|
|
+ } );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -681,22 +683,22 @@ function mergeVertices( geometry, tolerance = 1e-4 ) {
|
|
|
|
|
|
const name = attributeNames[ j ];
|
|
|
const attribute = geometry.getAttribute( name );
|
|
|
- const morphAttr = geometry.morphAttributes[ name ];
|
|
|
+ const morphAttributes = geometry.morphAttributes[ name ];
|
|
|
const itemSize = attribute.itemSize;
|
|
|
- const newarray = tmpAttributes[ name ];
|
|
|
+ const newArray = tmpAttributes[ name ];
|
|
|
const newMorphArrays = tmpMorphAttributes[ name ];
|
|
|
|
|
|
for ( let k = 0; k < itemSize; k ++ ) {
|
|
|
|
|
|
const getterFunc = getters[ k ];
|
|
|
const setterFunc = setters[ k ];
|
|
|
- newarray[ setterFunc ]( nextIndex, attribute[ getterFunc ]( index ) );
|
|
|
+ newArray[ setterFunc ]( nextIndex, attribute[ getterFunc ]( index ) );
|
|
|
|
|
|
- if ( morphAttr ) {
|
|
|
+ if ( morphAttributes ) {
|
|
|
|
|
|
- for ( let m = 0, ml = morphAttr.length; m < ml; m ++ ) {
|
|
|
+ for ( let m = 0, ml = morphAttributes.length; m < ml; m ++ ) {
|
|
|
|
|
|
- newMorphArrays[ m ][ setterFunc ]( nextIndex, morphAttr[ m ][ getterFunc ]( index ) );
|
|
|
+ newMorphArrays[ m ][ setterFunc ]( nextIndex, morphAttributes[ m ][ getterFunc ]( index ) );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -720,7 +722,7 @@ function mergeVertices( geometry, tolerance = 1e-4 ) {
|
|
|
|
|
|
const tmpAttribute = tmpAttributes[ name ];
|
|
|
|
|
|
- result.setAttribute( name, new BufferAttribute(
|
|
|
+ result.setAttribute( name, new tmpAttribute.constructor(
|
|
|
tmpAttribute.array.slice( 0, nextIndex * tmpAttribute.itemSize ),
|
|
|
tmpAttribute.itemSize,
|
|
|
tmpAttribute.normalized,
|
|
@@ -732,7 +734,7 @@ function mergeVertices( geometry, tolerance = 1e-4 ) {
|
|
|
|
|
|
const tmpMorphAttribute = tmpMorphAttributes[ name ][ j ];
|
|
|
|
|
|
- result.morphAttributes[ name ][ j ] = new BufferAttribute(
|
|
|
+ result.morphAttributes[ name ][ j ] = new tmpMorphAttribute.constructor(
|
|
|
tmpMorphAttribute.array.slice( 0, nextIndex * tmpMorphAttribute.itemSize ),
|
|
|
tmpMorphAttribute.itemSize,
|
|
|
tmpMorphAttribute.normalized,
|