add optional MaterialTileMapping instance to TextureAtlas

This commit is contained in:
Gered 2014-04-15 16:55:22 -04:00
parent d8cb3f2a4a
commit de6f7ecc77
3 changed files with 25 additions and 1 deletions

View file

@ -12,8 +12,16 @@ public class AutoGridTextureAtlas extends TextureAtlas {
this(texture, tileWidth, tileHeight, tileBorder, TEXCOORD_EDGE_BLEED_OFFSET);
}
public AutoGridTextureAtlas(Texture texture, int tileWidth, int tileHeight, int tileBorder, MaterialTileMapping materialTileMapping) {
this(texture, tileWidth, tileHeight, tileBorder, materialTileMapping , TEXCOORD_EDGE_BLEED_OFFSET);
}
public AutoGridTextureAtlas(Texture texture, int tileWidth, int tileHeight, int tileBorder, float edgeCoordOffset) {
super(texture, edgeCoordOffset);
this(texture, tileWidth, tileHeight, tileBorder, null, edgeCoordOffset);
}
public AutoGridTextureAtlas(Texture texture, int tileWidth, int tileHeight, int tileBorder, MaterialTileMapping materialTileMapping, float edgeCoordOffset) {
super(texture, materialTileMapping, edgeCoordOffset);
this.tileWidth = tileWidth;
this.tileHeight = tileHeight;
this.tileBorder = tileBorder;

View file

@ -9,10 +9,18 @@ public class CustomGridTextureAtlas extends TextureAtlas {
this(texture, TEXCOORD_EDGE_BLEED_OFFSET);
}
public CustomGridTextureAtlas(Texture texture, MaterialTileMapping materialTileMapping) {
this(texture, materialTileMapping, TEXCOORD_EDGE_BLEED_OFFSET);
}
public CustomGridTextureAtlas(Texture texture, float edgeCoordOffset) {
super(texture, edgeCoordOffset);
}
public CustomGridTextureAtlas(Texture texture, MaterialTileMapping materialTileMapping, float edgeCoordOffset) {
super(texture, materialTileMapping, edgeCoordOffset);
}
public int add(Rectangle rect) {
return add((int)rect.x, (int)rect.y, (int)rect.getWidth(), (int)rect.getHeight());
}

View file

@ -20,6 +20,7 @@ public abstract class TextureAtlas {
public static final float TEXCOORD_EDGE_BLEED_OFFSET = 0.02f;
public final Texture texture;
public final MaterialTileMapping materialTileMapping;
protected final float edgeCoordOffset;
protected Array<TextureRegion> tiles = new Array<TextureRegion>(TextureRegion.class);
@ -27,6 +28,13 @@ public abstract class TextureAtlas {
public TextureAtlas(Texture texture, float edgeCoordOffset) {
this.texture = texture;
this.materialTileMapping = null;
this.edgeCoordOffset = edgeCoordOffset;
}
public TextureAtlas(Texture texture, MaterialTileMapping materialTileMapping, float edgeCoordOffset) {
this.texture = texture;
this.materialTileMapping = materialTileMapping;
this.edgeCoordOffset = edgeCoordOffset;
}