diff --git a/src/materials/MeshPhongMaterial.js b/src/materials/MeshPhongMaterial.js index 594ddab2be2aaaba26c34926126e6561b0be05f0..efb3474f74b58ae61a76112e1be340581cc2ff53 100644 --- a/src/materials/MeshPhongMaterial.js +++ b/src/materials/MeshPhongMaterial.js @@ -112,59 +112,64 @@ THREE.MeshPhongMaterial = function ( parameters ) { THREE.MeshPhongMaterial.prototype = Object.create( THREE.Material.prototype ); THREE.MeshPhongMaterial.prototype.constructor = THREE.MeshPhongMaterial; -THREE.MeshPhongMaterial.prototype.clone = function () { +THREE.MeshPhongMaterial.prototype.copy = function ( source ) { - var material = new THREE.MeshPhongMaterial(); + THREE.Material.prototype.copy.call( this, source ); - THREE.Material.prototype.clone.call( this, material ); + this.color.copy( source.color ); + this.emissive.copy( source.emissive ); + this.specular.copy( source.specular ); + this.shininess = source.shininess; - material.color.copy( this.color ); - material.emissive.copy( this.emissive ); - material.specular.copy( this.specular ); - material.shininess = this.shininess; + this.metal = source.metal; - material.metal = this.metal; + this.map = source.map; - material.map = this.map; + this.lightMap = source.lightMap; + this.lightMapIntensity = source.lightMapIntensity; - material.lightMap = this.lightMap; - material.lightMapIntensity = this.lightMapIntensity; + this.aoMap = source.aoMap; + this.aoMapIntensity = source.aoMapIntensity; - material.aoMap = this.aoMap; - material.aoMapIntensity = this.aoMapIntensity; + this.emissiveMap = source.emissiveMap; - material.emissiveMap = this.emissiveMap; + this.bumpMap = source.bumpMap; + this.bumpScale = source.bumpScale; - material.bumpMap = this.bumpMap; - material.bumpScale = this.bumpScale; + this.normalMap = source.normalMap; + this.normalScale.copy( source.normalScale ); - material.normalMap = this.normalMap; - material.normalScale.copy( this.normalScale ); + this.specularMap = source.specularMap; - material.specularMap = this.specularMap; + this.alphaMap = source.alphaMap; - material.alphaMap = this.alphaMap; + this.envMap = source.envMap; + this.combine = source.combine; + this.reflectivity = source.reflectivity; + this.refractionRatio = source.refractionRatio; - material.envMap = this.envMap; - material.combine = this.combine; - material.reflectivity = this.reflectivity; - material.refractionRatio = this.refractionRatio; + this.fog = source.fog; - material.fog = this.fog; + this.shading = source.shading; - material.shading = this.shading; + this.wireframe = source.wireframe; + this.wireframeLinewidth = source.wireframeLinewidth; + this.wireframeLinecap = source.wireframeLinecap; + this.wireframeLinejoin = source.wireframeLinejoin; - material.wireframe = this.wireframe; - material.wireframeLinewidth = this.wireframeLinewidth; - material.wireframeLinecap = this.wireframeLinecap; - material.wireframeLinejoin = this.wireframeLinejoin; + this.vertexColors = source.vertexColors; - material.vertexColors = this.vertexColors; + this.skinning = source.skinning; + this.morphTargets = source.morphTargets; + this.morphNormals = source.morphNormals; - material.skinning = this.skinning; - material.morphTargets = this.morphTargets; - material.morphNormals = this.morphNormals; + return this; + +}; - return material; +THREE.MeshPhongMaterial.prototype.clone = function () { + + var material = new THREE.MeshPhongMaterial(); + return material.copy( this ); };