Explorar o código

rendertarget resizable

drop current rendertarget when resized; will be recreated in next render
Ben Adams %!s(int64=10) %!d(string=hai) anos
pai
achega
d29d97fbbb
Modificáronse 1 ficheiros con 7 adicións e 2 borrados
  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 () {