소스 검색

Adding mip level param to CubeCopy.

clementlandrin 1 년 전
부모
커밋
1d91464092
1개의 변경된 파일5개의 추가작업 그리고 5개의 파일을 삭제
  1. 5 5
      h3d/pass/CubeCopy.hx

+ 5 - 5
h3d/pass/CubeCopy.hx

@@ -25,11 +25,11 @@ class CubeCopy extends ScreenFx<CubeCopyShader> {
 		super(new CubeCopyShader());
 	}
 
-	public function apply( from, to, ?blend : h3d.mat.BlendMode ) {
+	public function apply( from, to, ?blend : h3d.mat.BlendMode, mip : Int = 0 ) {
 		shader.texture = from;
 		for(i in 0 ... 6){
 			if( to != null )
-				engine.pushTarget(to, i);
+				engine.pushTarget(to, i, mip);
 			shader.mat = cubeDir[i];
 			pass.setBlendMode(blend == null ? None : blend);
 			render();
@@ -39,15 +39,15 @@ class CubeCopy extends ScreenFx<CubeCopyShader> {
 		shader.texture = null;
 	}
 
-	public static function run( from : h3d.mat.Texture, to : h3d.mat.Texture, ?blend : h3d.mat.BlendMode ) {
+	public static function run( from : h3d.mat.Texture, to : h3d.mat.Texture, ?blend : h3d.mat.BlendMode, mip : Int = 0 ) {
 		var engine = h3d.Engine.getCurrent();
-		if( to != null && from != null && (blend == null || blend == None) && engine.driver.copyTexture(from, to) )
+		if( to != null && from != null && (blend == null || blend == None) && mip == 0 && engine.driver.copyTexture(from, to) )
 			return;
 		var inst : CubeCopy = @:privateAccess engine.resCache.get(CubeCopy);
 		if( inst == null ) {
 			inst = new CubeCopy();
 			@:privateAccess engine.resCache.set(CubeCopy, inst);
 		}
-		return inst.apply(from, to, blend);
+		return inst.apply(from, to, blend, mip);
 	}
 }