浏览代码

added output (if different from src)

Nicolas Cannasse 11 年之前
父节点
当前提交
45f037344b
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      h3d/pass/Blur.hx

+ 4 - 2
h3d/pass/Blur.hx

@@ -37,10 +37,12 @@ class Blur extends ScreenFx<h3d.shader.Blur> {
 		return p / Math.sqrt(2 * Math.PI * sq);
 	}
 
-	public function apply( src : h3d.mat.Texture, ?tmp : h3d.mat.Texture, isDepth = false ) {
+	public function apply( src : h3d.mat.Texture, ?tmp : h3d.mat.Texture, ?output : h3d.mat.Texture, isDepth = false ) {
 
 		if( quality == 0 ) return;
 
+		if( output == null ) output = src;
+
 		var alloc = tmp == null;
 		if( alloc )
 			tmp = new h3d.mat.Texture(src.width, src.height, [Target, TargetNoFlipY]);
@@ -71,7 +73,7 @@ class Blur extends ScreenFx<h3d.shader.Blur> {
 
 		shader.texture = tmp;
 		shader.pixel.set(0, 1 / tmp.height);
-		engine.setTarget(src);
+		engine.setTarget(output);
 		render();
 		engine.setTarget(null);