|
@@ -662,52 +662,52 @@ THREE.Object3D.prototype = {
|
|
|
clone: function ( recursive ) {
|
|
|
|
|
|
var object = new THREE.Object3D();
|
|
|
- return this.cloneProperties( object, recursive );
|
|
|
+ return object._copyFrom( this, recursive );
|
|
|
|
|
|
},
|
|
|
|
|
|
- cloneProperties: function ( object, recursive ) {
|
|
|
+ _copyFrom: function ( source, recursive ) {
|
|
|
|
|
|
if ( recursive === undefined ) recursive = true;
|
|
|
|
|
|
- object.name = this.name;
|
|
|
+ this.name = source.name;
|
|
|
|
|
|
- object.up.copy( this.up );
|
|
|
+ this.up.copy( source.up );
|
|
|
|
|
|
- object.position.copy( this.position );
|
|
|
- object.quaternion.copy( this.quaternion );
|
|
|
- object.scale.copy( this.scale );
|
|
|
+ this.position.copy( source.position );
|
|
|
+ this.quaternion.copy( source.quaternion );
|
|
|
+ this.scale.copy( source.scale );
|
|
|
|
|
|
- object.rotationAutoUpdate = this.rotationAutoUpdate;
|
|
|
+ this.rotationAutoUpdate = source.rotationAutoUpdate;
|
|
|
|
|
|
- object.matrix.copy( this.matrix );
|
|
|
- object.matrixWorld.copy( this.matrixWorld );
|
|
|
+ this.matrix.copy( source.matrix );
|
|
|
+ this.matrixWorld.copy( source.matrixWorld );
|
|
|
|
|
|
- object.matrixAutoUpdate = this.matrixAutoUpdate;
|
|
|
- object.matrixWorldNeedsUpdate = this.matrixWorldNeedsUpdate;
|
|
|
+ this.matrixAutoUpdate = source.matrixAutoUpdate;
|
|
|
+ this.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;
|
|
|
|
|
|
- object.visible = this.visible;
|
|
|
+ this.visible = source.visible;
|
|
|
|
|
|
- object.castShadow = this.castShadow;
|
|
|
- object.receiveShadow = this.receiveShadow;
|
|
|
+ this.castShadow = source.castShadow;
|
|
|
+ this.receiveShadow = source.receiveShadow;
|
|
|
|
|
|
- object.frustumCulled = this.frustumCulled;
|
|
|
- object.renderOrder = this.renderOrder;
|
|
|
+ this.frustumCulled = source.frustumCulled;
|
|
|
+ this.renderOrder = source.renderOrder;
|
|
|
|
|
|
- object.userData = JSON.parse( JSON.stringify( this.userData ) );
|
|
|
+ this.userData = JSON.parse( JSON.stringify( source.userData ) );
|
|
|
|
|
|
if ( recursive === true ) {
|
|
|
|
|
|
- for ( var i = 0; i < this.children.length; i ++ ) {
|
|
|
+ for ( var i = 0; i < source.children.length; i ++ ) {
|
|
|
|
|
|
- var child = this.children[ i ];
|
|
|
- object.add( child.clone() );
|
|
|
+ var child = source.children[ i ];
|
|
|
+ this.add( child.clone() );
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
- return object;
|
|
|
+ return this;
|
|
|
|
|
|
}
|
|
|
|