- show preview on all gui pages

- move river settings to it's own page
- subtle elevation effect on the preview map
This commit is contained in:
dags- 2020-02-16 20:38:17 +00:00
parent a2c0b549b1
commit cd90d0ac72
6 changed files with 121 additions and 111 deletions

View File

@ -28,17 +28,6 @@ public class GeneratorSettings {
public BiomeNoise biomeEdgeNoise = new BiomeNoise();
/**
* RIVER PROPERTIES
*/
public River primaryRivers = new River(5, 2, 8, 25, 8, 0.75F);
public River secondaryRiver = new River(4, 1, 6, 15, 5, 0.75F);
public River tertiaryRivers = new River(3, 0, 4, 10, 4, 0.75F);
public Lake lake = new Lake();
@Serializable
public static class World {
@ -117,84 +106,4 @@ public class GeneratorSettings {
return Source.build(seed, scale, octaves).gain(gain).lacunarity(lacunarity).build(type).bias(-0.5);
}
}
@Serializable
public static class River {
@Range(min = 1, max = 10)
@Comment("Controls the depth of the river")
public int bedDepth;
@Range(min = 1, max = 10)
@Comment("Controls the height of river banks")
public int minBankHeight;
@Range(min = 1, max = 10)
@Comment("Controls the height of river banks")
public int maxBankHeight;
@Range(min = 1, max = 20)
@Comment("Controls the river-bed width")
public int bedWidth;
@Range(min = 1, max = 50)
@Comment("Controls the river-banks width")
public int bankWidth;
@Range(min = 0.0F, max = 1.0F)
@Comment("Controls how much rivers taper")
public float fade;
public River() {
}
public River(int depth, int minBank, int maxBank, int outer, int inner, float fade) {
this.minBankHeight = minBank;
this.maxBankHeight = maxBank;
this.bankWidth = outer;
this.bedWidth = inner;
this.bedDepth = depth;
this.fade = fade;
}
}
public static class Lake {
@Range(min = 0.0F, max = 1.0F)
@Comment("Controls the chance of a lake spawning")
public float chance = 0.2F;
@Range(min = 0F, max = 1F)
@Comment("The minimum distance along a river that a lake will spawn")
public float minStartDistance = 0.03F;
@Range(min = 0F, max = 1F)
@Comment("The maximum distance along a river that a lake will spawn")
public float maxStartDistance = 0.07F;
@Range(min = 1, max = 20)
@Comment("The max depth of the lake")
public int depth = 10;
@Range(min = 10, max = 50)
@Comment("The minimum size of the lake")
public int sizeMin = 50;
@Range(min = 50, max = 150)
@Comment("The maximum size of the lake")
public int sizeMax = 100;
@Range(min = 1, max = 10)
@Comment("The minimum bank height")
public int minBankHeight = 2;
@Range(min = 1, max = 10)
@Comment("The maximum bank height")
public int maxBankHeight = 10;
public Lake() {
}
}
}

View File

@ -0,0 +1,99 @@
package com.terraforged.core.settings;
import com.terraforged.core.util.serialization.annotation.Comment;
import com.terraforged.core.util.serialization.annotation.Range;
import com.terraforged.core.util.serialization.annotation.Serializable;
@Serializable
public class RiverSettings {
/**
* RIVER PROPERTIES
*/
public River primaryRivers = new River(5, 2, 8, 25, 8, 0.75F);
public River secondaryRiver = new River(4, 1, 6, 15, 5, 0.75F);
public River tertiaryRivers = new River(3, 0, 4, 10, 4, 0.75F);
public Lake lake = new Lake();
@Serializable
public static class River {
@Range(min = 1, max = 10)
@Comment("Controls the depth of the river")
public int bedDepth;
@Range(min = 1, max = 10)
@Comment("Controls the height of river banks")
public int minBankHeight;
@Range(min = 1, max = 10)
@Comment("Controls the height of river banks")
public int maxBankHeight;
@Range(min = 1, max = 20)
@Comment("Controls the river-bed width")
public int bedWidth;
@Range(min = 1, max = 50)
@Comment("Controls the river-banks width")
public int bankWidth;
@Range(min = 0.0F, max = 1.0F)
@Comment("Controls how much rivers taper")
public float fade;
public River() {
}
public River(int depth, int minBank, int maxBank, int outer, int inner, float fade) {
this.minBankHeight = minBank;
this.maxBankHeight = maxBank;
this.bankWidth = outer;
this.bedWidth = inner;
this.bedDepth = depth;
this.fade = fade;
}
}
public static class Lake {
@Range(min = 0.0F, max = 1.0F)
@Comment("Controls the chance of a lake spawning")
public float chance = 0.2F;
@Range(min = 0F, max = 1F)
@Comment("The minimum distance along a river that a lake will spawn")
public float minStartDistance = 0.03F;
@Range(min = 0F, max = 1F)
@Comment("The maximum distance along a river that a lake will spawn")
public float maxStartDistance = 0.07F;
@Range(min = 1, max = 20)
@Comment("The max depth of the lake")
public int depth = 10;
@Range(min = 10, max = 50)
@Comment("The minimum size of the lake")
public int sizeMin = 50;
@Range(min = 50, max = 150)
@Comment("The maximum size of the lake")
public int sizeMax = 100;
@Range(min = 1, max = 10)
@Comment("The minimum bank height")
public int minBankHeight = 2;
@Range(min = 1, max = 10)
@Comment("The maximum bank height")
public int maxBankHeight = 10;
public Lake() {
}
}
}

