tiledrect more efficient

v5stable
Ondřej Hruška 10 years ago
parent bb84d143a8
commit 0d5b6eb995
  1. 3
      src/mightypork/rogue/world/map/MapAccess.java
  2. 5
      src/mightypork/rogue/world/map/TileRenderContext.java
  3. 13
      src/mightypork/util/constraints/rect/builders/TiledRect.java

@ -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.
*

Loading…
Cancel
Save