Skip to content

Commit

Permalink
add material.clone
Browse files Browse the repository at this point in the history
  • Loading branch information
gero3 committed Aug 6, 2012
1 parent 43daa51 commit 4b962fa
Show file tree
Hide file tree
Showing 13 changed files with 72 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/core/Color.js
Expand Up @@ -4,6 +4,7 @@


THREE.Color = function ( hex ) { THREE.Color = function ( hex ) {


if ( hex instanceof THREE.Color ) return this.clone();
if ( hex !== undefined ) this.setHex( hex ); if ( hex !== undefined ) this.setHex( hex );
return this; return this;


Expand Down
7 changes: 7 additions & 0 deletions src/materials/LineBasicMaterial.js
Expand Up @@ -38,3 +38,10 @@ THREE.LineBasicMaterial = function ( parameters ) {
}; };


THREE.LineBasicMaterial.prototype = Object.create( THREE.Material.prototype ); THREE.LineBasicMaterial.prototype = Object.create( THREE.Material.prototype );


THREE.LineBasicMaterial.prototype.clone = function(){
var returnValue = new THREE.LineBasicMaterial(this);
return returnValue;
};

5 changes: 5 additions & 0 deletions src/materials/Material.js
Expand Up @@ -39,4 +39,9 @@ THREE.Material = function ( parameters ) {


} }


THREE.Material.prototype.clone = function(){
var returnValue = new THREE.Material(this);
return returnValue;
};

THREE.MaterialCount = 0; THREE.MaterialCount = 0;
6 changes: 6 additions & 0 deletions src/materials/MeshBasicMaterial.js
Expand Up @@ -66,3 +66,9 @@ THREE.MeshBasicMaterial = function ( parameters ) {
}; };


THREE.MeshBasicMaterial.prototype = Object.create( THREE.Material.prototype ); THREE.MeshBasicMaterial.prototype = Object.create( THREE.Material.prototype );


THREE.MeshBasicMaterial.prototype.clone = function(){
var returnValue = new THREE.MeshBasicMaterial(this);
return returnValue;
};
5 changes: 5 additions & 0 deletions src/materials/MeshDepthMaterial.js
Expand Up @@ -27,3 +27,8 @@ THREE.MeshDepthMaterial = function ( parameters ) {
}; };


THREE.MeshDepthMaterial.prototype = Object.create( THREE.Material.prototype ); THREE.MeshDepthMaterial.prototype = Object.create( THREE.Material.prototype );

THREE.MeshDepthMaterial.prototype.clone = function(){
var returnValue = new THREE.MeshDepthMaterial(this);
return returnValue;
};
7 changes: 7 additions & 0 deletions src/materials/MeshFaceMaterial.js
Expand Up @@ -7,3 +7,10 @@ THREE.MeshFaceMaterial = function ( parameters ) {
THREE.Material.call( this, parameters ); THREE.Material.call( this, parameters );


}; };



THREE.MeshFaceMaterial.prototype.clone = function(){
var returnValue = new THREE.MeshFaceMaterial(this);
return returnValue;
};
6 changes: 6 additions & 0 deletions src/materials/MeshLambertMaterial.js
Expand Up @@ -76,3 +76,9 @@ THREE.MeshLambertMaterial = function ( parameters ) {
}; };


THREE.MeshLambertMaterial.prototype = Object.create( THREE.Material.prototype ); THREE.MeshLambertMaterial.prototype = Object.create( THREE.Material.prototype );

THREE.MeshLambertMaterial.prototype.clone = function(){
var returnValue = new THREE.MeshLambertMaterial(this);
returnValue.wrapRGB = this.wrapRGB.clone();
return returnValue;
};
6 changes: 6 additions & 0 deletions src/materials/MeshNormalMaterial.js
Expand Up @@ -27,3 +27,9 @@ THREE.MeshNormalMaterial = function ( parameters ) {
}; };


THREE.MeshNormalMaterial.prototype = Object.create( THREE.Material.prototype ); THREE.MeshNormalMaterial.prototype = Object.create( THREE.Material.prototype );


THREE.MeshNormalMaterial.prototype.clone = function(){
var returnValue = new THREE.MeshNormalMaterial(this);
return returnValue;
};
7 changes: 7 additions & 0 deletions src/materials/MeshPhongMaterial.js
Expand Up @@ -83,3 +83,10 @@ THREE.MeshPhongMaterial = function ( parameters ) {
}; };


THREE.MeshPhongMaterial.prototype = Object.create( THREE.Material.prototype ); THREE.MeshPhongMaterial.prototype = Object.create( THREE.Material.prototype );


THREE.MeshPhongMaterial.prototype.clone = function(){
var returnValue = new THREE.MeshPhongMaterial(this);
returnValue.wrapRGB = this.wrapRGB.clone();
return returnValue;
};
5 changes: 5 additions & 0 deletions src/materials/ParticleBasicMaterial.js
Expand Up @@ -38,3 +38,8 @@ THREE.ParticleBasicMaterial = function ( parameters ) {
}; };


THREE.ParticleBasicMaterial.prototype = Object.create( THREE.Material.prototype ); THREE.ParticleBasicMaterial.prototype = Object.create( THREE.Material.prototype );

THREE.ParticleBasicMaterial.prototype.clone = function(){
var returnValue = new THREE.ParticleBasicMaterial(this);
return returnValue;
};
5 changes: 5 additions & 0 deletions src/materials/ParticleCanvasMaterial.js
Expand Up @@ -21,3 +21,8 @@ THREE.ParticleCanvasMaterial = function ( parameters ) {
}; };


THREE.ParticleCanvasMaterial.prototype = Object.create( THREE.Material.prototype ); THREE.ParticleCanvasMaterial.prototype = Object.create( THREE.Material.prototype );

THREE.ParticleCanvasMaterial.prototype.clone = function(){
var returnValue = new THREE.ParticleCanvasMaterial(this);
return returnValue;
};
6 changes: 6 additions & 0 deletions src/materials/ParticleDOMMaterial.js
Expand Up @@ -9,3 +9,9 @@ THREE.ParticleDOMMaterial = function ( domElement ) {
this.domElement = domElement; this.domElement = domElement;


}; };


THREE.ParticleDOMMaterial.prototype.clone = function(){
var returnValue = new THREE.ParticleDOMMaterial(this);
return returnValue;
};
6 changes: 6 additions & 0 deletions src/materials/ShaderMaterial.js
Expand Up @@ -56,3 +56,9 @@ THREE.ShaderMaterial = function ( parameters ) {
}; };


THREE.ShaderMaterial.prototype = Object.create( THREE.Material.prototype ); THREE.ShaderMaterial.prototype = Object.create( THREE.Material.prototype );


THREE.ShaderMaterial.prototype.clone = function(){
var returnValue = new THREE.ShaderMaterial(this);
return returnValue;
};

0 comments on commit 4b962fa

Please sign in to comment.