浏览代码

rendertarget resizable

drop current rendertarget when resized; will be recreated in next render
Ben Adams 10 年之前
父节点
当前提交
d29d97fbbb
共有 1 个文件被更改,包括 7 次插入2 次删除
  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 () {