why are noisemesh seeds planet id dependent? (#10374)

* NoiseMesh and HexSkyMesh seed no longer based on planet id

* asteroid seed fix
This commit is contained in:
coal deficit
2025-02-04 19:46:02 +01:00
committed by GitHub
parent 49221a1db4
commit 9643643d68
3 changed files with 10 additions and 10 deletions

View File

@@ -92,7 +92,7 @@ public class Planets{
}}; }};
//TODO names //TODO names
gier = makeAsteroid("gier", erekir, Blocks.ferricStoneWall, Blocks.carbonWall, 0.4f, 7, 1f, gen -> { gier = makeAsteroid("gier", erekir, Blocks.ferricStoneWall, Blocks.carbonWall, -5, 0.4f, 7, 1f, gen -> {
gen.min = 25; gen.min = 25;
gen.max = 35; gen.max = 35;
gen.carbonChance = 0.6f; gen.carbonChance = 0.6f;
@@ -100,7 +100,7 @@ public class Planets{
gen.berylChance = 0.1f; gen.berylChance = 0.1f;
}); });
notva = makeAsteroid("notva", sun, Blocks.ferricStoneWall, Blocks.beryllicStoneWall, 0.55f, 9, 1.3f, gen -> { notva = makeAsteroid("notva", sun, Blocks.ferricStoneWall, Blocks.beryllicStoneWall, -4, 0.55f, 9, 1.3f, gen -> {
gen.berylChance = 0.8f; gen.berylChance = 0.8f;
gen.iceChance = 0f; gen.iceChance = 0f;
gen.carbonChance = 0.01f; gen.carbonChance = 0.01f;
@@ -158,7 +158,7 @@ public class Planets{
landCloudColor = Pal.spore.cpy().a(0.5f); landCloudColor = Pal.spore.cpy().a(0.5f);
}}; }};
verilus = makeAsteroid("verlius", sun, Blocks.stoneWall, Blocks.iceWall, 0.5f, 12, 2f, gen -> { verilus = makeAsteroid("verlius", sun, Blocks.stoneWall, Blocks.iceWall, -1, 0.5f, 12, 2f, gen -> {
gen.berylChance = 0f; gen.berylChance = 0f;
gen.iceChance = 0.6f; gen.iceChance = 0.6f;
gen.carbonChance = 0.1f; gen.carbonChance = 0.1f;
@@ -166,7 +166,7 @@ public class Planets{
}); });
} }
private static Planet makeAsteroid(String name, Planet parent, Block base, Block tint, float tintThresh, int pieces, float scale, Cons<AsteroidGenerator> cgen){ private static Planet makeAsteroid(String name, Planet parent, Block base, Block tint, int seed, float tintThresh, int pieces, float scale, Cons<AsteroidGenerator> cgen){
return new Planet(name, parent, 0.12f){{ return new Planet(name, parent, 0.12f){{
hasAtmosphere = false; hasAtmosphere = false;
updateLighting = false; updateLighting = false;
@@ -189,13 +189,13 @@ public class Planets{
Rand rand = new Rand(id + 2); Rand rand = new Rand(id + 2);
meshes.add(new NoiseMesh( meshes.add(new NoiseMesh(
this, 0, 2, radius, 2, 0.55f, 0.45f, 14f, this, seed, 2, radius, 2, 0.55f, 0.45f, 14f,
color, tinted, 3, 0.6f, 0.38f, tintThresh color, tinted, 3, 0.6f, 0.38f, tintThresh
)); ));
for(int j = 0; j < pieces; j++){ for(int j = 0; j < pieces; j++){
meshes.add(new MatMesh( meshes.add(new MatMesh(
new NoiseMesh(this, j + 1, 1, 0.022f + rand.random(0.039f) * scale, 2, 0.6f, 0.38f, 20f, new NoiseMesh(this, seed + j + 1, 1, 0.022f + rand.random(0.039f) * scale, 2, 0.6f, 0.38f, 20f,
color, tinted, 3, 0.6f, 0.38f, tintThresh), color, tinted, 3, 0.6f, 0.38f, tintThresh),
new Mat3D().setToTranslation(Tmp.v31.setToRandomDirection(rand).setLength(rand.random(0.44f, 1.4f) * scale))) new Mat3D().setToTranslation(Tmp.v31.setToRandomDirection(rand).setLength(rand.random(0.44f, 1.4f) * scale)))
); );

View File

@@ -27,7 +27,7 @@ public class HexSkyMesh extends PlanetMesh{
@Override @Override
public boolean skip(Vec3 position){ public boolean skip(Vec3 position){
return Simplex.noise3d(planet.id + seed, octaves, persistence, scl, position.x, position.y * 3f, position.z) >= thresh; return Simplex.noise3d(7 + seed, octaves, persistence, scl, position.x, position.y * 3f, position.z) >= thresh;
} }
}, divisions, false, planet.radius, radius), Shaders.clouds); }, divisions, false, planet.radius, radius), Shaders.clouds);

View File

@@ -14,7 +14,7 @@ public class NoiseMesh extends HexMesh{
this.mesh = MeshBuilder.buildHex(new HexMesher(){ this.mesh = MeshBuilder.buildHex(new HexMesher(){
@Override @Override
public float getHeight(Vec3 position){ public float getHeight(Vec3 position){
return Simplex.noise3d(planet.id + seed, octaves, persistence, scale, 5f + position.x, 5f + position.y, 5f + position.z) * mag; return Simplex.noise3d(7 + seed, octaves, persistence, scale, 5f + position.x, 5f + position.y, 5f + position.z) * mag;
} }
@Override @Override
@@ -31,12 +31,12 @@ public class NoiseMesh extends HexMesh{
this.mesh = MeshBuilder.buildHex(new HexMesher(){ this.mesh = MeshBuilder.buildHex(new HexMesher(){
@Override @Override
public float getHeight(Vec3 position){ public float getHeight(Vec3 position){
return Simplex.noise3d(planet.id + seed, octaves, persistence, scale, 5f + position.x, 5f + position.y, 5f + position.z) * mag; return Simplex.noise3d(7 + seed, octaves, persistence, scale, 5f + position.x, 5f + position.y, 5f + position.z) * mag;
} }
@Override @Override
public Color getColor(Vec3 position){ public Color getColor(Vec3 position){
return Simplex.noise3d(planet.id + seed + 1, coct, cper, cscl, 5f + position.x, 5f + position.y, 5f + position.z) > cthresh ? color2 : color1; return Simplex.noise3d(8 + seed, coct, cper, cscl, 5f + position.x, 5f + position.y, 5f + position.z) > cthresh ? color2 : color1;
} }
}, divisions, false, radius, 0.2f); }, divisions, false, radius, 0.2f);
} }