It go fast

This commit is contained in:
cyberpwn
2022-06-26 20:01:47 -04:00
parent c209895389
commit cc70a30315
30 changed files with 815 additions and 56 deletions

View File

@@ -0,0 +1,22 @@
package com.volmit.iris.util;
public class FloatNoiseCache {
private final int width;
private final int height;
private final float[] cache;
public FloatNoiseCache(int width, int height)
{
this.width = width;
this.height = height;
cache = new float[width * height];
}
public void set(int x, int y, float v) {
this.cache[y % this.height * this.width + x % this.width] = v;
}
public float get(int x, int y) {
return this.cache[y % this.height * this.width + x % this.width];
}
}

View File

@@ -0,0 +1,22 @@
package com.volmit.iris.util;
public class ShortNoiseCache {
private final int width;
private final int height;
private final short[] cache;
public ShortNoiseCache(int width, int height)
{
this.width = width;
this.height = height;
cache = new short[width * height];
}
public void set(int x, int y, short v) {
this.cache[y % this.height * this.width + x % this.width] = v;
}
public short get(int x, int y) {
return this.cache[y % this.height * this.width + x % this.width];
}
}

View File

@@ -0,0 +1,19 @@
package com.volmit.iris.util;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class WorldHeight {
private final int minHeight;
private final int maxHeight;
public WorldHeight(int maxHeight) {
this(0, maxHeight);
}
public int getTotalHeight() {
return maxHeight - minHeight;
}
}