Browse Source

Add clone method to THREE.LOD

Isaac Sukin 11 years ago
parent
commit
f7a9e1f2b9
1 changed files with 12 additions and 2 deletions
  1. 12 2
      src/objects/LOD.js

+ 12 - 2
src/objects/LOD.js

@@ -95,8 +95,18 @@ THREE.LOD.prototype.update = function () {
 
 }();
 
-THREE.LOD.prototype.clone = function () {
+THREE.LOD.prototype.clone = function ( object ) {
 
-	// TODO
+	if ( object === undefined ) object = new THREE.LOD();
+
+	THREE.Object3D.prototype.clone.call( this, object );
+
+	for ( var i = 0, l = this.objects.length; i < l; i ++ ) {
+		var x = this.objects[i].object.clone();
+		x.visible = i === 0;
+		object.addLevel( x, this.objects[i].distance );
+	}
+
+	return object;
 
 };