Browse Source

Geometry clone now accepts a target

Clear the target data before pushing new vertices and faces
dubejf 10 years ago
parent
commit
e93c6b3006
1 changed files with 12 additions and 2 deletions
  1. 12 2
      src/core/Geometry.js

+ 12 - 2
src/core/Geometry.js

@@ -1046,9 +1046,19 @@ THREE.Geometry.prototype = {
 
 	},
 
-	clone: function () {
+	clone: function ( geometry ) {
 
-		var geometry = new THREE.Geometry();
+		if ( geometry === undefined ) {
+
+			geometry = new THREE.Geometry();
+
+		} else {
+
+			geometry.vertices = [];
+			geometry.faces = [];
+			geometry.faceVertexUvs = [ [] ];
+
+		}
 
 		var vertices = this.vertices;