Pārlūkot izejas kodu

restriction on tileWrap for NPOT textures

ncannasse 10 gadi atpakaļ
vecāks
revīzija
396e1bbdac
2 mainītis faili ar 10 papildinājumiem un 1 dzēšanām
  1. 6 0
      h2d/Bitmap.hx
  2. 4 1
      h2d/Drawable.hx

+ 6 - 0
h2d/Bitmap.hx

@@ -9,6 +9,12 @@ class Bitmap extends Drawable {
 		this.tile = tile;
 		this.tile = tile;
 	}
 	}
 
 
+	override function set_tileWrap(b) {
+		if( b && tile != null && tile.getTexture().flags.has(IsNPOT) )
+			throw "Cannot set tileWrap on a non power-of-two texture";
+		return tileWrap = b;
+	}
+
 	override function getBoundsRec( relativeTo, out ) {
 	override function getBoundsRec( relativeTo, out ) {
 		super.getBoundsRec(relativeTo, out);
 		super.getBoundsRec(relativeTo, out);
 		if( tile != null ) addBounds(relativeTo, out, tile.dx, tile.dy, tile.width, tile.height);
 		if( tile != null ) addBounds(relativeTo, out, tile.dx, tile.dy, tile.width, tile.height);

+ 4 - 1
h2d/Drawable.hx

@@ -6,7 +6,7 @@ class Drawable extends Sprite {
 	public var alpha(get, set) : Float;
 	public var alpha(get, set) : Float;
 	public var blendMode : BlendMode;
 	public var blendMode : BlendMode;
 	public var filter : Bool;
 	public var filter : Bool;
-	public var tileWrap : Bool;
+	public var tileWrap(default, set) : Bool;
 	public var colorKey(default, set) : Null<Int>;
 	public var colorKey(default, set) : Null<Int>;
 	public var colorMatrix(get, set) : Null<h3d.Matrix>;
 	public var colorMatrix(get, set) : Null<h3d.Matrix>;
 	public var colorAdd(get, set) : Null<h3d.Vector>;
 	public var colorAdd(get, set) : Null<h3d.Vector>;
@@ -19,6 +19,9 @@ class Drawable extends Sprite {
 		color = new h3d.Vector(1, 1, 1, 1);
 		color = new h3d.Vector(1, 1, 1, 1);
 	}
 	}
 
 
+	function set_tileWrap(b) {
+		return tileWrap = b;
+	}
 
 
 	function get_colorAdd() {
 	function get_colorAdd() {
 		var s = getShader(h3d.shader.ColorAdd);
 		var s = getShader(h3d.shader.ColorAdd);