Explorar el Código

Added setters&getters, generate mipmaps by default to be backwards compatible, texture clone bugfix

Marius Kintel hace 9 años
padre
commit
db2694eb80
Se han modificado 1 ficheros con 25 adiciones y 5 borrados
  1. 25 5
      src/renderers/WebGLRenderTarget.js

+ 25 - 5
src/renderers/WebGLRenderTarget.js

@@ -14,11 +14,10 @@ THREE.WebGLRenderTarget = function ( width, height, options ) {
 
 	this.texture = new THREE.Texture(undefined, undefined, 
 																	 options.wrapS, options.wrapT,
-																	 options.magFilter, options.minFilter,
+																	 options.magFilter, 
+																	 options.minFilter !== undefined ? options.minFilter : THREE.LinearFilter,
 																	 options.format, options.type,
 																	 options.anisotropy);
-	// Don't generate mipmaps from target texture
-	this.texture.generateMipmaps = false;
 
 	this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;
 	this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : true;
@@ -55,7 +54,7 @@ THREE.WebGLRenderTarget.prototype = {
 		this.width = source.width;
 		this.height = source.height;
 
-		this.texture = this.texture.clone();
+		this.texture = source.texture.clone();
 
 		this.depthBuffer = source.depthBuffer;
 		this.stencilBuffer = source.stencilBuffer;
@@ -70,7 +69,28 @@ THREE.WebGLRenderTarget.prototype = {
 
 		this.dispatchEvent( { type: 'dispose' } );
 
-	}
+	},
+	
+	get wrapS() { return this.texture.wrapS; },
+	set wrapS(wrapS) { this.texture.wrapS = wrapS; },
+	get wrapT() { return this.texture.wrapT; },
+	set wrapT(wrapT) { this.texture.wrapT = wrapT; },
+	get magFilter() { return this.texture.magFilter; },
+	set magFilter(magFilter) { this.texture.magFilter = magFilter; },
+	get minFilter() { return this.texture.minFilter; },
+	set minFilter(minFilter) { this.texture.minFilter = minFilter; },
+	get anisotropy() { return this.texture.anisotropy; },
+	set anisotropy(anisotropy) { this.texture.anisotropy = anisotropy; },
+	get offset() { return this.texture.offset; },
+	set offset(offset) { this.texture.offset = offset; },
+	get repeat() { return this.texture.repeat; },
+	set repeat(repeat) { this.texture.repeat = repeat; },
+	get format() { return this.texture.format; },
+	set format(format) { this.texture.format = format; },
+	get type() { return this.texture.type; },
+	set type(type) { this.texture.type = type; },
+	get generateMipmaps() { return this.texture.generateMipmaps; },
+	set generateMipmaps(generateMipmaps) { this.texture.generateMipmaps = generateMipmaps; }
 
 };