فهرست منبع

fix for 0x0 mask

ncannasse 11 سال پیش
والد
کامیت
2813fbe685
1فایلهای تغییر یافته به همراه9 افزوده شده و 7 حذف شده
  1. 9 7
      h3d/impl/Stage3dDriver.hx

+ 9 - 7
h3d/impl/Stage3dDriver.hx

@@ -49,6 +49,7 @@ class Stage3dDriver extends Driver {
 	var antiAlias : Int;
 	var width : Int;
 	var height : Int;
+	var enableDraw : Bool;
 
 	@:allow(h3d.impl.VertexWrapper)
 	var empty : flash.utils.ByteArray;
@@ -65,6 +66,7 @@ class Stage3dDriver extends Driver {
 	}
 	
 	override function reset() {
+		enableDraw = true;
 		curMatBits = -1;
 		curShader = null;
 		curBuffer = null;
@@ -361,13 +363,14 @@ class Stage3dDriver extends Driver {
 	}
 	
 	override function draw( ibuf : IndexBuffer, startIndex : Int, ntriangles : Int ) {
-		ctx.drawTriangles(ibuf, startIndex, ntriangles);
+		if( enableDraw ) ctx.drawTriangles(ibuf, startIndex, ntriangles);
 	}
 
 	override function setRenderZone( x : Int, y : Int, width : Int, height : Int ) {
-		if( x == 0 && y == 0 && width < 0 && height < 0 )
+		if( x == 0 && y == 0 && width < 0 && height < 0 ) {
+			enableDraw = true;
 			ctx.setScissorRectangle(null);
-		else {
+		} else {
 			if( x < 0 ) {
 				width += x;
 				x = 0;
@@ -380,10 +383,9 @@ class Stage3dDriver extends Driver {
 			var th = inTarget == null ? this.height : 9999;
 			if( x + width > tw ) width = tw - x;
 			if( y + height > th ) height = th - y;
-			// for flash, width=0 means no scissor...
-			if( width <= 0 ) { x = tw; width = 1; };
-			if( height <= 0 ) { y = th; height = 1; };
-			ctx.setScissorRectangle(new flash.geom.Rectangle(x, y, width, height));
+			enableDraw = width > 0 && height > 0;
+			if( enableDraw )
+				ctx.setScissorRectangle(new flash.geom.Rectangle(x, y, width, height));
 		}
 	}