|
|
@ -51,11 +51,6 @@ public class TerrainGridTest extends SimpleApplication { |
|
|
|
app.start(); |
|
|
|
app.start(); |
|
|
|
} |
|
|
|
} |
|
|
|
private CharacterControl player3; |
|
|
|
private CharacterControl player3; |
|
|
|
private FractalSum base; |
|
|
|
|
|
|
|
private PerturbFilter perturb; |
|
|
|
|
|
|
|
private OptimizedErode therm; |
|
|
|
|
|
|
|
private SmoothFilter smooth; |
|
|
|
|
|
|
|
private IterativeFilter iterate; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void simpleInitApp() { |
|
|
|
public void simpleInitApp() { |
|
|
@ -106,41 +101,6 @@ public class TerrainGridTest extends SimpleApplication { |
|
|
|
|
|
|
|
|
|
|
|
this.mat_terrain.setFloat("terrainSize", 513); |
|
|
|
this.mat_terrain.setFloat("terrainSize", 513); |
|
|
|
|
|
|
|
|
|
|
|
this.base = new FractalSum(); |
|
|
|
|
|
|
|
this.base.setRoughness(0.7f); |
|
|
|
|
|
|
|
this.base.setFrequency(1.0f); |
|
|
|
|
|
|
|
this.base.setAmplitude(1.0f); |
|
|
|
|
|
|
|
this.base.setLacunarity(2.12f); |
|
|
|
|
|
|
|
this.base.setOctaves(8); |
|
|
|
|
|
|
|
this.base.setScale(0.02125f); |
|
|
|
|
|
|
|
this.base.addModulator(new NoiseModulator() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public float value(float... in) { |
|
|
|
|
|
|
|
return ShaderUtils.clamp(in[0] * 0.5f + 0.5f, 0, 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FilteredBasis ground = new FilteredBasis(this.base); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.perturb = new PerturbFilter(); |
|
|
|
|
|
|
|
this.perturb.setMagnitude(0.119f); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.therm = new OptimizedErode(); |
|
|
|
|
|
|
|
this.therm.setRadius(5); |
|
|
|
|
|
|
|
this.therm.setTalus(0.011f); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.smooth = new SmoothFilter(); |
|
|
|
|
|
|
|
this.smooth.setRadius(1); |
|
|
|
|
|
|
|
this.smooth.setEffect(0.7f); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.iterate = new IterativeFilter(); |
|
|
|
|
|
|
|
this.iterate.addPreFilter(this.perturb); |
|
|
|
|
|
|
|
this.iterate.addPostFilter(this.smooth); |
|
|
|
|
|
|
|
this.iterate.setFilter(this.therm); |
|
|
|
|
|
|
|
this.iterate.setIterations(1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ground.addPreFilter(this.iterate); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.terrain = new TerrainGrid("terrain", 65, 1025, new ImageBasedHeightMapGrid(assetManager, new Namer() { |
|
|
|
this.terrain = new TerrainGrid("terrain", 65, 1025, new ImageBasedHeightMapGrid(assetManager, new Namer() { |
|
|
|
public String getName(int x, int y) { |
|
|
|
public String getName(int x, int y) { |
|
|
|
return "Scenes/TerrainMountains/mountains_" + (x * 512) + "_" + (y * 512) + ".png"; |
|
|
|
return "Scenes/TerrainMountains/mountains_" + (x * 512) + "_" + (y * 512) + ".png"; |
|
|
|