View File

@ -7,6 +7,8 @@ public class Settings {
public GeneratorSettings generator = new GeneratorSettings();
public RiverSettings rivers = new RiverSettings();
public FilterSettings filters = new FilterSettings();
public TerrainSettings terrain = new TerrainSettings();

View File

@ -12,8 +12,8 @@ public class TerrainSettings {
public Terrain plains = new Terrain(5F, 1F, 1F);
public Terrain hills = new Terrain(2F, 1F, 1F);
public Terrain dales = new Terrain(2F, 1F, 1F);
public Terrain plateau = new Terrain(1.5F, 1F, 1F);
public Terrain badlands = new Terrain(1.5F, 1F, 1F);
public Terrain plateau = new Terrain(2F, 1F, 1F);
public Terrain badlands = new Terrain(2F, 1F, 1F);
public Terrain torridonian = new Terrain(0.5F, 1F, 1F);
public Terrain mountains = new Terrain(0.5F, 1F, 1F);
public Terrain volcano = new Terrain(1F, 1F, 1F);

View File

@ -1,6 +1,6 @@
package com.terraforged.core.world.river;
import com.terraforged.core.settings.GeneratorSettings;
import com.terraforged.core.settings.RiverSettings;
import com.terraforged.core.world.heightmap.Levels;
public class LakeConfig {
@ -25,7 +25,7 @@ public class LakeConfig {
distanceMax = builder.distanceMax;
}
public static LakeConfig of(GeneratorSettings.Lake settings, Levels levels) {
public static LakeConfig of(RiverSettings.Lake settings, Levels levels) {
Builder builder = new Builder();
builder.chance = settings.chance;
builder.sizeMin = settings.sizeMin;

View File

@ -26,31 +26,31 @@ public class RiverManager {
this.heightmap = heightmap;
this.context = context;
this.primary = RiverConfig.builder(context.levels)
.bankHeight(context.settings.generator.primaryRivers.minBankHeight, context.settings.generator.primaryRivers.maxBankHeight)
.bankWidth(context.settings.generator.primaryRivers.bankWidth)
.bedWidth(context.settings.generator.primaryRivers.bedWidth)
.bedDepth(context.settings.generator.primaryRivers.bedDepth)
.fade(context.settings.generator.primaryRivers.fade)
.bankHeight(context.settings.rivers.primaryRivers.minBankHeight, context.settings.rivers.primaryRivers.maxBankHeight)
.bankWidth(context.settings.rivers.primaryRivers.bankWidth)
.bedWidth(context.settings.rivers.primaryRivers.bedWidth)
.bedDepth(context.settings.rivers.primaryRivers.bedDepth)
.fade(context.settings.rivers.primaryRivers.fade)
.length(2500)
.main(true)
.build();
this.secondary = RiverConfig.builder(context.levels)
.bankHeight(context.settings.generator.secondaryRiver.minBankHeight, context.settings.generator.secondaryRiver.maxBankHeight)
.bankWidth(context.settings.generator.secondaryRiver.bankWidth)
.bedWidth(context.settings.generator.secondaryRiver.bedWidth)
.bedDepth(context.settings.generator.secondaryRiver.bedDepth)
.fade(context.settings.generator.secondaryRiver.fade)
.bankHeight(context.settings.rivers.secondaryRiver.minBankHeight, context.settings.rivers.secondaryRiver.maxBankHeight)
.bankWidth(context.settings.rivers.secondaryRiver.bankWidth)
.bedWidth(context.settings.rivers.secondaryRiver.bedWidth)
.bedDepth(context.settings.rivers.secondaryRiver.bedDepth)
.fade(context.settings.rivers.secondaryRiver.fade)
.length(1000)
.build();
this.tertiary = RiverConfig.builder(context.levels)
.bankHeight(context.settings.generator.tertiaryRivers.minBankHeight, context.settings.generator.tertiaryRivers.maxBankHeight)
.bankWidth(context.settings.generator.tertiaryRivers.bankWidth)
.bedWidth(context.settings.generator.tertiaryRivers.bedWidth)
.bedDepth(context.settings.generator.tertiaryRivers.bedDepth)
.fade(context.settings.generator.tertiaryRivers.fade)
.bankHeight(context.settings.rivers.tertiaryRivers.minBankHeight, context.settings.rivers.tertiaryRivers.maxBankHeight)
.bankWidth(context.settings.rivers.tertiaryRivers.bankWidth)
.bedWidth(context.settings.rivers.tertiaryRivers.bedWidth)
.bedDepth(context.settings.rivers.tertiaryRivers.bedDepth)
.fade(context.settings.rivers.tertiaryRivers.fade)
.length(500)
.build();
this.lakes = LakeConfig.of(context.settings.generator.lake, context.levels);
this.lakes = LakeConfig.of(context.settings.rivers.lake, context.levels);
}
public void apply(Cell<Terrain> cell, float x, float z) {