mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-04-08 16:56:25 +00:00
It go fast
This commit is contained in:
@@ -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];
|
||||
}
|
||||
}
|
||||
@@ -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];
|
||||
}
|
||||
}
|
||||
19
engine/src/main/java/com/volmit/iris/util/WorldHeight.java
Normal file
19
engine/src/main/java/com/volmit/iris/util/WorldHeight.java
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user