little performance gain in world render

v5stable
ondra 10 years ago
parent f8f49b81ff
commit 0619f83bfb
  1. 13
      src/mightypork/gamecore/render/Render.java
  2. 12
      src/mightypork/rogue/world/map/Level.java
  3. 4
      src/mightypork/rogue/world/map/MapAccess.java
  4. 2
      src/mightypork/rogue/world/map/TileRenderContext.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);

@ -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;
}
}

@ -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();
}

@ -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();
}

Loading…
Cancel
Save