Browse Source

WebGLRenderTarget: Added copy().

Mr.doob 10 years ago
parent
commit
563e0f5fec
1 changed files with 23 additions and 16 deletions
  1. 23 16
      src/renderers/WebGLRenderTarget.js

+ 23 - 16
src/renderers/WebGLRenderTarget.js

@@ -52,32 +52,39 @@ THREE.WebGLRenderTarget.prototype = {
 
 	},
 
-	clone: function () {
+	copy: function ( source ) {
+
+		this.width = source.width;
+		this.height = source.height;
+
+		this.wrapS = source.wrapS;
+		this.wrapT = source.wrapT;
 
-		var tmp = new THREE.WebGLRenderTarget( this.width, this.height );
+		this.magFilter = source.magFilter;
+		this.minFilter = source.minFilter;
 
-		tmp.wrapS = this.wrapS;
-		tmp.wrapT = this.wrapT;
+		this.anisotropy = source.anisotropy;
 
-		tmp.magFilter = this.magFilter;
-		tmp.minFilter = this.minFilter;
+		this.offset.copy( source.offset );
+		this.repeat.copy( source.repeat );
 
-		tmp.anisotropy = this.anisotropy;
+		this.format = source.format;
+		this.type = source.type;
 
-		tmp.offset.copy( this.offset );
-		tmp.repeat.copy( this.repeat );
+		this.depthBuffer = source.depthBuffer;
+		this.stencilBuffer = source.stencilBuffer;
 
-		tmp.format = this.format;
-		tmp.type = this.type;
+		this.generateMipmaps = source.generateMipmaps;
 
-		tmp.depthBuffer = this.depthBuffer;
-		tmp.stencilBuffer = this.stencilBuffer;
+		this.shareDepthFrom = source.shareDepthFrom;
 
-		tmp.generateMipmaps = this.generateMipmaps;
+		return this;
 
-		tmp.shareDepthFrom = this.shareDepthFrom;
+	},
+
+	clone: function () {
 
-		return tmp;
+		return new THREE.WebGLRenderTarget().copy( this );
 
 	},