Ver Fonte

Examples: Clean up. (#21645)

Michael Herzog há 4 anos atrás
pai
commit
262bbbc45a
2 ficheiros alterados com 248 adições e 217 exclusões
  1. 140 109
      examples/js/deprecated/Geometry.js
  2. 108 108
      examples/jsm/deprecated/Geometry.js

+ 140 - 109
examples/js/deprecated/Geometry.js

@@ -6,37 +6,37 @@
 
 	const _offset = new THREE.Vector3();
 
-	function Geometry() {
-
-		this.uuid = THREE.MathUtils.generateUUID();
-		this.name = '';
-		this.type = 'Geometry';
-		this.vertices = [];
-		this.colors = [];
-		this.faces = [];
-		this.faceVertexUvs = [[]];
-		this.morphTargets = [];
-		this.morphNormals = [];
-		this.skinWeights = [];
-		this.skinIndices = [];
-		this.lineDistances = [];
-		this.boundingBox = null;
-		this.boundingSphere = null; // update flags
-
-		this.elementsNeedUpdate = false;
-		this.verticesNeedUpdate = false;
-		this.uvsNeedUpdate = false;
-		this.normalsNeedUpdate = false;
-		this.colorsNeedUpdate = false;
-		this.lineDistancesNeedUpdate = false;
-		this.groupsNeedUpdate = false;
+	class Geometry extends THREE.EventDispatcher {
 
-	}
+		constructor() {
 
-	Geometry.prototype = Object.assign( Object.create( THREE.EventDispatcher.prototype ), {
-		constructor: Geometry,
-		isGeometry: true,
-		applyMatrix4: function ( matrix ) {
+			super();
+			this.uuid = THREE.MathUtils.generateUUID();
+			this.name = '';
+			this.type = 'Geometry';
+			this.vertices = [];
+			this.colors = [];
+			this.faces = [];
+			this.faceVertexUvs = [[]];
+			this.morphTargets = [];
+			this.morphNormals = [];
+			this.skinWeights = [];
+			this.skinIndices = [];
+			this.lineDistances = [];
+			this.boundingBox = null;
+			this.boundingSphere = null; // update flags
+
+			this.elementsNeedUpdate = false;
+			this.verticesNeedUpdate = false;
+			this.uvsNeedUpdate = false;
+			this.normalsNeedUpdate = false;
+			this.colorsNeedUpdate = false;
+			this.lineDistancesNeedUpdate = false;
+			this.groupsNeedUpdate = false;
+
+		}
+
+		applyMatrix4( matrix ) {
 
 			const normalMatrix = new THREE.Matrix3().getNormalMatrix( matrix );
 
@@ -76,8 +76,9 @@
 			this.normalsNeedUpdate = true;
 			return this;
 
-		},
-		rotateX: function ( angle ) {
+		}
+
+		rotateX( angle ) {
 
 			// rotate geometry around world x-axis
 			_m1.makeRotationX( angle );
@@ -85,8 +86,9 @@
 			this.applyMatrix4( _m1 );
 			return this;
 
-		},
-		rotateY: function ( angle ) {
+		}
+
+		rotateY( angle ) {
 
 			// rotate geometry around world y-axis
 			_m1.makeRotationY( angle );
@@ -94,8 +96,9 @@
 			this.applyMatrix4( _m1 );
 			return this;
 
-		},
-		rotateZ: function ( angle ) {
+		}
+
+		rotateZ( angle ) {
 
 			// rotate geometry around world z-axis
 			_m1.makeRotationZ( angle );
@@ -103,8 +106,9 @@
 			this.applyMatrix4( _m1 );
 			return this;
 
-		},
-		translate: function ( x, y, z ) {
+		}
+
+		translate( x, y, z ) {
 
 			// translate geometry
 			_m1.makeTranslation( x, y, z );
@@ -112,8 +116,9 @@
 			this.applyMatrix4( _m1 );
 			return this;
 
-		},
-		scale: function ( x, y, z ) {
+		}
+
+		scale( x, y, z ) {
 
 			// scale geometry
 			_m1.makeScale( x, y, z );
@@ -121,8 +126,9 @@
 			this.applyMatrix4( _m1 );
 			return this;
 
-		},
-		lookAt: function ( vector ) {
+		}
+
+		lookAt( vector ) {
 
 			_obj.lookAt( vector );
 
@@ -131,8 +137,9 @@
 			this.applyMatrix4( _obj.matrix );
 			return this;
 
-		},
-		fromBufferGeometry: function ( geometry ) {
+		}
+
+		fromBufferGeometry( geometry ) {
 
 			const scope = this;
 			const index = geometry.index !== null ? geometry.index : undefined;
@@ -249,16 +256,18 @@
 
 			return this;
 
-		},
-		center: function () {
+		}
+
+		center() {
 
 			this.computeBoundingBox();
 			this.boundingBox.getCenter( _offset ).negate();
 			this.translate( _offset.x, _offset.y, _offset.z );
 			return this;
 
-		},
-		normalize: function () {
+		}
+
+		normalize() {
 
 			this.computeBoundingSphere();
 			const center = this.boundingSphere.center;
@@ -269,8 +278,9 @@
 			this.applyMatrix4( matrix );
 			return this;
 
-		},
-		computeFaceNormals: function () {
+		}
+
+		computeFaceNormals() {
 
 			const cb = new THREE.Vector3(),
 				ab = new THREE.Vector3();
@@ -289,8 +299,9 @@
 
 			}
 
-		},
-		computeVertexNormals: function ( areaWeighted = true ) {
+		}
+
+		computeVertexNormals( areaWeighted = true ) {
 
 			const vertices = new Array( this.vertices.length );
 
@@ -370,8 +381,9 @@
 
 			}
 
-		},
-		computeFlatVertexNormals: function () {
+		}
+
+		computeFlatVertexNormals() {
 
 			this.computeFaceNormals();
 
@@ -402,8 +414,9 @@
 
 			}
 
-		},
-		computeMorphNormals: function () {
+		}
+
+		computeMorphNormals() {
 
 			// save original normals
 			// - create temp variables on first access
@@ -500,8 +513,9 @@
 
 			}
 
-		},
-		computeBoundingBox: function () {
+		}
+
+		computeBoundingBox() {
 
 			if ( this.boundingBox === null ) {
 
@@ -511,8 +525,9 @@
 
 			this.boundingBox.setFromPoints( this.vertices );
 
-		},
-		computeBoundingSphere: function () {
+		}
+
+		computeBoundingSphere() {
 
 			if ( this.boundingSphere === null ) {
 
@@ -522,8 +537,9 @@
 
 			this.boundingSphere.setFromPoints( this.vertices );
 
-		},
-		merge: function ( geometry, matrix, materialIndexOffset = 0 ) {
+		}
+
+		merge( geometry, matrix, materialIndexOffset = 0 ) {
 
 			if ( ! ( geometry && geometry.isGeometry ) ) {
 
@@ -631,8 +647,9 @@
 
 			}
 
-		},
-		mergeMesh: function ( mesh ) {
+		}
+
+		mergeMesh( mesh ) {
 
 			if ( ! ( mesh && mesh.isMesh ) ) {
 
@@ -644,14 +661,15 @@
 			if ( mesh.matrixAutoUpdate ) mesh.updateMatrix();
 			this.merge( mesh.geometry, mesh.matrix );
 
-		},
-
+		}
 		/*
 	 * Checks for duplicate vertices with hashmap.
 	 * Duplicated vertices are removed
 	 * and faces' vertices are updated.
 	 */
-		mergeVertices: function ( precisionPoints = 4 ) {
+
+
+		mergeVertices( precisionPoints = 4 ) {
 
 			const verticesMap = {}; // Hashmap for looking up vertices by position coordinates (and making sure they are unique)
 
@@ -723,8 +741,9 @@
 			this.vertices = unique;
 			return diff;
 
-		},
-		setFromPoints: function ( points ) {
+		}
+
+		setFromPoints( points ) {
 
 			this.vertices = [];
 
@@ -737,8 +756,9 @@
 
 			return this;
 
-		},
-		sortFacesByMaterialIndex: function () {
+		}
+
+		sortFacesByMaterialIndex() {
 
 			const faces = this.faces;
 			const length = faces.length; // tag faces
@@ -775,8 +795,9 @@
 			if ( newUvs1 ) this.faceVertexUvs[ 0 ] = newUvs1;
 			if ( newUvs2 ) this.faceVertexUvs[ 1 ] = newUvs2;
 
-		},
-		toJSON: function () {
+		}
+
+		toJSON() {
 
 			const data = {
 				metadata: {
@@ -944,8 +965,9 @@
 			data.data.faces = faces;
 			return data;
 
-		},
-		clone: function () {
+		}
+
+		clone() {
 
 			/*
 		 // Handle primitives
@@ -963,8 +985,9 @@
 		 */
 			return new Geometry().copy( this );
 
-		},
-		copy: function ( source ) {
+		}
+
+		copy( source ) {
 
 			// reset
 			this.vertices = [];
@@ -1169,8 +1192,9 @@
 			this.groupsNeedUpdate = source.groupsNeedUpdate;
 			return this;
 
-		},
-		toBufferGeometry: function () {
+		}
+
+		toBufferGeometry() {
 
 			const geometry = new DirectGeometry().fromGeometry( this );
 			const buffergeometry = new THREE.BufferGeometry();
@@ -1256,72 +1280,79 @@
 
 			return buffergeometry;
 
-		},
-		computeTangents: function () {
+		}
+
+		computeTangents() {
 
 			console.error( 'THREE.Geometry: .computeTangents() has been removed.' );
 
-		},
-		computeLineDistances: function () {
+		}
+
+		computeLineDistances() {
 
 			console.error( 'THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.' );
 
-		},
-		applyMatrix: function ( matrix ) {
+		}
+
+		applyMatrix( matrix ) {
 
 			console.warn( 'THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4().' );
 			return this.applyMatrix4( matrix );
 
-		},
-		dispose: function () {
+		}
+
+		dispose() {
 
 			this.dispatchEvent( {
 				type: 'dispose'
 			} );
 
 		}
-	} );
 
-	Geometry.createBufferGeometryFromObject = function ( object ) {
+		static createBufferGeometryFromObject( object ) {
 
-		let buffergeometry = new THREE.BufferGeometry();
-		const geometry = object.geometry;
+			let buffergeometry = new THREE.BufferGeometry();
+			const geometry = object.geometry;
 
-		if ( object.isPoints || object.isLine ) {
+			if ( object.isPoints || object.isLine ) {
 
-			const positions = new THREE.Float32BufferAttribute( geometry.vertices.length * 3, 3 );
-			const colors = new THREE.Float32BufferAttribute( geometry.colors.length * 3, 3 );
-			buffergeometry.setAttribute( 'position', positions.copyVector3sArray( geometry.vertices ) );
-			buffergeometry.setAttribute( 'color', colors.copyColorsArray( geometry.colors ) );
+				const positions = new THREE.Float32BufferAttribute( geometry.vertices.length * 3, 3 );
+				const colors = new THREE.Float32BufferAttribute( geometry.colors.length * 3, 3 );
+				buffergeometry.setAttribute( 'position', positions.copyVector3sArray( geometry.vertices ) );
+				buffergeometry.setAttribute( 'color', colors.copyColorsArray( geometry.colors ) );
 
-			if ( geometry.lineDistances && geometry.lineDistances.length === geometry.vertices.length ) {
+				if ( geometry.lineDistances && geometry.lineDistances.length === geometry.vertices.length ) {
 
-				const lineDistances = new THREE.Float32BufferAttribute( geometry.lineDistances.length, 1 );
-				buffergeometry.setAttribute( 'lineDistance', lineDistances.copyArray( geometry.lineDistances ) );
+					const lineDistances = new THREE.Float32BufferAttribute( geometry.lineDistances.length, 1 );
+					buffergeometry.setAttribute( 'lineDistance', lineDistances.copyArray( geometry.lineDistances ) );
 
-			}
+				}
 
-			if ( geometry.boundingSphere !== null ) {
+				if ( geometry.boundingSphere !== null ) {
 
-				buffergeometry.boundingSphere = geometry.boundingSphere.clone();
+					buffergeometry.boundingSphere = geometry.boundingSphere.clone();
 
-			}
+				}
 
-			if ( geometry.boundingBox !== null ) {
+				if ( geometry.boundingBox !== null ) {
 
-				buffergeometry.boundingBox = geometry.boundingBox.clone();
+					buffergeometry.boundingBox = geometry.boundingBox.clone();
 
-			}
+				}
+
+			} else if ( object.isMesh ) {
+
+				buffergeometry = geometry.toBufferGeometry();
 
-		} else if ( object.isMesh ) {
+			}
 
-			buffergeometry = geometry.toBufferGeometry();
+			return buffergeometry;
 
 		}
 
-		return buffergeometry;
+	}
 
-	};
+	Geometry.prototype.isGeometry = true;
 
 	class DirectGeometry {
 

+ 108 - 108
examples/jsm/deprecated/Geometry.js

@@ -18,48 +18,46 @@ const _m1 = new Matrix4();
 const _obj = new Object3D();
 const _offset = new Vector3();
 
-function Geometry() {
+class Geometry extends EventDispatcher {
 
-	this.uuid = MathUtils.generateUUID();
-
-	this.name = '';
-	this.type = 'Geometry';
+	constructor() {
 
-	this.vertices = [];
-	this.colors = [];
-	this.faces = [];
-	this.faceVertexUvs = [[]];
+		super();
 
-	this.morphTargets = [];
-	this.morphNormals = [];
+		this.uuid = MathUtils.generateUUID();
 
-	this.skinWeights = [];
-	this.skinIndices = [];
+		this.name = '';
+		this.type = 'Geometry';
 
-	this.lineDistances = [];
+		this.vertices = [];
+		this.colors = [];
+		this.faces = [];
+		this.faceVertexUvs = [[]];
 
-	this.boundingBox = null;
-	this.boundingSphere = null;
+		this.morphTargets = [];
+		this.morphNormals = [];
 
-	// update flags
+		this.skinWeights = [];
+		this.skinIndices = [];
 
-	this.elementsNeedUpdate = false;
-	this.verticesNeedUpdate = false;
-	this.uvsNeedUpdate = false;
-	this.normalsNeedUpdate = false;
-	this.colorsNeedUpdate = false;
-	this.lineDistancesNeedUpdate = false;
-	this.groupsNeedUpdate = false;
+		this.lineDistances = [];
 
-}
+		this.boundingBox = null;
+		this.boundingSphere = null;
 
-Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), {
+		// update flags
 
-	constructor: Geometry,
+		this.elementsNeedUpdate = false;
+		this.verticesNeedUpdate = false;
+		this.uvsNeedUpdate = false;
+		this.normalsNeedUpdate = false;
+		this.colorsNeedUpdate = false;
+		this.lineDistancesNeedUpdate = false;
+		this.groupsNeedUpdate = false;
 
-	isGeometry: true,
+	}
 
-	applyMatrix4: function ( matrix ) {
+	applyMatrix4( matrix ) {
 
 		const normalMatrix = new Matrix3().getNormalMatrix( matrix );
 
@@ -100,9 +98,9 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 		return this;
 
-	},
+	}
 
-	rotateX: function ( angle ) {
+	rotateX( angle ) {
 
 		// rotate geometry around world x-axis
 
@@ -112,9 +110,9 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 		return this;
 
-	},
+	}
 
-	rotateY: function ( angle ) {
+	rotateY( angle ) {
 
 		// rotate geometry around world y-axis
 
@@ -124,9 +122,9 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 		return this;
 
-	},
+	}
 
-	rotateZ: function ( angle ) {
+	rotateZ( angle ) {
 
 		// rotate geometry around world z-axis
 
@@ -136,9 +134,9 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 		return this;
 
-	},
+	}
 
-	translate: function ( x, y, z ) {
+	translate( x, y, z ) {
 
 		// translate geometry
 
@@ -148,9 +146,9 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 		return this;
 
-	},
+	}
 
-	scale: function ( x, y, z ) {
+	scale( x, y, z ) {
 
 		// scale geometry
 
@@ -160,9 +158,9 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 		return this;
 
-	},
+	}
 
-	lookAt: function ( vector ) {
+	lookAt( vector ) {
 
 		_obj.lookAt( vector );
 
@@ -172,9 +170,9 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 		return this;
 
-	},
+	}
 
-	fromBufferGeometry: function ( geometry ) {
+	fromBufferGeometry( geometry ) {
 
 		const scope = this;
 
@@ -313,9 +311,9 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 		return this;
 
-	},
+	}
 
-	center: function () {
+	center() {
 
 		this.computeBoundingBox();
 
@@ -325,9 +323,9 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 		return this;
 
-	},
+	}
 
-	normalize: function () {
+	normalize() {
 
 		this.computeBoundingSphere();
 
@@ -348,9 +346,9 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 		return this;
 
-	},
+	}
 
-	computeFaceNormals: function () {
+	computeFaceNormals() {
 
 		const cb = new Vector3(), ab = new Vector3();
 
@@ -372,9 +370,9 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 		}
 
-	},
+	}
 
-	computeVertexNormals: function ( areaWeighted = true ) {
+	computeVertexNormals( areaWeighted = true ) {
 
 		const vertices = new Array( this.vertices.length );
 
@@ -459,9 +457,9 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 		}
 
-	},
+	}
 
-	computeFlatVertexNormals: function () {
+	computeFlatVertexNormals() {
 
 		this.computeFaceNormals();
 
@@ -493,9 +491,9 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 		}
 
-	},
+	}
 
-	computeMorphNormals: function () {
+	computeMorphNormals() {
 
 		// save original normals
 		// - create temp variables on first access
@@ -604,9 +602,9 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 		}
 
-	},
+	}
 
-	computeBoundingBox: function () {
+	computeBoundingBox() {
 
 		if ( this.boundingBox === null ) {
 
@@ -616,9 +614,9 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 		this.boundingBox.setFromPoints( this.vertices );
 
-	},
+	}
 
-	computeBoundingSphere: function () {
+	computeBoundingSphere() {
 
 		if ( this.boundingSphere === null ) {
 
@@ -628,9 +626,9 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 		this.boundingSphere.setFromPoints( this.vertices );
 
-	},
+	}
 
-	merge: function ( geometry, matrix, materialIndexOffset = 0 ) {
+	merge( geometry, matrix, materialIndexOffset = 0 ) {
 
 		if ( ! ( geometry && geometry.isGeometry ) ) {
 
@@ -747,9 +745,9 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 		}
 
-	},
+	}
 
-	mergeMesh: function ( mesh ) {
+	mergeMesh( mesh ) {
 
 		if ( ! ( mesh && mesh.isMesh ) ) {
 
@@ -762,7 +760,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 		this.merge( mesh.geometry, mesh.matrix );
 
-	},
+	}
 
 	/*
 	 * Checks for duplicate vertices with hashmap.
@@ -770,7 +768,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 	 * and faces' vertices are updated.
 	 */
 
-	mergeVertices: function ( precisionPoints = 4 ) {
+	mergeVertices( precisionPoints = 4 ) {
 
 		const verticesMap = {}; // Hashmap for looking up vertices by position coordinates (and making sure they are unique)
 		const unique = [], changes = [];
@@ -847,9 +845,9 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 		this.vertices = unique;
 		return diff;
 
-	},
+	}
 
-	setFromPoints: function ( points ) {
+	setFromPoints( points ) {
 
 		this.vertices = [];
 
@@ -862,9 +860,9 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 		return this;
 
-	},
+	}
 
-	sortFacesByMaterialIndex: function () {
+	sortFacesByMaterialIndex() {
 
 		const faces = this.faces;
 		const length = faces.length;
@@ -909,9 +907,9 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 		if ( newUvs1 ) this.faceVertexUvs[ 0 ] = newUvs1;
 		if ( newUvs2 ) this.faceVertexUvs[ 1 ] = newUvs2;
 
-	},
+	}
 
-	toJSON: function () {
+	toJSON() {
 
 		const data = {
 			metadata: {
@@ -1102,9 +1100,9 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 		return data;
 
-	},
+	}
 
-	clone: function () {
+	clone() {
 
 		/*
 		 // Handle primitives
@@ -1132,9 +1130,9 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 		return new Geometry().copy( this );
 
-	},
+	}
 
-	copy: function ( source ) {
+	copy( source ) {
 
 		// reset
 
@@ -1364,9 +1362,9 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 		return this;
 
-	},
+	}
 
-	toBufferGeometry: function () {
+	toBufferGeometry() {
 
 		const geometry = new DirectGeometry().fromGeometry( this );
 
@@ -1461,78 +1459,80 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 		return buffergeometry;
 
-	},
+	}
 
-	computeTangents: function () {
+	computeTangents() {
 
 		console.error( 'THREE.Geometry: .computeTangents() has been removed.' );
 
-	},
+	}
 
-	computeLineDistances: function () {
+	computeLineDistances() {
 
 		console.error( 'THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.' );
 
-	},
+	}
 
-	applyMatrix: function ( matrix ) {
+	applyMatrix( matrix ) {
 
 		console.warn( 'THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4().' );
 		return this.applyMatrix4( matrix );
 
-	},
+	}
 
-	dispose: function () {
+	dispose() {
 
 		this.dispatchEvent( { type: 'dispose' } );
 
 	}
 
-} );
+	static createBufferGeometryFromObject( object ) {
 
-Geometry.createBufferGeometryFromObject = function ( object ) {
+		let buffergeometry = new BufferGeometry();
 
-	let buffergeometry = new BufferGeometry();
+		const geometry = object.geometry;
 
-	const geometry = object.geometry;
+		if ( object.isPoints || object.isLine ) {
 
-	if ( object.isPoints || object.isLine ) {
+			const positions = new Float32BufferAttribute( geometry.vertices.length * 3, 3 );
+			const colors = new Float32BufferAttribute( geometry.colors.length * 3, 3 );
 
-		const positions = new Float32BufferAttribute( geometry.vertices.length * 3, 3 );
-		const colors = new Float32BufferAttribute( geometry.colors.length * 3, 3 );
+			buffergeometry.setAttribute( 'position', positions.copyVector3sArray( geometry.vertices ) );
+			buffergeometry.setAttribute( 'color', colors.copyColorsArray( geometry.colors ) );
 
-		buffergeometry.setAttribute( 'position', positions.copyVector3sArray( geometry.vertices ) );
-		buffergeometry.setAttribute( 'color', colors.copyColorsArray( geometry.colors ) );
+			if ( geometry.lineDistances && geometry.lineDistances.length === geometry.vertices.length ) {
 
-		if ( geometry.lineDistances && geometry.lineDistances.length === geometry.vertices.length ) {
+				const lineDistances = new Float32BufferAttribute( geometry.lineDistances.length, 1 );
 
-			const lineDistances = new Float32BufferAttribute( geometry.lineDistances.length, 1 );
+				buffergeometry.setAttribute( 'lineDistance', lineDistances.copyArray( geometry.lineDistances ) );
 
-			buffergeometry.setAttribute( 'lineDistance', lineDistances.copyArray( geometry.lineDistances ) );
+			}
 
-		}
+			if ( geometry.boundingSphere !== null ) {
 
-		if ( geometry.boundingSphere !== null ) {
+				buffergeometry.boundingSphere = geometry.boundingSphere.clone();
 
-			buffergeometry.boundingSphere = geometry.boundingSphere.clone();
+			}
 
-		}
+			if ( geometry.boundingBox !== null ) {
 
-		if ( geometry.boundingBox !== null ) {
+				buffergeometry.boundingBox = geometry.boundingBox.clone();
 
-			buffergeometry.boundingBox = geometry.boundingBox.clone();
+			}
 
-		}
+		} else if ( object.isMesh ) {
 
-	} else if ( object.isMesh ) {
+			buffergeometry = geometry.toBufferGeometry();
 
-		buffergeometry = geometry.toBufferGeometry();
+		}
+
+		return buffergeometry;
 
 	}
 
-	return buffergeometry;
+}
 
-};
+Geometry.prototype.isGeometry = true;
 
 class DirectGeometry {