提交 e3af646a 编写于 作者: H hena-3

Added clone functionality

上级 b4e9688e
......@@ -16,3 +16,14 @@ THREE.Bone = function ( skin ) {
THREE.Bone.prototype = Object.create( THREE.Object3D.prototype );
THREE.Bone.prototype.constructor = THREE.Bone;
THREE.Bone.prototype.clone = function ( object ) {
if ( object === undefined ) object = new THREE.Bone( this.skin );
THREE.Object3D.prototype.clone.call( this, object );
object.skin = this.skin;
return object;
};
\ No newline at end of file
......@@ -12,3 +12,13 @@ THREE.Group = function () {
THREE.Group.prototype = Object.create( THREE.Object3D.prototype );
THREE.Group.prototype.constructor = THREE.Group;
THREE.Group.prototype.clone = function ( object ) {
if ( object === undefined ) object = new THREE.Group();
THREE.Object3D.prototype.clone.call( this, object );
return object;
};
\ No newline at end of file
......@@ -78,3 +78,22 @@ THREE.LensFlare.prototype.updateLensFlares = function () {
};
THREE.LensFlare.prototype.clone = function ( object ) {
if ( object === undefined ) object = new THREE.LensFlare();
THREE.Object3D.prototype.clone.call( this, object );
object.positionScreen.copy(this.positionScreen);
object.customUpdateCallback = this.customUpdateCallback;
object.lensFlares = [];
for ( var i = 0, l = this.lensFlares.length; i < l; i ++ ) {
object.lensFlares.push(this.lensFlares[i]);
}
return object;
};
\ No newline at end of file
......@@ -12,3 +12,13 @@ THREE.LineSegments = function ( geometry, material ) {
THREE.LineSegments.prototype = Object.create( THREE.Line.prototype );
THREE.LineSegments.prototype.constructor = THREE.LineSegments;
THREE.LineSegments.prototype.clone = function ( object ) {
if ( object === undefined ) object = new THREE.LineSegments( this.geometry, this.material );
THREE.Line.prototype.clone.call( this, object );
return object;
};
\ No newline at end of file
......@@ -170,3 +170,10 @@ THREE.Skeleton.prototype.update = ( function () {
} )();
THREE.Skeleton.prototype.clone = function ( ) {
var object = new THREE.Skeleton(this.bones, this.boneInverses, this.useVertexTexture);
return object;
};
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册