Stateless simplex
This commit is contained in:
@@ -44,9 +44,7 @@ public class MenuRenderer implements Disposable{
|
||||
Seq<Block> ores = content.blocks().select(b -> b instanceof OreBlock && !(b instanceof WallOreBlock));
|
||||
shadows = new FrameBuffer(width, height);
|
||||
int offset = Mathf.random(100000);
|
||||
Simplex s1 = new Simplex(offset);
|
||||
Simplex s2 = new Simplex(offset + 1);
|
||||
Simplex s3 = new Simplex(offset + 2);
|
||||
int s1 = offset, s2 = offset + 1, s3 = offset + 2;
|
||||
Block[] selected = Structs.select(
|
||||
new Block[]{Blocks.sand, Blocks.sandWall},
|
||||
new Block[]{Blocks.shale, Blocks.shaleWall},
|
||||
@@ -85,27 +83,27 @@ public class MenuRenderer implements Disposable{
|
||||
Block ore = Blocks.air;
|
||||
Block wall = Blocks.air;
|
||||
|
||||
if(s1.octaveNoise2D(3, 0.5, 1/20.0, x, y) > 0.5){
|
||||
if(Simplex.noise2d(s1, 3, 0.5, 1/20.0, x, y) > 0.5){
|
||||
wall = walld;
|
||||
}
|
||||
|
||||
if(s3.octaveNoise2D(3, 0.5, 1/20.0, x, y) > 0.5){
|
||||
if(Simplex.noise2d(s3, 3, 0.5, 1/20.0, x, y) > 0.5){
|
||||
floor = floord2;
|
||||
if(wall != Blocks.air){
|
||||
wall = walld2;
|
||||
}
|
||||
}
|
||||
|
||||
if(s2.octaveNoise2D(3, 0.3, 1/30.0, x, y) > tr1){
|
||||
if(Simplex.noise2d(s2, 3, 0.3, 1/30.0, x, y) > tr1){
|
||||
ore = ore1;
|
||||
}
|
||||
|
||||
if(s2.octaveNoise2D(2, 0.2, 1/15.0, x, y+99999) > tr2){
|
||||
if(Simplex.noise2d(s2, 2, 0.2, 1/15.0, x, y+99999) > tr2){
|
||||
ore = ore2;
|
||||
}
|
||||
|
||||
if(doheat){
|
||||
double heat = s3.octaveNoise2D(4, 0.6, 1 / 50.0, x, y + 9999);
|
||||
double heat = Simplex.noise2d(s3, 4, 0.6, 1 / 50.0, x, y + 9999);
|
||||
double base = 0.65;
|
||||
|
||||
if(heat > base){
|
||||
@@ -126,7 +124,7 @@ public class MenuRenderer implements Disposable{
|
||||
if(tech){
|
||||
int mx = x % secSize, my = y % secSize;
|
||||
int sclx = x / secSize, scly = y / secSize;
|
||||
if(s1.octaveNoise2D(2, 1f / 10f, 0.5f, sclx, scly) > 0.4f && (mx == 0 || my == 0 || mx == secSize - 1 || my == secSize - 1)){
|
||||
if(Simplex.noise2d(s1, 2, 1f / 10f, 0.5f, sclx, scly) > 0.4f && (mx == 0 || my == 0 || mx == secSize - 1 || my == secSize - 1)){
|
||||
floor = Blocks.darkPanel3;
|
||||
if(Mathf.dst(mx, my, secSize/2, secSize/2) > secSize/2f + 1){
|
||||
floor = Blocks.darkPanel4;
|
||||
@@ -140,7 +138,7 @@ public class MenuRenderer implements Disposable{
|
||||
}
|
||||
|
||||
if(tendrils){
|
||||
if(RidgedPerlin.noise2d(1 + offset, x, y, 1f / 17f) > 0f){
|
||||
if(Ridged.noise2d(1 + offset, x, y, 1f / 17f) > 0f){
|
||||
floor = Mathf.chance(0.2) ? Blocks.sporeMoss : Blocks.moss;
|
||||
|
||||
if(wall != Blocks.air){
|
||||
|
||||
@@ -12,7 +12,6 @@ public class SunMesh extends HexMesh{
|
||||
|
||||
public SunMesh(Planet planet, int divisions, double octaves, double persistence, double scl, double pow, double mag, float colorScale, Color... colors){
|
||||
super(planet, new HexMesher(){
|
||||
Simplex sim = new Simplex();
|
||||
|
||||
@Override
|
||||
public float getHeight(Vec3 position){
|
||||
@@ -21,7 +20,7 @@ public class SunMesh extends HexMesh{
|
||||
|
||||
@Override
|
||||
public Color getColor(Vec3 position){
|
||||
double height = Math.pow(sim.octaveNoise3D(octaves, persistence, scl, position.x, position.y, position.z), pow) * mag;
|
||||
double height = Math.pow(Simplex.noise3d(0, octaves, persistence, scl, position.x, position.y, position.z), pow) * mag;
|
||||
return Tmp.c1.set(colors[Mathf.clamp((int)(height * colors.length), 0, colors.length - 1)]).mul(colorScale);
|
||||
}
|
||||
}, divisions, Shaders.unlit);
|
||||
|
||||
Reference in New Issue
Block a user