Stateless simplex (2)

This commit is contained in:
Anuken
2021-06-15 19:31:51 -04:00
parent eed91eaaa0
commit 97729fd659
3 changed files with 14 additions and 19 deletions

View File

@@ -7,16 +7,14 @@ import mindustry.graphics.*;
import mindustry.type.*;
public class NoiseMesh extends HexMesh{
Simplex sim;
public NoiseMesh(Planet planet, int seed, int divisions, Color color, float radius, int octaves, float persistence, float scale, float mag){
this.planet = planet;
this.sim = new Simplex(planet.id + seed);
this.shader = Shaders.planet;
this.mesh = MeshBuilder.buildHex(new HexMesher(){
@Override
public float getHeight(Vec3 position){
return (float)sim.octaveNoise3D(octaves, persistence, scale, 5f + position.x, 5f + position.y, 5f + position.z) * mag;
return (float)Simplex.noise3d(planet.id + seed, octaves, persistence, scale, 5f + position.x, 5f + position.y, 5f + position.z) * mag;
}
@Override