|
@@ -1,445 +1,441 @@
|
|
( function () {
|
|
( function () {
|
|
|
|
|
|
- class BufferGeometryUtils {
|
|
|
|
|
|
+ function computeTangents( geometry ) {
|
|
|
|
|
|
- static computeTangents( geometry ) {
|
|
|
|
|
|
+ geometry.computeTangents();
|
|
|
|
+ console.warn( 'THREE.BufferGeometryUtils: .computeTangents() has been removed. Use THREE.BufferGeometry.computeTangents() instead.' );
|
|
|
|
|
|
- geometry.computeTangents();
|
|
|
|
- console.warn( 'THREE.BufferGeometryUtils: .computeTangents() has been removed. Use THREE.BufferGeometry.computeTangents() instead.' );
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- /**
|
|
|
|
- * @param {Array<BufferGeometry>} geometries
|
|
|
|
- * @param {Boolean} useGroups
|
|
|
|
- * @return {BufferGeometry}
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- static mergeBufferGeometries( geometries, useGroups = false ) {
|
|
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * @param {Array<BufferGeometry>} geometries
|
|
|
|
+ * @param {Boolean} useGroups
|
|
|
|
+ * @return {BufferGeometry}
|
|
|
|
+ */
|
|
|
|
|
|
- const isIndexed = geometries[ 0 ].index !== null;
|
|
|
|
- const attributesUsed = new Set( Object.keys( geometries[ 0 ].attributes ) );
|
|
|
|
- const morphAttributesUsed = new Set( Object.keys( geometries[ 0 ].morphAttributes ) );
|
|
|
|
- const attributes = {};
|
|
|
|
- const morphAttributes = {};
|
|
|
|
- const morphTargetsRelative = geometries[ 0 ].morphTargetsRelative;
|
|
|
|
- const mergedGeometry = new THREE.BufferGeometry();
|
|
|
|
- let offset = 0;
|
|
|
|
|
|
|
|
- for ( let i = 0; i < geometries.length; ++ i ) {
|
|
|
|
|
|
+ function mergeBufferGeometries( geometries, useGroups = false ) {
|
|
|
|
|
|
- const geometry = geometries[ i ];
|
|
|
|
- let attributesCount = 0; // ensure that all geometries are indexed, or none
|
|
|
|
|
|
+ const isIndexed = geometries[ 0 ].index !== null;
|
|
|
|
+ const attributesUsed = new Set( Object.keys( geometries[ 0 ].attributes ) );
|
|
|
|
+ const morphAttributesUsed = new Set( Object.keys( geometries[ 0 ].morphAttributes ) );
|
|
|
|
+ const attributes = {};
|
|
|
|
+ const morphAttributes = {};
|
|
|
|
+ const morphTargetsRelative = geometries[ 0 ].morphTargetsRelative;
|
|
|
|
+ const mergedGeometry = new THREE.BufferGeometry();
|
|
|
|
+ let offset = 0;
|
|
|
|
|
|
- if ( isIndexed !== ( geometry.index !== null ) ) {
|
|
|
|
|
|
+ for ( let i = 0; i < geometries.length; ++ i ) {
|
|
|
|
|
|
- console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them.' );
|
|
|
|
- return null;
|
|
|
|
|
|
+ const geometry = geometries[ i ];
|
|
|
|
+ let attributesCount = 0; // ensure that all geometries are indexed, or none
|
|
|
|
|
|
- } // gather attributes, exit early if they're different
|
|
|
|
|
|
+ if ( isIndexed !== ( geometry.index !== null ) ) {
|
|
|
|
|
|
|
|
+ console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them.' );
|
|
|
|
+ return null;
|
|
|
|
|
|
- for ( const name in geometry.attributes ) {
|
|
|
|
|
|
+ } // gather attributes, exit early if they're different
|
|
|
|
|
|
- if ( ! attributesUsed.has( name ) ) {
|
|
|
|
|
|
|
|
- console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. All geometries must have compatible attributes; make sure "' + name + '" attribute exists among all geometries, or in none of them.' );
|
|
|
|
- return null;
|
|
|
|
|
|
+ for ( const name in geometry.attributes ) {
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ if ( ! attributesUsed.has( name ) ) {
|
|
|
|
|
|
- if ( attributes[ name ] === undefined ) attributes[ name ] = [];
|
|
|
|
- attributes[ name ].push( geometry.attributes[ name ] );
|
|
|
|
- attributesCount ++;
|
|
|
|
|
|
+ console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. All geometries must have compatible attributes; make sure "' + name + '" attribute exists among all geometries, or in none of them.' );
|
|
|
|
+ return null;
|
|
|
|
|
|
- } // ensure geometries have the same number of attributes
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ if ( attributes[ name ] === undefined ) attributes[ name ] = [];
|
|
|
|
+ attributes[ name ].push( geometry.attributes[ name ] );
|
|
|
|
+ attributesCount ++;
|
|
|
|
|
|
- if ( attributesCount !== attributesUsed.size ) {
|
|
|
|
|
|
+ } // ensure geometries have the same number of attributes
|
|
|
|
|
|
- console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. Make sure all geometries have the same number of attributes.' );
|
|
|
|
- return null;
|
|
|
|
|
|
|
|
- } // gather morph attributes, exit early if they're different
|
|
|
|
|
|
+ if ( attributesCount !== attributesUsed.size ) {
|
|
|
|
|
|
|
|
+ console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. Make sure all geometries have the same number of attributes.' );
|
|
|
|
+ return null;
|
|
|
|
|
|
- if ( morphTargetsRelative !== geometry.morphTargetsRelative ) {
|
|
|
|
|
|
+ } // gather morph attributes, exit early if they're different
|
|
|
|
|
|
- console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. .morphTargetsRelative must be consistent throughout all geometries.' );
|
|
|
|
- return null;
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ if ( morphTargetsRelative !== geometry.morphTargetsRelative ) {
|
|
|
|
|
|
- for ( const name in geometry.morphAttributes ) {
|
|
|
|
|
|
+ console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. .morphTargetsRelative must be consistent throughout all geometries.' );
|
|
|
|
+ return null;
|
|
|
|
|
|
- if ( ! morphAttributesUsed.has( name ) ) {
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. .morphAttributes must be consistent throughout all geometries.' );
|
|
|
|
- return null;
|
|
|
|
|
|
+ for ( const name in geometry.morphAttributes ) {
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ if ( ! morphAttributesUsed.has( name ) ) {
|
|
|
|
|
|
- if ( morphAttributes[ name ] === undefined ) morphAttributes[ name ] = [];
|
|
|
|
- morphAttributes[ name ].push( geometry.morphAttributes[ name ] );
|
|
|
|
|
|
+ console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. .morphAttributes must be consistent throughout all geometries.' );
|
|
|
|
+ return null;
|
|
|
|
|
|
- } // gather .userData
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ if ( morphAttributes[ name ] === undefined ) morphAttributes[ name ] = [];
|
|
|
|
+ morphAttributes[ name ].push( geometry.morphAttributes[ name ] );
|
|
|
|
|
|
- mergedGeometry.userData.mergedUserData = mergedGeometry.userData.mergedUserData || [];
|
|
|
|
- mergedGeometry.userData.mergedUserData.push( geometry.userData );
|
|
|
|
|
|
+ } // gather .userData
|
|
|
|
|
|
- if ( useGroups ) {
|
|
|
|
|
|
|
|
- let count;
|
|
|
|
|
|
+ mergedGeometry.userData.mergedUserData = mergedGeometry.userData.mergedUserData || [];
|
|
|
|
+ mergedGeometry.userData.mergedUserData.push( geometry.userData );
|
|
|
|
|
|
- if ( isIndexed ) {
|
|
|
|
|
|
+ if ( useGroups ) {
|
|
|
|
|
|
- count = geometry.index.count;
|
|
|
|
|
|
+ let count;
|
|
|
|
|
|
- } else if ( geometry.attributes.position !== undefined ) {
|
|
|
|
|
|
+ if ( isIndexed ) {
|
|
|
|
|
|
- count = geometry.attributes.position.count;
|
|
|
|
|
|
+ count = geometry.index.count;
|
|
|
|
|
|
- } else {
|
|
|
|
|
|
+ } else if ( geometry.attributes.position !== undefined ) {
|
|
|
|
|
|
- console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. The geometry must have either an index or a position attribute' );
|
|
|
|
- return null;
|
|
|
|
|
|
+ count = geometry.attributes.position.count;
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ } else {
|
|
|
|
|
|
- mergedGeometry.addGroup( offset, count, i );
|
|
|
|
- offset += count;
|
|
|
|
|
|
+ console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. The geometry must have either an index or a position attribute' );
|
|
|
|
+ return null;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- } // merge indices
|
|
|
|
|
|
+ mergedGeometry.addGroup( offset, count, i );
|
|
|
|
+ offset += count;
|
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- if ( isIndexed ) {
|
|
|
|
|
|
+ } // merge indices
|
|
|
|
|
|
- let indexOffset = 0;
|
|
|
|
- const mergedIndex = [];
|
|
|
|
|
|
|
|
- for ( let i = 0; i < geometries.length; ++ i ) {
|
|
|
|
|
|
+ if ( isIndexed ) {
|
|
|
|
|
|
- const index = geometries[ i ].index;
|
|
|
|
|
|
+ let indexOffset = 0;
|
|
|
|
+ const mergedIndex = [];
|
|
|
|
|
|
- for ( let j = 0; j < index.count; ++ j ) {
|
|
|
|
|
|
+ for ( let i = 0; i < geometries.length; ++ i ) {
|
|
|
|
|
|
- mergedIndex.push( index.getX( j ) + indexOffset );
|
|
|
|
|
|
+ const index = geometries[ i ].index;
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ for ( let j = 0; j < index.count; ++ j ) {
|
|
|
|
|
|
- indexOffset += geometries[ i ].attributes.position.count;
|
|
|
|
|
|
+ mergedIndex.push( index.getX( j ) + indexOffset );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- mergedGeometry.setIndex( mergedIndex );
|
|
|
|
|
|
+ indexOffset += geometries[ i ].attributes.position.count;
|
|
|
|
|
|
- } // merge attributes
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ mergedGeometry.setIndex( mergedIndex );
|
|
|
|
|
|
- for ( const name in attributes ) {
|
|
|
|
|
|
+ } // merge attributes
|
|
|
|
|
|
- const mergedAttribute = this.mergeBufferAttributes( attributes[ name ] );
|
|
|
|
|
|
|
|
- if ( ! mergedAttribute ) {
|
|
|
|
|
|
+ for ( const name in attributes ) {
|
|
|
|
|
|
- console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the ' + name + ' attribute.' );
|
|
|
|
- return null;
|
|
|
|
|
|
+ const mergedAttribute = mergeBufferAttributes( attributes[ name ] );
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ if ( ! mergedAttribute ) {
|
|
|
|
|
|
- mergedGeometry.setAttribute( name, mergedAttribute );
|
|
|
|
|
|
+ console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the ' + name + ' attribute.' );
|
|
|
|
+ return null;
|
|
|
|
|
|
- } // merge morph attributes
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ mergedGeometry.setAttribute( name, mergedAttribute );
|
|
|
|
|
|
- for ( const name in morphAttributes ) {
|
|
|
|
|
|
+ } // merge morph attributes
|
|
|
|
|
|
- const numMorphTargets = morphAttributes[ name ][ 0 ].length;
|
|
|
|
- if ( numMorphTargets === 0 ) break;
|
|
|
|
- mergedGeometry.morphAttributes = mergedGeometry.morphAttributes || {};
|
|
|
|
- mergedGeometry.morphAttributes[ name ] = [];
|
|
|
|
|
|
|
|
- for ( let i = 0; i < numMorphTargets; ++ i ) {
|
|
|
|
|
|
+ for ( const name in morphAttributes ) {
|
|
|
|
|
|
- const morphAttributesToMerge = [];
|
|
|
|
|
|
+ const numMorphTargets = morphAttributes[ name ][ 0 ].length;
|
|
|
|
+ if ( numMorphTargets === 0 ) break;
|
|
|
|
+ mergedGeometry.morphAttributes = mergedGeometry.morphAttributes || {};
|
|
|
|
+ mergedGeometry.morphAttributes[ name ] = [];
|
|
|
|
|
|
- for ( let j = 0; j < morphAttributes[ name ].length; ++ j ) {
|
|
|
|
|
|
+ for ( let i = 0; i < numMorphTargets; ++ i ) {
|
|
|
|
|
|
- morphAttributesToMerge.push( morphAttributes[ name ][ j ][ i ] );
|
|
|
|
|
|
+ const morphAttributesToMerge = [];
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ for ( let j = 0; j < morphAttributes[ name ].length; ++ j ) {
|
|
|
|
|
|
- const mergedMorphAttribute = this.mergeBufferAttributes( morphAttributesToMerge );
|
|
|
|
|
|
+ morphAttributesToMerge.push( morphAttributes[ name ][ j ][ i ] );
|
|
|
|
|
|
- if ( ! mergedMorphAttribute ) {
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the ' + name + ' morphAttribute.' );
|
|
|
|
- return null;
|
|
|
|
|
|
+ const mergedMorphAttribute = mergeBufferAttributes( morphAttributesToMerge );
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ if ( ! mergedMorphAttribute ) {
|
|
|
|
|
|
- mergedGeometry.morphAttributes[ name ].push( mergedMorphAttribute );
|
|
|
|
|
|
+ console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the ' + name + ' morphAttribute.' );
|
|
|
|
+ return null;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ mergedGeometry.morphAttributes[ name ].push( mergedMorphAttribute );
|
|
|
|
|
|
- return mergedGeometry;
|
|
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|
|
- /**
|
|
|
|
- * @param {Array<BufferAttribute>} attributes
|
|
|
|
- * @return {BufferAttribute}
|
|
|
|
- */
|
|
|
|
|
|
|
|
|
|
+ return mergedGeometry;
|
|
|
|
|
|
- static mergeBufferAttributes( attributes ) {
|
|
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * @param {Array<BufferAttribute>} attributes
|
|
|
|
+ * @return {BufferAttribute}
|
|
|
|
+ */
|
|
|
|
|
|
- let TypedArray;
|
|
|
|
- let itemSize;
|
|
|
|
- let normalized;
|
|
|
|
- let arrayLength = 0;
|
|
|
|
|
|
|
|
- for ( let i = 0; i < attributes.length; ++ i ) {
|
|
|
|
|
|
+ function mergeBufferAttributes( attributes ) {
|
|
|
|
|
|
- const attribute = attributes[ i ];
|
|
|
|
|
|
+ let TypedArray;
|
|
|
|
+ let itemSize;
|
|
|
|
+ let normalized;
|
|
|
|
+ let arrayLength = 0;
|
|
|
|
|
|
- if ( attribute.isInterleavedBufferAttribute ) {
|
|
|
|
|
|
+ for ( let i = 0; i < attributes.length; ++ i ) {
|
|
|
|
|
|
- console.error( 'THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported.' );
|
|
|
|
- return null;
|
|
|
|
|
|
+ const attribute = attributes[ i ];
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ if ( attribute.isInterleavedBufferAttribute ) {
|
|
|
|
|
|
- if ( TypedArray === undefined ) TypedArray = attribute.array.constructor;
|
|
|
|
|
|
+ console.error( 'THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported.' );
|
|
|
|
+ return null;
|
|
|
|
|
|
- if ( TypedArray !== attribute.array.constructor ) {
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- console.error( 'THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. THREE.BufferAttribute.array must be of consistent array types across matching attributes.' );
|
|
|
|
- return null;
|
|
|
|
|
|
+ if ( TypedArray === undefined ) TypedArray = attribute.array.constructor;
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ if ( TypedArray !== attribute.array.constructor ) {
|
|
|
|
|
|
- if ( itemSize === undefined ) itemSize = attribute.itemSize;
|
|
|
|
|
|
+ console.error( 'THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. THREE.BufferAttribute.array must be of consistent array types across matching attributes.' );
|
|
|
|
+ return null;
|
|
|
|
|
|
- if ( itemSize !== attribute.itemSize ) {
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- console.error( 'THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. THREE.BufferAttribute.itemSize must be consistent across matching attributes.' );
|
|
|
|
- return null;
|
|
|
|
|
|
+ if ( itemSize === undefined ) itemSize = attribute.itemSize;
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ if ( itemSize !== attribute.itemSize ) {
|
|
|
|
|
|
- if ( normalized === undefined ) normalized = attribute.normalized;
|
|
|
|
|
|
+ console.error( 'THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. THREE.BufferAttribute.itemSize must be consistent across matching attributes.' );
|
|
|
|
+ return null;
|
|
|
|
|
|
- if ( normalized !== attribute.normalized ) {
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- console.error( 'THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. THREE.BufferAttribute.normalized must be consistent across matching attributes.' );
|
|
|
|
- return null;
|
|
|
|
|
|
+ if ( normalized === undefined ) normalized = attribute.normalized;
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ if ( normalized !== attribute.normalized ) {
|
|
|
|
|
|
- arrayLength += attribute.array.length;
|
|
|
|
|
|
+ console.error( 'THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. THREE.BufferAttribute.normalized must be consistent across matching attributes.' );
|
|
|
|
+ return null;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- const array = new TypedArray( arrayLength );
|
|
|
|
- let offset = 0;
|
|
|
|
|
|
+ arrayLength += attribute.array.length;
|
|
|
|
|
|
- for ( let i = 0; i < attributes.length; ++ i ) {
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- array.set( attributes[ i ].array, offset );
|
|
|
|
- offset += attributes[ i ].array.length;
|
|
|
|
|
|
+ const array = new TypedArray( arrayLength );
|
|
|
|
+ let offset = 0;
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ for ( let i = 0; i < attributes.length; ++ i ) {
|
|
|
|
|
|
- return new THREE.BufferAttribute( array, itemSize, normalized );
|
|
|
|
|
|
+ array.set( attributes[ i ].array, offset );
|
|
|
|
+ offset += attributes[ i ].array.length;
|
|
|
|
|
|
}
|
|
}
|
|
- /**
|
|
|
|
- * @param {Array<BufferAttribute>} attributes
|
|
|
|
- * @return {Array<InterleavedBufferAttribute>}
|
|
|
|
- */
|
|
|
|
|
|
|
|
|
|
+ return new THREE.BufferAttribute( array, itemSize, normalized );
|
|
|
|
|
|
- static interleaveAttributes( attributes ) {
|
|
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * @param {Array<BufferAttribute>} attributes
|
|
|
|
+ * @return {Array<InterleavedBufferAttribute>}
|
|
|
|
+ */
|
|
|
|
|
|
- // Interleaves the provided attributes into an THREE.InterleavedBuffer and returns
|
|
|
|
- // a set of InterleavedBufferAttributes for each attribute
|
|
|
|
- let TypedArray;
|
|
|
|
- let arrayLength = 0;
|
|
|
|
- let stride = 0; // calculate the the length and type of the interleavedBuffer
|
|
|
|
|
|
|
|
- for ( let i = 0, l = attributes.length; i < l; ++ i ) {
|
|
|
|
|
|
+ function interleaveAttributes( attributes ) {
|
|
|
|
|
|
- const attribute = attributes[ i ];
|
|
|
|
- if ( TypedArray === undefined ) TypedArray = attribute.array.constructor;
|
|
|
|
|
|
+ // Interleaves the provided attributes into an THREE.InterleavedBuffer and returns
|
|
|
|
+ // a set of InterleavedBufferAttributes for each attribute
|
|
|
|
+ let TypedArray;
|
|
|
|
+ let arrayLength = 0;
|
|
|
|
+ let stride = 0; // calculate the the length and type of the interleavedBuffer
|
|
|
|
|
|
- if ( TypedArray !== attribute.array.constructor ) {
|
|
|
|
|
|
+ for ( let i = 0, l = attributes.length; i < l; ++ i ) {
|
|
|
|
|
|
- console.error( 'AttributeBuffers of different types cannot be interleaved' );
|
|
|
|
- return null;
|
|
|
|
|
|
+ const attribute = attributes[ i ];
|
|
|
|
+ if ( TypedArray === undefined ) TypedArray = attribute.array.constructor;
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ if ( TypedArray !== attribute.array.constructor ) {
|
|
|
|
|
|
- arrayLength += attribute.array.length;
|
|
|
|
- stride += attribute.itemSize;
|
|
|
|
|
|
+ console.error( 'AttributeBuffers of different types cannot be interleaved' );
|
|
|
|
+ return null;
|
|
|
|
|
|
- } // Create the set of buffer attributes
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ arrayLength += attribute.array.length;
|
|
|
|
+ stride += attribute.itemSize;
|
|
|
|
|
|
- const interleavedBuffer = new THREE.InterleavedBuffer( new TypedArray( arrayLength ), stride );
|
|
|
|
- let offset = 0;
|
|
|
|
- const res = [];
|
|
|
|
- const getters = [ 'getX', 'getY', 'getZ', 'getW' ];
|
|
|
|
- const setters = [ 'setX', 'setY', 'setZ', 'setW' ];
|
|
|
|
|
|
+ } // Create the set of buffer attributes
|
|
|
|
|
|
- for ( let j = 0, l = attributes.length; j < l; j ++ ) {
|
|
|
|
|
|
|
|
- const attribute = attributes[ j ];
|
|
|
|
- const itemSize = attribute.itemSize;
|
|
|
|
- const count = attribute.count;
|
|
|
|
- const iba = new THREE.InterleavedBufferAttribute( interleavedBuffer, itemSize, offset, attribute.normalized );
|
|
|
|
- res.push( iba );
|
|
|
|
- offset += itemSize; // Move the data for each attribute into the new interleavedBuffer
|
|
|
|
- // at the appropriate offset
|
|
|
|
|
|
+ const interleavedBuffer = new THREE.InterleavedBuffer( new TypedArray( arrayLength ), stride );
|
|
|
|
+ let offset = 0;
|
|
|
|
+ const res = [];
|
|
|
|
+ const getters = [ 'getX', 'getY', 'getZ', 'getW' ];
|
|
|
|
+ const setters = [ 'setX', 'setY', 'setZ', 'setW' ];
|
|
|
|
|
|
- for ( let c = 0; c < count; c ++ ) {
|
|
|
|
|
|
+ for ( let j = 0, l = attributes.length; j < l; j ++ ) {
|
|
|
|
|
|
- for ( let k = 0; k < itemSize; k ++ ) {
|
|
|
|
|
|
+ const attribute = attributes[ j ];
|
|
|
|
+ const itemSize = attribute.itemSize;
|
|
|
|
+ const count = attribute.count;
|
|
|
|
+ const iba = new THREE.InterleavedBufferAttribute( interleavedBuffer, itemSize, offset, attribute.normalized );
|
|
|
|
+ res.push( iba );
|
|
|
|
+ offset += itemSize; // Move the data for each attribute into the new interleavedBuffer
|
|
|
|
+ // at the appropriate offset
|
|
|
|
|
|
- iba[ setters[ k ] ]( c, attribute[ getters[ k ] ]( c ) );
|
|
|
|
|
|
+ for ( let c = 0; c < count; c ++ ) {
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ for ( let k = 0; k < itemSize; k ++ ) {
|
|
|
|
+
|
|
|
|
+ iba[ setters[ k ] ]( c, attribute[ getters[ k ] ]( c ) );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- return res;
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
- /**
|
|
|
|
- * @param {Array<BufferGeometry>} geometry
|
|
|
|
- * @return {number}
|
|
|
|
- */
|
|
|
|
|
|
|
|
|
|
+ return res;
|
|
|
|
|
|
- static estimateBytesUsed( geometry ) {
|
|
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * @param {Array<BufferGeometry>} geometry
|
|
|
|
+ * @return {number}
|
|
|
|
+ */
|
|
|
|
|
|
- // Return the estimated memory used by this geometry in bytes
|
|
|
|
- // Calculate using itemSize, count, and BYTES_PER_ELEMENT to account
|
|
|
|
- // for InterleavedBufferAttributes.
|
|
|
|
- let mem = 0;
|
|
|
|
|
|
|
|
- for ( const name in geometry.attributes ) {
|
|
|
|
|
|
+ function estimateBytesUsed( geometry ) {
|
|
|
|
|
|
- const attr = geometry.getAttribute( name );
|
|
|
|
- mem += attr.count * attr.itemSize * attr.array.BYTES_PER_ELEMENT;
|
|
|
|
|
|
+ // Return the estimated memory used by this geometry in bytes
|
|
|
|
+ // Calculate using itemSize, count, and BYTES_PER_ELEMENT to account
|
|
|
|
+ // for InterleavedBufferAttributes.
|
|
|
|
+ let mem = 0;
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ for ( const name in geometry.attributes ) {
|
|
|
|
|
|
- const indices = geometry.getIndex();
|
|
|
|
- mem += indices ? indices.count * indices.itemSize * indices.array.BYTES_PER_ELEMENT : 0;
|
|
|
|
- return mem;
|
|
|
|
|
|
+ const attr = geometry.getAttribute( name );
|
|
|
|
+ mem += attr.count * attr.itemSize * attr.array.BYTES_PER_ELEMENT;
|
|
|
|
|
|
}
|
|
}
|
|
- /**
|
|
|
|
- * @param {BufferGeometry} geometry
|
|
|
|
- * @param {number} tolerance
|
|
|
|
- * @return {BufferGeometry>}
|
|
|
|
- */
|
|
|
|
|
|
|
|
|
|
+ const indices = geometry.getIndex();
|
|
|
|
+ mem += indices ? indices.count * indices.itemSize * indices.array.BYTES_PER_ELEMENT : 0;
|
|
|
|
+ return mem;
|
|
|
|
|
|
- static mergeVertices( geometry, tolerance = 1e-4 ) {
|
|
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * @param {BufferGeometry} geometry
|
|
|
|
+ * @param {number} tolerance
|
|
|
|
+ * @return {BufferGeometry>}
|
|
|
|
+ */
|
|
|
|
|
|
- tolerance = Math.max( tolerance, Number.EPSILON ); // Generate an index buffer if the geometry doesn't have one, or optimize it
|
|
|
|
- // if it's already available.
|
|
|
|
|
|
|
|
- const hashToIndex = {};
|
|
|
|
- const indices = geometry.getIndex();
|
|
|
|
- const positions = geometry.getAttribute( 'position' );
|
|
|
|
- const vertexCount = indices ? indices.count : positions.count; // next value for triangle indices
|
|
|
|
|
|
+ function mergeVertices( geometry, tolerance = 1e-4 ) {
|
|
|
|
|
|
- let nextIndex = 0; // attributes and new attribute arrays
|
|
|
|
|
|
+ tolerance = Math.max( tolerance, Number.EPSILON ); // Generate an index buffer if the geometry doesn't have one, or optimize it
|
|
|
|
+ // if it's already available.
|
|
|
|
|
|
- const attributeNames = Object.keys( geometry.attributes );
|
|
|
|
- const attrArrays = {};
|
|
|
|
- const morphAttrsArrays = {};
|
|
|
|
- const newIndices = [];
|
|
|
|
- const getters = [ 'getX', 'getY', 'getZ', 'getW' ]; // initialize the arrays
|
|
|
|
|
|
+ const hashToIndex = {};
|
|
|
|
+ const indices = geometry.getIndex();
|
|
|
|
+ const positions = geometry.getAttribute( 'position' );
|
|
|
|
+ const vertexCount = indices ? indices.count : positions.count; // next value for triangle indices
|
|
|
|
|
|
- for ( let i = 0, l = attributeNames.length; i < l; i ++ ) {
|
|
|
|
|
|
+ let nextIndex = 0; // attributes and new attribute arrays
|
|
|
|
|
|
- const name = attributeNames[ i ];
|
|
|
|
- attrArrays[ name ] = [];
|
|
|
|
- const morphAttr = geometry.morphAttributes[ name ];
|
|
|
|
|
|
+ const attributeNames = Object.keys( geometry.attributes );
|
|
|
|
+ const attrArrays = {};
|
|
|
|
+ const morphAttrsArrays = {};
|
|
|
|
+ const newIndices = [];
|
|
|
|
+ const getters = [ 'getX', 'getY', 'getZ', 'getW' ]; // initialize the arrays
|
|
|
|
|
|
- if ( morphAttr ) {
|
|
|
|
|
|
+ for ( let i = 0, l = attributeNames.length; i < l; i ++ ) {
|
|
|
|
|
|
- morphAttrsArrays[ name ] = new Array( morphAttr.length ).fill().map( () => [] );
|
|
|
|
|
|
+ const name = attributeNames[ i ];
|
|
|
|
+ attrArrays[ name ] = [];
|
|
|
|
+ const morphAttr = geometry.morphAttributes[ name ];
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ if ( morphAttr ) {
|
|
|
|
|
|
- } // convert the error tolerance to an amount of decimal places to truncate to
|
|
|
|
|
|
+ morphAttrsArrays[ name ] = new Array( morphAttr.length ).fill().map( () => [] );
|
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- const decimalShift = Math.log10( 1 / tolerance );
|
|
|
|
- const shiftMultiplier = Math.pow( 10, decimalShift );
|
|
|
|
|
|
+ } // convert the error tolerance to an amount of decimal places to truncate to
|
|
|
|
|
|
- for ( let i = 0; i < vertexCount; i ++ ) {
|
|
|
|
|
|
|
|
- const index = indices ? indices.getX( i ) : i; // Generate a hash for the vertex attributes at the current index 'i'
|
|
|
|
|
|
+ const decimalShift = Math.log10( 1 / tolerance );
|
|
|
|
+ const shiftMultiplier = Math.pow( 10, decimalShift );
|
|
|
|
|
|
- let hash = '';
|
|
|
|
|
|
+ for ( let i = 0; i < vertexCount; i ++ ) {
|
|
|
|
|
|
- for ( let j = 0, l = attributeNames.length; j < l; j ++ ) {
|
|
|
|
|
|
+ const index = indices ? indices.getX( i ) : i; // Generate a hash for the vertex attributes at the current index 'i'
|
|
|
|
|
|
- const name = attributeNames[ j ];
|
|
|
|
- const attribute = geometry.getAttribute( name );
|
|
|
|
- const itemSize = attribute.itemSize;
|
|
|
|
|
|
+ let hash = '';
|
|
|
|
|
|
- for ( let k = 0; k < itemSize; k ++ ) {
|
|
|
|
|
|
+ for ( let j = 0, l = attributeNames.length; j < l; j ++ ) {
|
|
|
|
|
|
- // double tilde truncates the decimal value
|
|
|
|
- hash += `${~ ~ ( attribute[ getters[ k ] ]( index ) * shiftMultiplier )},`;
|
|
|
|
|
|
+ const name = attributeNames[ j ];
|
|
|
|
+ const attribute = geometry.getAttribute( name );
|
|
|
|
+ const itemSize = attribute.itemSize;
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ for ( let k = 0; k < itemSize; k ++ ) {
|
|
|
|
|
|
- } // Add another reference to the vertex if it's already
|
|
|
|
- // used by another index
|
|
|
|
|
|
+ // double tilde truncates the decimal value
|
|
|
|
+ hash += `${~ ~ ( attribute[ getters[ k ] ]( index ) * shiftMultiplier )},`;
|
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- if ( hash in hashToIndex ) {
|
|
|
|
|
|
+ } // Add another reference to the vertex if it's already
|
|
|
|
+ // used by another index
|
|
|
|
|
|
- newIndices.push( hashToIndex[ hash ] );
|
|
|
|
|
|
|
|
- } else {
|
|
|
|
|
|
+ if ( hash in hashToIndex ) {
|
|
|
|
|
|
- // copy data to the new index in the attribute arrays
|
|
|
|
- for ( let j = 0, l = attributeNames.length; j < l; j ++ ) {
|
|
|
|
|
|
+ newIndices.push( hashToIndex[ hash ] );
|
|
|
|
|
|
- const name = attributeNames[ j ];
|
|
|
|
- const attribute = geometry.getAttribute( name );
|
|
|
|
- const morphAttr = geometry.morphAttributes[ name ];
|
|
|
|
- const itemSize = attribute.itemSize;
|
|
|
|
- const newarray = attrArrays[ name ];
|
|
|
|
- const newMorphArrays = morphAttrsArrays[ name ];
|
|
|
|
|
|
+ } else {
|
|
|
|
|
|
- for ( let k = 0; k < itemSize; k ++ ) {
|
|
|
|
|
|
+ // copy data to the new index in the attribute arrays
|
|
|
|
+ for ( let j = 0, l = attributeNames.length; j < l; j ++ ) {
|
|
|
|
|
|
- const getterFunc = getters[ k ];
|
|
|
|
- newarray.push( attribute[ getterFunc ]( index ) );
|
|
|
|
|
|
+ const name = attributeNames[ j ];
|
|
|
|
+ const attribute = geometry.getAttribute( name );
|
|
|
|
+ const morphAttr = geometry.morphAttributes[ name ];
|
|
|
|
+ const itemSize = attribute.itemSize;
|
|
|
|
+ const newarray = attrArrays[ name ];
|
|
|
|
+ const newMorphArrays = morphAttrsArrays[ name ];
|
|
|
|
|
|
- if ( morphAttr ) {
|
|
|
|
|
|
+ for ( let k = 0; k < itemSize; k ++ ) {
|
|
|
|
|
|
- for ( let m = 0, ml = morphAttr.length; m < ml; m ++ ) {
|
|
|
|
|
|
+ const getterFunc = getters[ k ];
|
|
|
|
+ newarray.push( attribute[ getterFunc ]( index ) );
|
|
|
|
|
|
- newMorphArrays[ m ].push( morphAttr[ m ][ getterFunc ]( index ) );
|
|
|
|
|
|
+ if ( morphAttr ) {
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ for ( let m = 0, ml = morphAttr.length; m < ml; m ++ ) {
|
|
|
|
+
|
|
|
|
+ newMorphArrays[ m ].push( morphAttr[ m ][ getterFunc ]( index ) );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -447,384 +443,392 @@
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- hashToIndex[ hash ] = nextIndex;
|
|
|
|
- newIndices.push( nextIndex );
|
|
|
|
- nextIndex ++;
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- } // Generate typed arrays from new attribute arrays and update
|
|
|
|
- // the attributeBuffers
|
|
|
|
|
|
+ hashToIndex[ hash ] = nextIndex;
|
|
|
|
+ newIndices.push( nextIndex );
|
|
|
|
+ nextIndex ++;
|
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- const result = geometry.clone();
|
|
|
|
|
|
+ } // Generate typed arrays from new attribute arrays and update
|
|
|
|
+ // the attributeBuffers
|
|
|
|
|
|
- for ( let i = 0, l = attributeNames.length; i < l; i ++ ) {
|
|
|
|
|
|
|
|
- const name = attributeNames[ i ];
|
|
|
|
- const oldAttribute = geometry.getAttribute( name );
|
|
|
|
- const buffer = new oldAttribute.array.constructor( attrArrays[ name ] );
|
|
|
|
- const attribute = new THREE.BufferAttribute( buffer, oldAttribute.itemSize, oldAttribute.normalized );
|
|
|
|
- result.setAttribute( name, attribute ); // Update the attribute arrays
|
|
|
|
|
|
+ const result = geometry.clone();
|
|
|
|
|
|
- if ( name in morphAttrsArrays ) {
|
|
|
|
|
|
+ for ( let i = 0, l = attributeNames.length; i < l; i ++ ) {
|
|
|
|
|
|
- for ( let j = 0; j < morphAttrsArrays[ name ].length; j ++ ) {
|
|
|
|
|
|
+ const name = attributeNames[ i ];
|
|
|
|
+ const oldAttribute = geometry.getAttribute( name );
|
|
|
|
+ const buffer = new oldAttribute.array.constructor( attrArrays[ name ] );
|
|
|
|
+ const attribute = new THREE.BufferAttribute( buffer, oldAttribute.itemSize, oldAttribute.normalized );
|
|
|
|
+ result.setAttribute( name, attribute ); // Update the attribute arrays
|
|
|
|
|
|
- const oldMorphAttribute = geometry.morphAttributes[ name ][ j ];
|
|
|
|
- const buffer = new oldMorphAttribute.array.constructor( morphAttrsArrays[ name ][ j ] );
|
|
|
|
- const morphAttribute = new THREE.BufferAttribute( buffer, oldMorphAttribute.itemSize, oldMorphAttribute.normalized );
|
|
|
|
- result.morphAttributes[ name ][ j ] = morphAttribute;
|
|
|
|
|
|
+ if ( name in morphAttrsArrays ) {
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ for ( let j = 0; j < morphAttrsArrays[ name ].length; j ++ ) {
|
|
|
|
+
|
|
|
|
+ const oldMorphAttribute = geometry.morphAttributes[ name ][ j ];
|
|
|
|
+ const buffer = new oldMorphAttribute.array.constructor( morphAttrsArrays[ name ][ j ] );
|
|
|
|
+ const morphAttribute = new THREE.BufferAttribute( buffer, oldMorphAttribute.itemSize, oldMorphAttribute.normalized );
|
|
|
|
+ result.morphAttributes[ name ][ j ] = morphAttribute;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- } // indices
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ } // indices
|
|
|
|
|
|
- result.setIndex( newIndices );
|
|
|
|
- return result;
|
|
|
|
|
|
|
|
- }
|
|
|
|
- /**
|
|
|
|
- * @param {BufferGeometry} geometry
|
|
|
|
- * @param {number} drawMode
|
|
|
|
- * @return {BufferGeometry>}
|
|
|
|
- */
|
|
|
|
|
|
+ result.setIndex( newIndices );
|
|
|
|
+ return result;
|
|
|
|
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * @param {BufferGeometry} geometry
|
|
|
|
+ * @param {number} drawMode
|
|
|
|
+ * @return {BufferGeometry>}
|
|
|
|
+ */
|
|
|
|
|
|
- static toTrianglesDrawMode( geometry, drawMode ) {
|
|
|
|
|
|
|
|
- if ( drawMode === THREE.TrianglesDrawMode ) {
|
|
|
|
|
|
+ function toTrianglesDrawMode( geometry, drawMode ) {
|
|
|
|
|
|
- console.warn( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.' );
|
|
|
|
- return geometry;
|
|
|
|
|
|
+ if ( drawMode === THREE.TrianglesDrawMode ) {
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ console.warn( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.' );
|
|
|
|
+ return geometry;
|
|
|
|
|
|
- if ( drawMode === THREE.TriangleFanDrawMode || drawMode === THREE.TriangleStripDrawMode ) {
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- let index = geometry.getIndex(); // generate index if not present
|
|
|
|
|
|
+ if ( drawMode === THREE.TriangleFanDrawMode || drawMode === THREE.TriangleStripDrawMode ) {
|
|
|
|
|
|
- if ( index === null ) {
|
|
|
|
|
|
+ let index = geometry.getIndex(); // generate index if not present
|
|
|
|
|
|
- const indices = [];
|
|
|
|
- const position = geometry.getAttribute( 'position' );
|
|
|
|
|
|
+ if ( index === null ) {
|
|
|
|
|
|
- if ( position !== undefined ) {
|
|
|
|
|
|
+ const indices = [];
|
|
|
|
+ const position = geometry.getAttribute( 'position' );
|
|
|
|
|
|
- for ( let i = 0; i < position.count; i ++ ) {
|
|
|
|
|
|
+ if ( position !== undefined ) {
|
|
|
|
|
|
- indices.push( i );
|
|
|
|
|
|
+ for ( let i = 0; i < position.count; i ++ ) {
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ indices.push( i );
|
|
|
|
|
|
- geometry.setIndex( indices );
|
|
|
|
- index = geometry.getIndex();
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- } else {
|
|
|
|
|
|
+ geometry.setIndex( indices );
|
|
|
|
+ index = geometry.getIndex();
|
|
|
|
|
|
- console.error( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible.' );
|
|
|
|
- return geometry;
|
|
|
|
|
|
+ } else {
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ console.error( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible.' );
|
|
|
|
+ return geometry;
|
|
|
|
|
|
- } //
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ } //
|
|
|
|
|
|
- const numberOfTriangles = index.count - 2;
|
|
|
|
- const newIndices = [];
|
|
|
|
|
|
|
|
- if ( drawMode === THREE.TriangleFanDrawMode ) {
|
|
|
|
|
|
+ const numberOfTriangles = index.count - 2;
|
|
|
|
+ const newIndices = [];
|
|
|
|
|
|
- // gl.TRIANGLE_FAN
|
|
|
|
- for ( let i = 1; i <= numberOfTriangles; i ++ ) {
|
|
|
|
|
|
+ if ( drawMode === THREE.TriangleFanDrawMode ) {
|
|
|
|
|
|
- newIndices.push( index.getX( 0 ) );
|
|
|
|
- newIndices.push( index.getX( i ) );
|
|
|
|
- newIndices.push( index.getX( i + 1 ) );
|
|
|
|
|
|
+ // gl.TRIANGLE_FAN
|
|
|
|
+ for ( let i = 1; i <= numberOfTriangles; i ++ ) {
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ newIndices.push( index.getX( 0 ) );
|
|
|
|
+ newIndices.push( index.getX( i ) );
|
|
|
|
+ newIndices.push( index.getX( i + 1 ) );
|
|
|
|
|
|
- } else {
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- // gl.TRIANGLE_STRIP
|
|
|
|
- for ( let i = 0; i < numberOfTriangles; i ++ ) {
|
|
|
|
|
|
+ } else {
|
|
|
|
|
|
- if ( i % 2 === 0 ) {
|
|
|
|
|
|
+ // gl.TRIANGLE_STRIP
|
|
|
|
+ for ( let i = 0; i < numberOfTriangles; i ++ ) {
|
|
|
|
|
|
- newIndices.push( index.getX( i ) );
|
|
|
|
- newIndices.push( index.getX( i + 1 ) );
|
|
|
|
- newIndices.push( index.getX( i + 2 ) );
|
|
|
|
|
|
+ if ( i % 2 === 0 ) {
|
|
|
|
|
|
- } else {
|
|
|
|
|
|
+ newIndices.push( index.getX( i ) );
|
|
|
|
+ newIndices.push( index.getX( i + 1 ) );
|
|
|
|
+ newIndices.push( index.getX( i + 2 ) );
|
|
|
|
|
|
- newIndices.push( index.getX( i + 2 ) );
|
|
|
|
- newIndices.push( index.getX( i + 1 ) );
|
|
|
|
- newIndices.push( index.getX( i ) );
|
|
|
|
|
|
+ } else {
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ newIndices.push( index.getX( i + 2 ) );
|
|
|
|
+ newIndices.push( index.getX( i + 1 ) );
|
|
|
|
+ newIndices.push( index.getX( i ) );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- if ( newIndices.length / 3 !== numberOfTriangles ) {
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- console.error( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.' );
|
|
|
|
|
|
+ if ( newIndices.length / 3 !== numberOfTriangles ) {
|
|
|
|
|
|
- } // build final geometry
|
|
|
|
|
|
+ console.error( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.' );
|
|
|
|
|
|
|
|
+ } // build final geometry
|
|
|
|
|
|
- const newGeometry = geometry.clone();
|
|
|
|
- newGeometry.setIndex( newIndices );
|
|
|
|
- newGeometry.clearGroups();
|
|
|
|
- return newGeometry;
|
|
|
|
|
|
|
|
- } else {
|
|
|
|
|
|
+ const newGeometry = geometry.clone();
|
|
|
|
+ newGeometry.setIndex( newIndices );
|
|
|
|
+ newGeometry.clearGroups();
|
|
|
|
+ return newGeometry;
|
|
|
|
|
|
- console.error( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:', drawMode );
|
|
|
|
- return geometry;
|
|
|
|
|
|
+ } else {
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ console.error( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:', drawMode );
|
|
|
|
+ return geometry;
|
|
|
|
|
|
}
|
|
}
|
|
- /**
|
|
|
|
- * Calculates the morphed attributes of a morphed/skinned THREE.BufferGeometry.
|
|
|
|
- * Helpful for Raytracing or Decals.
|
|
|
|
- * @param {Mesh | Line | Points} object An instance of Mesh, Line or Points.
|
|
|
|
- * @return {Object} An Object with original position/normal attributes and morphed ones.
|
|
|
|
- */
|
|
|
|
|
|
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * Calculates the morphed attributes of a morphed/skinned THREE.BufferGeometry.
|
|
|
|
+ * Helpful for Raytracing or Decals.
|
|
|
|
+ * @param {Mesh | Line | Points} object An instance of Mesh, Line or Points.
|
|
|
|
+ * @return {Object} An Object with original position/normal attributes and morphed ones.
|
|
|
|
+ */
|
|
|
|
|
|
- static computeMorphedAttributes( object ) {
|
|
|
|
|
|
|
|
- if ( object.geometry.isBufferGeometry !== true ) {
|
|
|
|
|
|
+ function computeMorphedAttributes( object ) {
|
|
|
|
|
|
- console.error( 'THREE.BufferGeometryUtils: Geometry is not of type THREE.BufferGeometry.' );
|
|
|
|
- return null;
|
|
|
|
|
|
+ if ( object.geometry.isBufferGeometry !== true ) {
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ console.error( 'THREE.BufferGeometryUtils: Geometry is not of type THREE.BufferGeometry.' );
|
|
|
|
+ return null;
|
|
|
|
|
|
- const _vA = new THREE.Vector3();
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- const _vB = new THREE.Vector3();
|
|
|
|
|
|
+ const _vA = new THREE.Vector3();
|
|
|
|
|
|
- const _vC = new THREE.Vector3();
|
|
|
|
|
|
+ const _vB = new THREE.Vector3();
|
|
|
|
|
|
- const _tempA = new THREE.Vector3();
|
|
|
|
|
|
+ const _vC = new THREE.Vector3();
|
|
|
|
|
|
- const _tempB = new THREE.Vector3();
|
|
|
|
|
|
+ const _tempA = new THREE.Vector3();
|
|
|
|
|
|
- const _tempC = new THREE.Vector3();
|
|
|
|
|
|
+ const _tempB = new THREE.Vector3();
|
|
|
|
|
|
- const _morphA = new THREE.Vector3();
|
|
|
|
|
|
+ const _tempC = new THREE.Vector3();
|
|
|
|
|
|
- const _morphB = new THREE.Vector3();
|
|
|
|
|
|
+ const _morphA = new THREE.Vector3();
|
|
|
|
|
|
- const _morphC = new THREE.Vector3();
|
|
|
|
|
|
+ const _morphB = new THREE.Vector3();
|
|
|
|
|
|
- function _calculateMorphedAttributeData( object, material, attribute, morphAttribute, morphTargetsRelative, a, b, c, modifiedAttributeArray ) {
|
|
|
|
|
|
+ const _morphC = new THREE.Vector3();
|
|
|
|
|
|
- _vA.fromBufferAttribute( attribute, a );
|
|
|
|
|
|
+ function _calculateMorphedAttributeData( object, material, attribute, morphAttribute, morphTargetsRelative, a, b, c, modifiedAttributeArray ) {
|
|
|
|
|
|
- _vB.fromBufferAttribute( attribute, b );
|
|
|
|
|
|
+ _vA.fromBufferAttribute( attribute, a );
|
|
|
|
|
|
- _vC.fromBufferAttribute( attribute, c );
|
|
|
|
|
|
+ _vB.fromBufferAttribute( attribute, b );
|
|
|
|
|
|
- const morphInfluences = object.morphTargetInfluences;
|
|
|
|
|
|
+ _vC.fromBufferAttribute( attribute, c );
|
|
|
|
|
|
- if ( material.morphTargets && morphAttribute && morphInfluences ) {
|
|
|
|
|
|
+ const morphInfluences = object.morphTargetInfluences;
|
|
|
|
|
|
- _morphA.set( 0, 0, 0 );
|
|
|
|
|
|
+ if ( material.morphTargets && morphAttribute && morphInfluences ) {
|
|
|
|
|
|
- _morphB.set( 0, 0, 0 );
|
|
|
|
|
|
+ _morphA.set( 0, 0, 0 );
|
|
|
|
|
|
- _morphC.set( 0, 0, 0 );
|
|
|
|
|
|
+ _morphB.set( 0, 0, 0 );
|
|
|
|
|
|
- for ( let i = 0, il = morphAttribute.length; i < il; i ++ ) {
|
|
|
|
|
|
+ _morphC.set( 0, 0, 0 );
|
|
|
|
|
|
- const influence = morphInfluences[ i ];
|
|
|
|
- const morph = morphAttribute[ i ];
|
|
|
|
- if ( influence === 0 ) continue;
|
|
|
|
|
|
+ for ( let i = 0, il = morphAttribute.length; i < il; i ++ ) {
|
|
|
|
|
|
- _tempA.fromBufferAttribute( morph, a );
|
|
|
|
|
|
+ const influence = morphInfluences[ i ];
|
|
|
|
+ const morph = morphAttribute[ i ];
|
|
|
|
+ if ( influence === 0 ) continue;
|
|
|
|
|
|
- _tempB.fromBufferAttribute( morph, b );
|
|
|
|
|
|
+ _tempA.fromBufferAttribute( morph, a );
|
|
|
|
|
|
- _tempC.fromBufferAttribute( morph, c );
|
|
|
|
|
|
+ _tempB.fromBufferAttribute( morph, b );
|
|
|
|
|
|
- if ( morphTargetsRelative ) {
|
|
|
|
|
|
+ _tempC.fromBufferAttribute( morph, c );
|
|
|
|
|
|
- _morphA.addScaledVector( _tempA, influence );
|
|
|
|
|
|
+ if ( morphTargetsRelative ) {
|
|
|
|
|
|
- _morphB.addScaledVector( _tempB, influence );
|
|
|
|
|
|
+ _morphA.addScaledVector( _tempA, influence );
|
|
|
|
|
|
- _morphC.addScaledVector( _tempC, influence );
|
|
|
|
|
|
+ _morphB.addScaledVector( _tempB, influence );
|
|
|
|
|
|
- } else {
|
|
|
|
|
|
+ _morphC.addScaledVector( _tempC, influence );
|
|
|
|
|
|
- _morphA.addScaledVector( _tempA.sub( _vA ), influence );
|
|
|
|
|
|
+ } else {
|
|
|
|
|
|
- _morphB.addScaledVector( _tempB.sub( _vB ), influence );
|
|
|
|
|
|
+ _morphA.addScaledVector( _tempA.sub( _vA ), influence );
|
|
|
|
|
|
- _morphC.addScaledVector( _tempC.sub( _vC ), influence );
|
|
|
|
|
|
+ _morphB.addScaledVector( _tempB.sub( _vB ), influence );
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ _morphC.addScaledVector( _tempC.sub( _vC ), influence );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- _vA.add( _morphA );
|
|
|
|
-
|
|
|
|
- _vB.add( _morphB );
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- _vC.add( _morphC );
|
|
|
|
|
|
+ _vA.add( _morphA );
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ _vB.add( _morphB );
|
|
|
|
|
|
- if ( object.isSkinnedMesh ) {
|
|
|
|
|
|
+ _vC.add( _morphC );
|
|
|
|
|
|
- object.boneTransform( a, _vA );
|
|
|
|
- object.boneTransform( b, _vB );
|
|
|
|
- object.boneTransform( c, _vC );
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ if ( object.isSkinnedMesh ) {
|
|
|
|
|
|
- modifiedAttributeArray[ a * 3 + 0 ] = _vA.x;
|
|
|
|
- modifiedAttributeArray[ a * 3 + 1 ] = _vA.y;
|
|
|
|
- modifiedAttributeArray[ a * 3 + 2 ] = _vA.z;
|
|
|
|
- modifiedAttributeArray[ b * 3 + 0 ] = _vB.x;
|
|
|
|
- modifiedAttributeArray[ b * 3 + 1 ] = _vB.y;
|
|
|
|
- modifiedAttributeArray[ b * 3 + 2 ] = _vB.z;
|
|
|
|
- modifiedAttributeArray[ c * 3 + 0 ] = _vC.x;
|
|
|
|
- modifiedAttributeArray[ c * 3 + 1 ] = _vC.y;
|
|
|
|
- modifiedAttributeArray[ c * 3 + 2 ] = _vC.z;
|
|
|
|
|
|
+ object.boneTransform( a, _vA );
|
|
|
|
+ object.boneTransform( b, _vB );
|
|
|
|
+ object.boneTransform( c, _vC );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- const geometry = object.geometry;
|
|
|
|
- const material = object.material;
|
|
|
|
- let a, b, c;
|
|
|
|
- const index = geometry.index;
|
|
|
|
- const positionAttribute = geometry.attributes.position;
|
|
|
|
- const morphPosition = geometry.morphAttributes.position;
|
|
|
|
- const morphTargetsRelative = geometry.morphTargetsRelative;
|
|
|
|
- const normalAttribute = geometry.attributes.normal;
|
|
|
|
- const morphNormal = geometry.morphAttributes.position;
|
|
|
|
- const groups = geometry.groups;
|
|
|
|
- const drawRange = geometry.drawRange;
|
|
|
|
- let i, j, il, jl;
|
|
|
|
- let group, groupMaterial;
|
|
|
|
- let start, end;
|
|
|
|
- const modifiedPosition = new Float32Array( positionAttribute.count * positionAttribute.itemSize );
|
|
|
|
- const modifiedNormal = new Float32Array( normalAttribute.count * normalAttribute.itemSize );
|
|
|
|
|
|
+ modifiedAttributeArray[ a * 3 + 0 ] = _vA.x;
|
|
|
|
+ modifiedAttributeArray[ a * 3 + 1 ] = _vA.y;
|
|
|
|
+ modifiedAttributeArray[ a * 3 + 2 ] = _vA.z;
|
|
|
|
+ modifiedAttributeArray[ b * 3 + 0 ] = _vB.x;
|
|
|
|
+ modifiedAttributeArray[ b * 3 + 1 ] = _vB.y;
|
|
|
|
+ modifiedAttributeArray[ b * 3 + 2 ] = _vB.z;
|
|
|
|
+ modifiedAttributeArray[ c * 3 + 0 ] = _vC.x;
|
|
|
|
+ modifiedAttributeArray[ c * 3 + 1 ] = _vC.y;
|
|
|
|
+ modifiedAttributeArray[ c * 3 + 2 ] = _vC.z;
|
|
|
|
|
|
- if ( index !== null ) {
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- // indexed buffer geometry
|
|
|
|
- if ( Array.isArray( material ) ) {
|
|
|
|
|
|
+ const geometry = object.geometry;
|
|
|
|
+ const material = object.material;
|
|
|
|
+ let a, b, c;
|
|
|
|
+ const index = geometry.index;
|
|
|
|
+ const positionAttribute = geometry.attributes.position;
|
|
|
|
+ const morphPosition = geometry.morphAttributes.position;
|
|
|
|
+ const morphTargetsRelative = geometry.morphTargetsRelative;
|
|
|
|
+ const normalAttribute = geometry.attributes.normal;
|
|
|
|
+ const morphNormal = geometry.morphAttributes.position;
|
|
|
|
+ const groups = geometry.groups;
|
|
|
|
+ const drawRange = geometry.drawRange;
|
|
|
|
+ let i, j, il, jl;
|
|
|
|
+ let group, groupMaterial;
|
|
|
|
+ let start, end;
|
|
|
|
+ const modifiedPosition = new Float32Array( positionAttribute.count * positionAttribute.itemSize );
|
|
|
|
+ const modifiedNormal = new Float32Array( normalAttribute.count * normalAttribute.itemSize );
|
|
|
|
|
|
- for ( i = 0, il = groups.length; i < il; i ++ ) {
|
|
|
|
|
|
+ if ( index !== null ) {
|
|
|
|
|
|
- group = groups[ i ];
|
|
|
|
- groupMaterial = material[ group.materialIndex ];
|
|
|
|
- start = Math.max( group.start, drawRange.start );
|
|
|
|
- end = Math.min( group.start + group.count, drawRange.start + drawRange.count );
|
|
|
|
|
|
+ // indexed buffer geometry
|
|
|
|
+ if ( Array.isArray( material ) ) {
|
|
|
|
|
|
- for ( j = start, jl = end; j < jl; j += 3 ) {
|
|
|
|
|
|
+ for ( i = 0, il = groups.length; i < il; i ++ ) {
|
|
|
|
|
|
- a = index.getX( j );
|
|
|
|
- b = index.getX( j + 1 );
|
|
|
|
- c = index.getX( j + 2 );
|
|
|
|
|
|
+ group = groups[ i ];
|
|
|
|
+ groupMaterial = material[ group.materialIndex ];
|
|
|
|
+ start = Math.max( group.start, drawRange.start );
|
|
|
|
+ end = Math.min( group.start + group.count, drawRange.start + drawRange.count );
|
|
|
|
|
|
- _calculateMorphedAttributeData( object, groupMaterial, positionAttribute, morphPosition, morphTargetsRelative, a, b, c, modifiedPosition );
|
|
|
|
|
|
+ for ( j = start, jl = end; j < jl; j += 3 ) {
|
|
|
|
|
|
- _calculateMorphedAttributeData( object, groupMaterial, normalAttribute, morphNormal, morphTargetsRelative, a, b, c, modifiedNormal );
|
|
|
|
|
|
+ a = index.getX( j );
|
|
|
|
+ b = index.getX( j + 1 );
|
|
|
|
+ c = index.getX( j + 2 );
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ _calculateMorphedAttributeData( object, groupMaterial, positionAttribute, morphPosition, morphTargetsRelative, a, b, c, modifiedPosition );
|
|
|
|
+
|
|
|
|
+ _calculateMorphedAttributeData( object, groupMaterial, normalAttribute, morphNormal, morphTargetsRelative, a, b, c, modifiedNormal );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- } else {
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- start = Math.max( 0, drawRange.start );
|
|
|
|
- end = Math.min( index.count, drawRange.start + drawRange.count );
|
|
|
|
|
|
+ } else {
|
|
|
|
|
|
- for ( i = start, il = end; i < il; i += 3 ) {
|
|
|
|
|
|
+ start = Math.max( 0, drawRange.start );
|
|
|
|
+ end = Math.min( index.count, drawRange.start + drawRange.count );
|
|
|
|
|
|
- a = index.getX( i );
|
|
|
|
- b = index.getX( i + 1 );
|
|
|
|
- c = index.getX( i + 2 );
|
|
|
|
|
|
+ for ( i = start, il = end; i < il; i += 3 ) {
|
|
|
|
|
|
- _calculateMorphedAttributeData( object, material, positionAttribute, morphPosition, morphTargetsRelative, a, b, c, modifiedPosition );
|
|
|
|
|
|
+ a = index.getX( i );
|
|
|
|
+ b = index.getX( i + 1 );
|
|
|
|
+ c = index.getX( i + 2 );
|
|
|
|
|
|
- _calculateMorphedAttributeData( object, material, normalAttribute, morphNormal, morphTargetsRelative, a, b, c, modifiedNormal );
|
|
|
|
|
|
+ _calculateMorphedAttributeData( object, material, positionAttribute, morphPosition, morphTargetsRelative, a, b, c, modifiedPosition );
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ _calculateMorphedAttributeData( object, material, normalAttribute, morphNormal, morphTargetsRelative, a, b, c, modifiedNormal );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- } else if ( positionAttribute !== undefined ) {
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- // non-indexed buffer geometry
|
|
|
|
- if ( Array.isArray( material ) ) {
|
|
|
|
|
|
+ } else if ( positionAttribute !== undefined ) {
|
|
|
|
|
|
- for ( i = 0, il = groups.length; i < il; i ++ ) {
|
|
|
|
|
|
+ // non-indexed buffer geometry
|
|
|
|
+ if ( Array.isArray( material ) ) {
|
|
|
|
|
|
- group = groups[ i ];
|
|
|
|
- groupMaterial = material[ group.materialIndex ];
|
|
|
|
- start = Math.max( group.start, drawRange.start );
|
|
|
|
- end = Math.min( group.start + group.count, drawRange.start + drawRange.count );
|
|
|
|
|
|
+ for ( i = 0, il = groups.length; i < il; i ++ ) {
|
|
|
|
|
|
- for ( j = start, jl = end; j < jl; j += 3 ) {
|
|
|
|
|
|
+ group = groups[ i ];
|
|
|
|
+ groupMaterial = material[ group.materialIndex ];
|
|
|
|
+ start = Math.max( group.start, drawRange.start );
|
|
|
|
+ end = Math.min( group.start + group.count, drawRange.start + drawRange.count );
|
|
|
|
|
|
- a = j;
|
|
|
|
- b = j + 1;
|
|
|
|
- c = j + 2;
|
|
|
|
|
|
+ for ( j = start, jl = end; j < jl; j += 3 ) {
|
|
|
|
|
|
- _calculateMorphedAttributeData( object, groupMaterial, positionAttribute, morphPosition, morphTargetsRelative, a, b, c, modifiedPosition );
|
|
|
|
|
|
+ a = j;
|
|
|
|
+ b = j + 1;
|
|
|
|
+ c = j + 2;
|
|
|
|
|
|
- _calculateMorphedAttributeData( object, groupMaterial, normalAttribute, morphNormal, morphTargetsRelative, a, b, c, modifiedNormal );
|
|
|
|
|
|
+ _calculateMorphedAttributeData( object, groupMaterial, positionAttribute, morphPosition, morphTargetsRelative, a, b, c, modifiedPosition );
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ _calculateMorphedAttributeData( object, groupMaterial, normalAttribute, morphNormal, morphTargetsRelative, a, b, c, modifiedNormal );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- } else {
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- start = Math.max( 0, drawRange.start );
|
|
|
|
- end = Math.min( positionAttribute.count, drawRange.start + drawRange.count );
|
|
|
|
|
|
+ } else {
|
|
|
|
|
|
- for ( i = start, il = end; i < il; i += 3 ) {
|
|
|
|
|
|
+ start = Math.max( 0, drawRange.start );
|
|
|
|
+ end = Math.min( positionAttribute.count, drawRange.start + drawRange.count );
|
|
|
|
|
|
- a = i;
|
|
|
|
- b = i + 1;
|
|
|
|
- c = i + 2;
|
|
|
|
|
|
+ for ( i = start, il = end; i < il; i += 3 ) {
|
|
|
|
|
|
- _calculateMorphedAttributeData( object, material, positionAttribute, morphPosition, morphTargetsRelative, a, b, c, modifiedPosition );
|
|
|
|
|
|
+ a = i;
|
|
|
|
+ b = i + 1;
|
|
|
|
+ c = i + 2;
|
|
|
|
|
|
- _calculateMorphedAttributeData( object, material, normalAttribute, morphNormal, morphTargetsRelative, a, b, c, modifiedNormal );
|
|
|
|
|
|
+ _calculateMorphedAttributeData( object, material, positionAttribute, morphPosition, morphTargetsRelative, a, b, c, modifiedPosition );
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ _calculateMorphedAttributeData( object, material, normalAttribute, morphNormal, morphTargetsRelative, a, b, c, modifiedNormal );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- const morphedPositionAttribute = new THREE.Float32BufferAttribute( modifiedPosition, 3 );
|
|
|
|
- const morphedNormalAttribute = new THREE.Float32BufferAttribute( modifiedNormal, 3 );
|
|
|
|
- return {
|
|
|
|
- positionAttribute: positionAttribute,
|
|
|
|
- normalAttribute: normalAttribute,
|
|
|
|
- morphedPositionAttribute: morphedPositionAttribute,
|
|
|
|
- morphedNormalAttribute: morphedNormalAttribute
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ const morphedPositionAttribute = new THREE.Float32BufferAttribute( modifiedPosition, 3 );
|
|
|
|
+ const morphedNormalAttribute = new THREE.Float32BufferAttribute( modifiedNormal, 3 );
|
|
|
|
+ return {
|
|
|
|
+ positionAttribute: positionAttribute,
|
|
|
|
+ normalAttribute: normalAttribute,
|
|
|
|
+ morphedPositionAttribute: morphedPositionAttribute,
|
|
|
|
+ morphedNormalAttribute: morphedNormalAttribute
|
|
|
|
+ };
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
- THREE.BufferGeometryUtils = BufferGeometryUtils;
|
|
|
|
|
|
+ THREE.BufferGeometryUtils = {};
|
|
|
|
+ THREE.BufferGeometryUtils.computeMorphedAttributes = computeMorphedAttributes;
|
|
|
|
+ THREE.BufferGeometryUtils.computeTangents = computeTangents;
|
|
|
|
+ THREE.BufferGeometryUtils.estimateBytesUsed = estimateBytesUsed;
|
|
|
|
+ THREE.BufferGeometryUtils.interleaveAttributes = interleaveAttributes;
|
|
|
|
+ THREE.BufferGeometryUtils.mergeBufferAttributes = mergeBufferAttributes;
|
|
|
|
+ THREE.BufferGeometryUtils.mergeBufferGeometries = mergeBufferGeometries;
|
|
|
|
+ THREE.BufferGeometryUtils.mergeVertices = mergeVertices;
|
|
|
|
+ THREE.BufferGeometryUtils.toTrianglesDrawMode = toTrianglesDrawMode;
|
|
|
|
|
|
} )();
|
|
} )();
|