tiledrect more efficient
This commit is contained in:
@@ -40,5 +40,8 @@ public interface MapAccess {
|
||||
long getSeed();
|
||||
|
||||
|
||||
/**
|
||||
* @return level-specific noise generator
|
||||
*/
|
||||
NoiseGen getNoiseGen();
|
||||
}
|
||||
|
||||
@@ -27,6 +27,9 @@ public final class TileRenderContext implements RectBound {
|
||||
{
|
||||
this.map = map;
|
||||
this.tiler = drawArea.tiles(map.getWidth(), map.getHeight());
|
||||
|
||||
this.tiler.setOverlap(0.001);
|
||||
|
||||
this.noise = map.getNoiseGen();
|
||||
}
|
||||
|
||||
@@ -59,7 +62,7 @@ public final class TileRenderContext implements RectBound {
|
||||
@Override
|
||||
public Rect getRect()
|
||||
{
|
||||
return tiler.tile(x, y).grow(0.01); // important to avoid gaps b/w tiles when scaled.
|
||||
return tiler.tile(x, y);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ public class TiledRect extends RectProxy {
|
||||
final private Num perCol;
|
||||
|
||||
/** Left top tile */
|
||||
final private Rect aTile;
|
||||
private Rect aTile;
|
||||
|
||||
|
||||
public TiledRect(Rect source, int horizontal, int vertical)
|
||||
@@ -37,6 +37,17 @@ public class TiledRect extends RectProxy {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set tile overlap. Applies only to tile, not span.
|
||||
*
|
||||
* @param overlap how far to overlap to neighbouring tiles on all sides
|
||||
*/
|
||||
public void setOverlap(double overlap)
|
||||
{
|
||||
aTile = aTile.grow(overlap);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a tile.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user