提交 802e589c 编写于 作者: D dubejf

CloneProperties renamed _copyFrom, swap src / dest arg order

上级 faa8745f
......@@ -22,7 +22,7 @@ THREE.SpriteCanvasMaterial.prototype.clone = function () {
var material = new THREE.SpriteCanvasMaterial();
THREE.Material.prototype.cloneProperties.call( this, material );
THREE.Material.prototype._copyFrom.call( material, this );
material.color.copy( this.color );
material.program = this.program;
......
......@@ -741,7 +741,7 @@ THREE.ProxyGeometry.prototype.computeBoundingBox = function () {
};
THREE.ProxyGeometry.prototype.clone = function () {
var buff = THREE.BufferGeometry.prototype.cloneProperties.call(this);
var buff = THREE.BufferGeometry.prototype.clone.call( this );
var geo = new THREE.ProxyGeometry();
geo.attributes = buff.attributes;
geo.offsets = buff.drawcalls;
......
......@@ -53,17 +53,17 @@ THREE.Camera.prototype.lookAt = function () {
THREE.Camera.prototype.clone = function () {
var camera = new THREE.Camera();
return this.cloneProperties( camera );
return camera._copyFrom( this );
};
THREE.Camera.prototype.cloneProperties = function ( camera ) {
THREE.Camera.prototype._copyFrom = function ( source ) {
THREE.Object3D.prototype.cloneProperties.call( this, camera );
THREE.Object3D.prototype._copyFrom.call( this, source );
camera.matrixWorldInverse.copy( this.matrixWorldInverse );
camera.projectionMatrix.copy( this.projectionMatrix );
this.matrixWorldInverse.copy( source.matrixWorldInverse );
this.projectionMatrix.copy( source.projectionMatrix );
return camera;
return this;
};
......@@ -40,7 +40,7 @@ THREE.OrthographicCamera.prototype.clone = function () {
var camera = new THREE.OrthographicCamera();
THREE.Camera.prototype.cloneProperties.call( this, camera );
THREE.Camera.prototype._copyFrom.call( camera, this );
camera.zoom = this.zoom;
......
......@@ -126,7 +126,7 @@ THREE.PerspectiveCamera.prototype.clone = function () {
var camera = new THREE.PerspectiveCamera();
THREE.Camera.prototype.cloneProperties.call( this, camera );
THREE.Camera.prototype._copyFrom.call( camera, this );
camera.zoom = this.zoom;
......
......@@ -1108,28 +1108,28 @@ THREE.BufferGeometry.prototype = {
clone: function () {
var geometry = new THREE.BufferGeometry();
return this.cloneProperties( geometry );
return geometry._copyFrom( this );
},
cloneProperties: function ( geometry ) {
_copyFrom: function ( source ) {
for ( var attr in this.attributes ) {
for ( var attr in source.attributes ) {
var sourceAttr = this.attributes[ attr ];
geometry.addAttribute( attr, sourceAttr.clone() );
var sourceAttr = source.attributes[ attr ];
this.addAttribute( attr, sourceAttr.clone() );
}
for ( var i = 0, il = this.drawcalls.length; i < il; i ++ ) {
for ( var i = 0, il = source.drawcalls.length; i < il; i ++ ) {
var offset = this.drawcalls[ i ];
var offset = source.drawcalls[ i ];
geometry.addDrawCall( offset.start, offset.count, offset.index );
this.addDrawCall( offset.start, offset.count, offset.index );
}
return geometry;
return this;
},
......
......@@ -1049,39 +1049,39 @@ THREE.Geometry.prototype = {
clone: function () {
var geometry = new THREE.Geometry();
return this.cloneProperties( geometry );
return geometry._copyFrom( this );
},
cloneProperties: function ( geometry ) {
_copyFrom: function ( source ) {
geometry.vertices = [];
geometry.faces = [];
geometry.faceVertexUvs = [ [] ];
this.vertices = [];
this.faces = [];
this.faceVertexUvs = [ [] ];
var vertices = this.vertices;
var vertices = source.vertices;
for ( var i = 0, il = vertices.length; i < il; i ++ ) {
geometry.vertices.push( vertices[ i ].clone() );
this.vertices.push( vertices[ i ].clone() );
}
var faces = this.faces;
var faces = source.faces;
for ( var i = 0, il = faces.length; i < il; i ++ ) {
geometry.faces.push( faces[ i ].clone() );
this.faces.push( faces[ i ].clone() );
}
for ( var i = 0, il = this.faceVertexUvs.length; i < il; i ++ ) {
for ( var i = 0, il = source.faceVertexUvs.length; i < il; i ++ ) {
var faceVertexUvs = this.faceVertexUvs[ i ];
var faceVertexUvs = source.faceVertexUvs[ i ];
if ( geometry.faceVertexUvs[ i ] === undefined ) {
if ( this.faceVertexUvs[ i ] === undefined ) {
geometry.faceVertexUvs[ i ] = [];
this.faceVertexUvs[ i ] = [];
}
......@@ -1097,13 +1097,13 @@ THREE.Geometry.prototype = {
}
geometry.faceVertexUvs[ i ].push( uvsCopy );
this.faceVertexUvs[ i ].push( uvsCopy );
}
}
return geometry;
return this;
},
......
......@@ -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;
}
......
......@@ -77,7 +77,7 @@ THREE.CircleBufferGeometry.prototype.clone = function () {
this.parameters.thetaLength
);
THREE.BufferGeometry.prototype.cloneProperties.call( this, geometry );
THREE.BufferGeometry.prototype._copyFrom.call( geometry, this );
return geometry;
......
......@@ -64,7 +64,7 @@ THREE.DodecahedronGeometry.prototype.clone = function () {
this.parameters.detail
);
THREE.PolyhedronGeometry.prototype.cloneProperties.call( this, geometry );
THREE.PolyhedronGeometry.prototype._copyFrom.call( geometry, this );
return geometry;
......
......@@ -39,7 +39,7 @@ THREE.IcosahedronGeometry.prototype.clone = function () {
this.parameters.detail
);
THREE.PolyhedronGeometry.prototype.cloneProperties.call( this, geometry );
THREE.PolyhedronGeometry.prototype._copyFrom.call( geometry, this );
return geometry;
......
......@@ -32,7 +32,7 @@ THREE.OctahedronGeometry.prototype.clone = function () {
this.parameters.detail
);
THREE.PolyhedronGeometry.prototype.cloneProperties.call( this, geometry );
THREE.PolyhedronGeometry.prototype._copyFrom.call( geometry, this );
return geometry;
......
......@@ -104,7 +104,7 @@ THREE.PlaneBufferGeometry.prototype.clone = function () {
this.parameters.heightSegments
);
THREE.BufferGeometry.prototype.cloneProperties.call( this, geometry );
THREE.BufferGeometry.prototype._copyFrom.call( geometry, this );
return geometry;
......
......@@ -243,13 +243,13 @@ THREE.PolyhedronGeometry.prototype.clone = function () {
this.parameters.detail
);
return this.cloneProperties( geometry );
return geometry._copyFrom( this );
};
THREE.PolyhedronGeometry.prototype.cloneProperties = function ( geometry ) {
THREE.PolyhedronGeometry.prototype._copyFrom = function ( source ) {
THREE.Geometry.prototype.cloneProperties.call( this, geometry );
return geometry;
THREE.Geometry.prototype._copyFrom.call( this, source );
return this;
};
\ No newline at end of file
};
......@@ -112,7 +112,7 @@ THREE.SphereBufferGeometry.prototype.clone = function () {
this.parameters.thetaLength
);
THREE.BufferGeometry.prototype.cloneProperties.call( this, geometry );
THREE.BufferGeometry.prototype._copyFrom.call( geometry, this );
return geometry;
......
......@@ -33,7 +33,7 @@ THREE.TetrahedronGeometry.prototype.clone = function () {
this.parameters.detail
);
THREE.PolyhedronGeometry.prototype.cloneProperties.call( this, geometry );
THREE.PolyhedronGeometry.prototype._copyFrom.call( geometry, this );
return geometry;
......
......@@ -17,7 +17,7 @@ THREE.AmbientLight.prototype.clone = function () {
var light = new THREE.AmbientLight();
THREE.Light.prototype.cloneProperties.call( this, light );
THREE.Light.prototype._copyFrom.call( light, this );
return light;
......
......@@ -31,7 +31,7 @@ THREE.AreaLight.prototype.clone = function () {
var light = new THREE.AreaLight();
THREE.Light.prototype.cloneProperties.call( this, light );
THREE.Light.prototype._copyFrom.call( light, this );
light.normal.copy(this.normal);
light.right.copy(this.right);
......@@ -40,7 +40,7 @@ THREE.AreaLight.prototype.clone = function () {
light.height = this.height;
light.constantAttenuation = this.constantAttenuation;
light.linearAttenuation = this.linearAttenuation;
light.quadraticAttenuation = this.quadraticAttenuation
light.quadraticAttenuation = this.quadraticAttenuation;
return light;
......
......@@ -67,7 +67,7 @@ THREE.DirectionalLight.prototype.clone = function () {
var light = new THREE.DirectionalLight();
THREE.Light.prototype.cloneProperties.call( this, light );
THREE.Light.prototype._copyFrom.call( light, this );
light.target = this.target.clone();
......
......@@ -22,7 +22,7 @@ THREE.HemisphereLight.prototype.clone = function () {
var light = new THREE.HemisphereLight();
THREE.Light.prototype.cloneProperties.call( this, light );
THREE.Light.prototype._copyFrom.call( light, this );
light.groundColor.copy( this.groundColor );
light.intensity = this.intensity;
......
......@@ -19,15 +19,15 @@ THREE.Light.prototype.constructor = THREE.Light;
THREE.Light.prototype.clone = function () {
var light = new THREE.Light();
return this.cloneProperties( light );
return light._copyFrom( this );
};
THREE.Light.prototype.cloneProperties = function ( light ) {
THREE.Light.prototype._copyFrom = function ( source ) {
THREE.Object3D.prototype.cloneProperties.call( this, light );
light.color.copy( this.color );
THREE.Object3D.prototype._copyFrom.call( this, source );
this.color.copy( source.color );
return light;
return this;
};
......@@ -21,7 +21,7 @@ THREE.PointLight.prototype.clone = function () {
var light = new THREE.PointLight();
THREE.Light.prototype.cloneProperties.call( this, light );
THREE.Light.prototype._copyFrom.call( light, this );
light.intensity = this.intensity;
light.distance = this.distance;
......
......@@ -50,7 +50,7 @@ THREE.SpotLight.prototype.clone = function () {
var light = new THREE.SpotLight();
THREE.Light.prototype.cloneProperties.call( this, light );
THREE.Light.prototype._copyFrom.call( light, this );
light.target = this.target.clone();
......
......@@ -47,7 +47,7 @@ THREE.LineBasicMaterial.prototype.clone = function () {
var material = new THREE.LineBasicMaterial();
THREE.Material.prototype.cloneProperties.call( this, material );
THREE.Material.prototype._copyFrom.call( material, this );
material.color.copy( this.color );
......
......@@ -50,7 +50,7 @@ THREE.LineDashedMaterial.prototype.clone = function () {
var material = new THREE.LineDashedMaterial();
THREE.Material.prototype.cloneProperties.call( this, material );
THREE.Material.prototype._copyFrom.call( material, this );
material.color.copy( this.color );
......
......@@ -164,43 +164,43 @@ THREE.Material.prototype = {
clone: function () {
var material = new THREE.Material();
return this.cloneProperties( material );
return material._copyFrom( this );
},
cloneProperties: function ( material ) {
_copyFrom: function ( source ) {
material.name = this.name;
this.name = source.name;
material.side = this.side;
this.side = source.side;
material.opacity = this.opacity;
material.transparent = this.transparent;
this.opacity = source.opacity;
this.transparent = source.transparent;
material.blending = this.blending;
this.blending = source.blending;
material.blendSrc = this.blendSrc;
material.blendDst = this.blendDst;
material.blendEquation = this.blendEquation;
material.blendSrcAlpha = this.blendSrcAlpha;
material.blendDstAlpha = this.blendDstAlpha;
material.blendEquationAlpha = this.blendEquationAlpha;
this.blendSrc = source.blendSrc;
this.blendDst = source.blendDst;
this.blendEquation = source.blendEquation;
this.blendSrcAlpha = source.blendSrcAlpha;
this.blendDstAlpha = source.blendDstAlpha;
this.blendEquationAlpha = source.blendEquationAlpha;
material.depthFunc = this.depthFunc;
material.depthTest = this.depthTest;
material.depthWrite = this.depthWrite;
this.depthFunc = source.depthFunc;
this.depthTest = source.depthTest;
this.depthWrite = source.depthWrite;
material.polygonOffset = this.polygonOffset;
material.polygonOffsetFactor = this.polygonOffsetFactor;
material.polygonOffsetUnits = this.polygonOffsetUnits;
this.polygonOffset = source.polygonOffset;
this.polygonOffsetFactor = source.polygonOffsetFactor;
this.polygonOffsetUnits = source.polygonOffsetUnits;
material.alphaTest = this.alphaTest;
this.alphaTest = source.alphaTest;
material.overdraw = this.overdraw;
this.overdraw = source.overdraw;
material.visible = this.visible;
this.visible = source.visible;
return material;
return this;
},
......
......@@ -83,7 +83,7 @@ THREE.MeshBasicMaterial.prototype.clone = function () {
var material = new THREE.MeshBasicMaterial();
THREE.Material.prototype.cloneProperties.call( this, material );
THREE.Material.prototype._copyFrom.call( material, this );
material.color.copy( this.color );
......
......@@ -35,7 +35,7 @@ THREE.MeshDepthMaterial.prototype.clone = function () {
var material = new THREE.MeshDepthMaterial();
THREE.Material.prototype.cloneProperties.call( this, material );
THREE.Material.prototype._copyFrom.call( material, this );
material.wireframe = this.wireframe;
material.wireframeLinewidth = this.wireframeLinewidth;
......
......@@ -82,7 +82,7 @@ THREE.MeshLambertMaterial.prototype.clone = function () {
var material = new THREE.MeshLambertMaterial();
THREE.Material.prototype.cloneProperties.call( this, material );
THREE.Material.prototype._copyFrom.call( material, this );
material.color.copy( this.color );
material.emissive.copy( this.emissive );
......
......@@ -36,7 +36,7 @@ THREE.MeshNormalMaterial.prototype.clone = function () {
var material = new THREE.MeshNormalMaterial();
THREE.Material.prototype.cloneProperties.call( this, material );
THREE.Material.prototype._copyFrom.call( material, this );
material.wireframe = this.wireframe;
material.wireframeLinewidth = this.wireframeLinewidth;
......
......@@ -116,7 +116,7 @@ THREE.MeshPhongMaterial.prototype.clone = function () {
var material = new THREE.MeshPhongMaterial();
THREE.Material.prototype.cloneProperties.call( this, material );
THREE.Material.prototype._copyFrom.call( material, this );
material.color.copy( this.color );
material.emissive.copy( this.emissive );
......
......@@ -48,7 +48,7 @@ THREE.PointCloudMaterial.prototype.clone = function () {
var material = new THREE.PointCloudMaterial();
THREE.Material.prototype.cloneProperties.call( this, material );
THREE.Material.prototype._copyFrom.call( material, this );
material.color.copy( this.color );
......
......@@ -17,7 +17,7 @@ THREE.RawShaderMaterial.prototype.clone = function () {
var material = new THREE.RawShaderMaterial();
THREE.ShaderMaterial.prototype.cloneProperties.call( this, material );
THREE.ShaderMaterial.prototype._copyFrom.call( material, this );
return material;
......
......@@ -92,39 +92,39 @@ THREE.ShaderMaterial.prototype.constructor = THREE.ShaderMaterial;
THREE.ShaderMaterial.prototype.clone = function () {
var material = new THREE.ShaderMaterial();
return this.clone( material );
return material._copyFrom( this );
};
THREE.ShaderMaterial.prototype.cloneProperties = function ( material ) {
THREE.ShaderMaterial.prototype._copyFrom = function ( source ) {
THREE.Material.prototype.cloneProperties.call( this, material );
THREE.Material.prototype._copyFrom.call( this, source );
material.fragmentShader = this.fragmentShader;
material.vertexShader = this.vertexShader;
this.fragmentShader = source.fragmentShader;
this.vertexShader = source.vertexShader;
material.uniforms = THREE.UniformsUtils.clone( this.uniforms );
this.uniforms = THREE.UniformsUtils.clone( source.uniforms );
material.attributes = this.attributes;
material.defines = this.defines;
this.attributes = source.attributes;
this.defines = source.defines;
material.shading = this.shading;
this.shading = source.shading;
material.wireframe = this.wireframe;
material.wireframeLinewidth = this.wireframeLinewidth;
this.wireframe = source.wireframe;
this.wireframeLinewidth = source.wireframeLinewidth;
material.fog = this.fog;
this.fog = source.fog;
material.lights = this.lights;
this.lights = source.lights;
material.vertexColors = this.vertexColors;
this.vertexColors = source.vertexColors;
material.skinning = this.skinning;
this.skinning = source.skinning;
material.morphTargets = this.morphTargets;
material.morphNormals = this.morphNormals;
this.morphTargets = source.morphTargets;
this.morphNormals = source.morphNormals;
return material;
return this;
};
......
......@@ -43,7 +43,7 @@ THREE.SpriteMaterial.prototype.clone = function () {
var material = new THREE.SpriteMaterial();
THREE.Material.prototype.cloneProperties.call( this, material );
THREE.Material.prototype._copyFrom.call( material, this );
material.color.copy( this.color );
material.map = this.map;
......
......@@ -20,15 +20,15 @@ THREE.Bone.prototype.constructor = THREE.Bone;
THREE.Bone.prototype.clone = function () {
var bone = new THREE.Bone( this.skin );
return this.cloneProperties( bone );
return bone._copyFrom( this );
};
THREE.Bone.prototype.cloneProperties = function ( bone ) {
THREE.Bone.prototype._copyFrom = function ( source ) {
THREE.Object3D.prototype.cloneProperties.call( this, bone );
bone.skin = this.skin;
THREE.Object3D.prototype._copyFrom.call( this, source );
this.skin = source.skin;
return bone;
return this;
};
......@@ -16,13 +16,13 @@ THREE.Group.prototype.constructor = THREE.Group;
THREE.Group.prototype.clone = function () {
var group = new THREE.Group();
return this.cloneProperties( group );
return group._copyFrom( this );
};
THREE.Group.prototype.cloneProperties = function ( group ) {
THREE.Group.prototype._copyFrom = function ( source ) {
THREE.Object3D.prototype.cloneProperties.call( this, group );
return group;
THREE.Object3D.prototype._copyFrom.call( this, source );
return this;
};
......@@ -133,25 +133,25 @@ THREE.LOD.prototype.update = function () {
THREE.LOD.prototype.clone = function () {
var lod = new THREE.LOD();
return this.cloneProperties( lod );
return lod._copyFrom( this );
};
THREE.LOD.prototype.cloneProperties = function ( lod ) {
THREE.LOD.prototype._copyFrom = function ( source ) {
THREE.Object3D.prototype.cloneProperties.call( this, lod, false );
THREE.Object3D.prototype._copyFrom.call( this, source, false );
var levels = this.levels;
var levels = source.levels;
for ( var i = 0, l = levels.length; i < l; i ++ ) {
var level = levels[ i ];
lod.addLevel( level.object.clone(), level.distance );
this.addLevel( level.object.clone(), level.distance );
}
return lod;
return this;
};
......@@ -81,23 +81,23 @@ THREE.LensFlare.prototype.updateLensFlares = function () {
THREE.LensFlare.prototype.clone = function () {
var flare = new THREE.LensFlare();
return this.cloneProperties( flare );
return flare._copyFrom( this );
};
THREE.LensFlare.prototype.cloneProperties = function ( flare ) {
THREE.LensFlare.prototype._copyFrom = function ( source ) {
THREE.Object3D.prototype.cloneProperties.call( this, flare );
THREE.Object3D.prototype._copyFrom.call( this, source );
flare.positionScreen.copy( this.positionScreen );
flare.customUpdateCallback = this.customUpdateCallback;
this.positionScreen.copy( source.positionScreen );
this.customUpdateCallback = source.customUpdateCallback;
for ( var i = 0, l = this.lensFlares.length; i < l; i ++ ) {
for ( var i = 0, l = source.lensFlares.length; i < l; i ++ ) {
flare.lensFlares.push( this.lensFlares[ i ] );
this.lensFlares.push( source.lensFlares[ i ] );
}
return flare;
return this;
};
\ No newline at end of file
};
......@@ -186,14 +186,14 @@ THREE.Line.prototype.raycast = ( function () {
THREE.Line.prototype.clone = function () {
var line = new THREE.Line( this.geometry, this.material );
return this.cloneProperties( line );
return line._copyFrom( this );
};
THREE.Line.prototype.cloneProperties = function ( line ) {
THREE.Line.prototype._copyFrom = function ( source ) {
THREE.Object3D.prototype.cloneProperties.call( this, line );
return line;
THREE.Object3D.prototype._copyFrom.call( this, source );
return this;
};
......
......@@ -17,7 +17,7 @@ THREE.LineSegments.prototype.clone = function () {
var line = new THREE.LineSegments( this.geometry, this.material );
THREE.Line.prototype.cloneProperties.call( this, line );
THREE.Line.prototype._copyFrom.call( line, this );
return line;
......
......@@ -308,15 +308,14 @@ THREE.Mesh.prototype.raycast = ( function () {
THREE.Mesh.prototype.clone = function () {
var mesh = new THREE.Mesh( this.geometry, this.material );
return this.cloneProperties( mesh );
return mesh._copyFrom( this );
};
THREE.Mesh.prototype.cloneProperties = function ( mesh ) {
THREE.Mesh.prototype._copyFrom = function ( source ) {
THREE.Object3D.prototype.cloneProperties.call( this, mesh );
return mesh;
THREE.Object3D.prototype._copyFrom.call( this, source );
return this;
};
......
......@@ -195,24 +195,24 @@ THREE.MorphAnimMesh.prototype.interpolateTargets = function ( a, b, t ) {
THREE.MorphAnimMesh.prototype.clone = function () {
var morph = new THREE.MorphAnimMesh( this.geometry, this.material );
return this.cloneProperties( morph );
return morph._copyFrom( this );
};
THREE.MorphAnimMesh.prototype.cloneProperties = function ( morph ) {
THREE.MorphAnimMesh.prototype._copyFrom = function ( source ) {
morph.duration = this.duration;
morph.mirroredLoop = this.mirroredLoop;
morph.time = this.time;
this.duration = source.duration;
this.mirroredLoop = source.mirroredLoop;
this.time = source.time;
morph.lastKeyframe = this.lastKeyframe;
morph.currentKeyframe = this.currentKeyframe;
this.lastKeyframe = source.lastKeyframe;
this.currentKeyframe = source.currentKeyframe;
morph.direction = this.direction;
morph.directionBackwards = this.directionBackwards;
this.direction = source.direction;
this.directionBackwards = source.directionBackwards;
THREE.Mesh.prototype.cloneProperties.call( this, morph );
THREE.Mesh.prototype._copyFrom.call( this, source );
return morph;
return this;
};
......@@ -139,14 +139,14 @@ THREE.PointCloud.prototype.raycast = ( function () {
THREE.PointCloud.prototype.clone = function () {
var pointCloud = new THREE.PointCloud( this.geometry, this.material );
return this.cloneProperties( pointCloud );
return pointCloud._copyFrom( this );
};
THREE.PointCloud.prototype.cloneProperties = function ( pointCloud ) {
THREE.PointCloud.prototype._copyFrom = function ( source ) {
THREE.Object3D.prototype.cloneProperties.call( this, pointCloud );
return pointCloud;
THREE.Object3D.prototype._copyFrom.call( this, source );
return this;
};
......
......@@ -157,13 +157,13 @@ THREE.SkinnedMesh.prototype.updateMatrixWorld = function( force ) {
THREE.SkinnedMesh.prototype.clone = function() {
var skinMesh = new THREE.SkinnedMesh( this.geometry, this.material, this.useVertexTexture );
return this.cloneProperties( skinMesh );
return skinMesh._copyFrom( this );
};
THREE.SkinnedMesh.prototype.cloneProperties = function( skinMesh ) {
THREE.SkinnedMesh.prototype._copyFrom = function( source ) {
THREE.Mesh.prototype.cloneProperties.call( this, skinMesh );
return skinMesh;
THREE.Mesh.prototype._copyFrom.call( this, source );
return this;
};
......@@ -63,14 +63,14 @@ THREE.Sprite.prototype.raycast = ( function () {
THREE.Sprite.prototype.clone = function () {
var sprite = new THREE.Sprite( this.material );
return this.cloneProperties( sprite );
return sprite._copyFrom( this );
};
THREE.Sprite.prototype.cloneProperties = function ( sprite ) {
THREE.Sprite.prototype._copyFrom = function ( source ) {
THREE.Object3D.prototype.cloneProperties.call( this, sprite );
return sprite;
THREE.Object3D.prototype._copyFrom.call( this, source );
return this;
};
......
......@@ -21,22 +21,20 @@ THREE.Scene.prototype.constructor = THREE.Scene;
THREE.Scene.prototype.clone = function () {
var scene = new THREE.Scene();
return this.cloneProperties( scene );
return scene._copyFrom( this );
};
THREE.Scene.prototype.cloneProperties = function ( scene ) {
THREE.Scene.prototype._copyFrom = function ( source ) {
if ( scene === undefined ) scene = new THREE.Scene();
THREE.Object3D.prototype._copyFrom.call( this, source );
THREE.Object3D.prototype.cloneProperties.call( this, scene );
if ( source.fog !== null ) this.fog = source.fog.clone();
if ( source.overrideMaterial !== null ) this.overrideMaterial = source.overrideMaterial.clone();
if ( this.fog !== null ) scene.fog = this.fog.clone();
if ( this.overrideMaterial !== null ) scene.overrideMaterial = this.overrideMaterial.clone();
this.autoUpdate = source.autoUpdate;
this.matrixAutoUpdate = source.matrixAutoUpdate;
scene.autoUpdate = this.autoUpdate;
scene.matrixAutoUpdate = this.matrixAutoUpdate;
return scene;
return this;
};
......@@ -28,7 +28,7 @@ THREE.CompressedTexture.prototype.clone = function () {
var texture = new THREE.CompressedTexture();
THREE.Texture.prototype.cloneProperties.call( this, texture );
THREE.Texture.prototype._copyFrom.call( texture, this );
return texture;
......
......@@ -20,7 +20,7 @@ THREE.CubeTexture.clone = function () {
var texture = new THREE.CubeTexture();
THREE.Texture.prototype.cloneProperties.call( this, texture );
THREE.Texture.prototype._copyFrom.call( texture, this );
texture.images = this.images;
......
......@@ -17,7 +17,7 @@ THREE.DataTexture.prototype.clone = function () {
var texture = new THREE.DataTexture();
THREE.Texture.prototype.cloneProperties.call( this, texture );
THREE.Texture.prototype._copyFrom.call( texture, this );
return texture;
......
......@@ -66,37 +66,37 @@ THREE.Texture.prototype = {
clone: function () {
var texture = new THREE.Texture();
return this.cloneProperties( texture );
return texture._copyFrom( this );
},
cloneProperties: function ( texture ) {
_copyFrom: function ( source ) {
texture.image = this.image;
texture.mipmaps = this.mipmaps.slice( 0 );
this.image = source.image;
this.mipmaps = source.mipmaps.slice( 0 );
texture.mapping = this.mapping;
this.mapping = source.mapping;
texture.wrapS = this.wrapS;
texture.wrapT = this.wrapT;
this.wrapS = source.wrapS;
this.wrapT = source.wrapT;
texture.magFilter = this.magFilter;
texture.minFilter = this.minFilter;
this.magFilter = source.magFilter;
this.minFilter = source.minFilter;
texture.anisotropy = this.anisotropy;
this.anisotropy = source.anisotropy;
texture.format = this.format;
texture.type = this.type;
this.format = source.format;
this.type = source.type;
texture.offset.copy( this.offset );
texture.repeat.copy( this.repeat );
this.offset.copy( source.offset );
this.repeat.copy( source.repeat );
texture.generateMipmaps = this.generateMipmaps;
texture.premultiplyAlpha = this.premultiplyAlpha;
texture.flipY = this.flipY;
texture.unpackAlignment = this.unpackAlignment;
this.generateMipmaps = source.generateMipmaps;
this.premultiplyAlpha = source.premultiplyAlpha;
this.flipY = source.flipY;
this.unpackAlignment = source.unpackAlignment;
return texture;
return this;
},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册