Procházet zdrojové kódy

added output (if different from src)

Nicolas Cannasse před 11 roky
rodič
revize
45f037344b
1 změnil soubory, kde provedl 4 přidání a 2 odebrání
  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);
 		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( quality == 0 ) return;
 
 
+		if( output == null ) output = src;
+
 		var alloc = tmp == null;
 		var alloc = tmp == null;
 		if( alloc )
 		if( alloc )
 			tmp = new h3d.mat.Texture(src.width, src.height, [Target, TargetNoFlipY]);
 			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.texture = tmp;
 		shader.pixel.set(0, 1 / tmp.height);
 		shader.pixel.set(0, 1 / tmp.height);
-		engine.setTarget(src);
+		engine.setTarget(output);
 		render();
 		render();
 		engine.setTarget(null);
 		engine.setTarget(null);