Просмотр исходного кода

copy to null uses current target

ncannasse 7 лет назад
Родитель
Сommit
1edaeb6c18
2 измененных файлов с 5 добавлено и 3 удалено
  1. 4 2
      h3d/pass/Copy.hx
  2. 1 1
      h3d/scene/Renderer.hx

+ 4 - 2
h3d/pass/Copy.hx

@@ -17,7 +17,8 @@ class Copy extends ScreenFx<CopyShader> {
 	}
 
 	public function apply( from, to, ?blend : h3d.mat.BlendMode, ?customPass : h3d.mat.Pass ) {
-		engine.pushTarget(to);
+		if( to != null )
+			engine.pushTarget(to);
 		shader.texture = from;
 		if( customPass != null ) {
 			var old = pass;
@@ -35,7 +36,8 @@ class Copy extends ScreenFx<CopyShader> {
 			render();
 		}
 		shader.texture = null;
-		engine.popTarget();
+		if( to != null )
+			engine.popTarget();
 	}
 
 	public static function run( from : h3d.mat.Texture, to : h3d.mat.Texture, ?blend : h3d.mat.BlendMode, ?pass : h3d.mat.Pass ) {

+ 1 - 1
h3d/scene/Renderer.hx

@@ -102,7 +102,7 @@ class Renderer extends hxd.impl.AnyProps {
 	}
 
 	function copy( from, to, ?blend ) {
-		h3d.pass.Copy.run(from, to == null ? ctx.engine.getCurrentTarget() : to, blend);
+		h3d.pass.Copy.run(from, to, blend);
 	}
 
 	function setTarget( tex ) {