Ver código fonte

Merge pull request #6355 from benaadams/resizeable-rendertarget

rendertarget resizable
Ricardo Cabello 10 anos atrás
pai
commit
292c93e20e
1 arquivos alterados com 7 adições e 2 exclusões
  1. 7 2
      src/renderers/WebGLRenderTarget.js

+ 7 - 2
src/renderers/WebGLRenderTarget.js

@@ -39,9 +39,14 @@ THREE.WebGLRenderTarget.prototype = {
 
 	setSize: function ( width, height ) {
 
-		this.width = width;
-		this.height = height;
+		if ( this.width !== width || this.height !== height ) {
 
+			this.width = width;
+			this.height = height;
+
+			this.dispose();
+
+		}
 	},
 
 	clone: function () {