diff --git a/src/mightypork/gamecore/render/Render.java b/src/mightypork/gamecore/render/Render.java index 7b8f9c0..5ad4462 100644 --- a/src/mightypork/gamecore/render/Render.java +++ b/src/mightypork/gamecore/render/Render.java @@ -339,9 +339,9 @@ public class Render { */ private static void unbindTexture() { - //if (TextureImpl.getLastBind() != null) { - TextureImpl.bindNone(); - //} + if (TextureImpl.getLastBind() != null) { + TextureImpl.bindNone(); + } } @@ -368,7 +368,8 @@ public class Render { final RectDigest q = quad.digest(); // draw with color - unbindTexture(); + + glDisable(GL_TEXTURE_2D); // quad glBegin(GL_QUADS); @@ -454,7 +455,8 @@ public class Render { final RectDigest r = quad.digest(); // draw with color - unbindTexture(); + + glDisable(GL_TEXTURE_2D); glBegin(GL_QUADS); setColor(colorHMinVMax); @@ -495,6 +497,7 @@ public class Render { */ public static void quadTextured(Rect quad, Rect uvs, GLTexture texture, Color tint) { + glEnable(GL_TEXTURE_2D); bindTexture(texture); setColor(tint); quadUV(quad, uvs); diff --git a/src/mightypork/rogue/world/map/Level.java b/src/mightypork/rogue/world/map/Level.java index 9abf446..80b6666 100644 --- a/src/mightypork/rogue/world/map/Level.java +++ b/src/mightypork/rogue/world/map/Level.java @@ -13,6 +13,7 @@ import mightypork.rogue.world.tile.Tiles; import mightypork.util.files.ion.Ion; import mightypork.util.files.ion.IonConstructor; import mightypork.util.files.ion.Ionizable; +import mightypork.util.math.noise.NoiseGen; /** @@ -31,6 +32,8 @@ public class Level implements MapAccess, Ionizable { /** Level seed (used for generation and tile variation) */ public long seed; + + private NoiseGen noiseGen; @IonConstructor @@ -190,4 +193,13 @@ public class Level implements MapAccess, Ionizable { } } + @Override + public NoiseGen getNoiseGen() + { + if (noiseGen == null) { + noiseGen = new NoiseGen(0.2, 0, 0.5, 1, seed); + } + + return noiseGen; + } } diff --git a/src/mightypork/rogue/world/map/MapAccess.java b/src/mightypork/rogue/world/map/MapAccess.java index 4d09f4f..4172818 100644 --- a/src/mightypork/rogue/world/map/MapAccess.java +++ b/src/mightypork/rogue/world/map/MapAccess.java @@ -2,6 +2,7 @@ package mightypork.rogue.world.map; import mightypork.rogue.world.tile.Tile; +import mightypork.util.math.noise.NoiseGen; /** @@ -37,4 +38,7 @@ public interface MapAccess { * @return map seed */ long getSeed(); + + + NoiseGen getNoiseGen(); } diff --git a/src/mightypork/rogue/world/map/TileRenderContext.java b/src/mightypork/rogue/world/map/TileRenderContext.java index 31ff34a..625dff0 100644 --- a/src/mightypork/rogue/world/map/TileRenderContext.java +++ b/src/mightypork/rogue/world/map/TileRenderContext.java @@ -27,7 +27,7 @@ public final class TileRenderContext implements RectBound { { this.map = map; this.tiler = drawArea.tiles(map.getWidth(), map.getHeight()); - this.noise = new NoiseGen(0.2, 0, 0.5, 1, map.getSeed()); + this.noise = map.getNoiseGen(); }