diff --git a/src/main/java/ca/blarg/gdx/graphics/atlas/AutoGridTextureAtlas.java b/src/main/java/ca/blarg/gdx/graphics/atlas/AutoGridTextureAtlas.java index 8650e1a..103095d 100644 --- a/src/main/java/ca/blarg/gdx/graphics/atlas/AutoGridTextureAtlas.java +++ b/src/main/java/ca/blarg/gdx/graphics/atlas/AutoGridTextureAtlas.java @@ -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; diff --git a/src/main/java/ca/blarg/gdx/graphics/atlas/CustomGridTextureAtlas.java b/src/main/java/ca/blarg/gdx/graphics/atlas/CustomGridTextureAtlas.java index 99b7eb6..3840ce4 100644 --- a/src/main/java/ca/blarg/gdx/graphics/atlas/CustomGridTextureAtlas.java +++ b/src/main/java/ca/blarg/gdx/graphics/atlas/CustomGridTextureAtlas.java @@ -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()); } diff --git a/src/main/java/ca/blarg/gdx/graphics/atlas/TextureAtlas.java b/src/main/java/ca/blarg/gdx/graphics/atlas/TextureAtlas.java index fd8ce8c..489f8fe 100644 --- a/src/main/java/ca/blarg/gdx/graphics/atlas/TextureAtlas.java +++ b/src/main/java/ca/blarg/gdx/graphics/atlas/TextureAtlas.java @@ -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 tiles = new Array(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; }