9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-30 12:29:20 +00:00

Biome Styling

This commit is contained in:
Dan Macbook
2020-08-14 05:43:58 -04:00
parent 7f98aff531
commit 31bd6a0c0d
5 changed files with 134 additions and 211 deletions

View File

@@ -7,7 +7,6 @@ import com.volmit.iris.Iris;
import com.volmit.iris.gen.ContextualChunkGenerator;
import com.volmit.iris.gen.atomics.AtomicCache;
import com.volmit.iris.noise.CNG;
import com.volmit.iris.noise.RarityCellGenerator;
import com.volmit.iris.util.ArrayType;
import com.volmit.iris.util.DependsOn;
import com.volmit.iris.util.Desc;
@@ -40,13 +39,13 @@ public class IrisBiome extends IrisRegistrant implements IRare {
private KList<IrisEffect> effects = new KList<>();
@DontObfuscate
@DependsOn({"biomeStyle", "biomeZoom", "biomeScatter"})
@DependsOn({ "biomeStyle", "biomeZoom", "biomeScatter" })
@Desc("This changes the dispersion of the biome colors if multiple derivatives are chosen.")
private NoiseStyle biomeStyle = NoiseStyle.SIMPLEX;
@MinNumber(0.0001)
@DontObfuscate
@DependsOn({"biomeStyle", "biomeZoom", "biomeScatter"})
@DependsOn({ "biomeStyle", "biomeZoom", "biomeScatter" })
@Desc("This zooms in the biome colors if multiple derivatives are chosen")
private double biomeZoom = 1;
@@ -76,10 +75,15 @@ public class IrisBiome extends IrisRegistrant implements IRare {
private KList<Biome> biomeSkyScatter = new KList<>();
@DontObfuscate
@DependsOn({"children"})
@DependsOn({ "children" })
@Desc("If this biome has children biomes, and the gen layer chooses one of this biomes children, how much smaller will it be (inside of this biome). Higher values means a smaller biome relative to this biome's size. Set higher than 1.0 and below 3.0 for best results.")
private double childShrinkFactor = 1.5;
@DontObfuscate
@DependsOn({ "children" })
@Desc("If this biome has children biomes, and the gen layer chooses one of this biomes children, How will it be shaped?")
private NoiseStyle childStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE;
@ArrayType(min = 1, type = String.class)
@DontObfuscate
@Desc("List any biome names (file names without.json) here as children. Portions of this biome can sometimes morph into their children. Iris supports cyclic relationships such as A > B > A > B. Iris will stop checking 9 biomes down the tree.")
@@ -132,7 +136,7 @@ public class IrisBiome extends IrisRegistrant implements IRare {
private KList<IrisDepositGenerator> deposits = new KList<>();
private transient InferredType inferredType;
private transient AtomicCache<RarityCellGenerator<IrisBiome>> childrenCell = new AtomicCache<>();
private transient AtomicCache<CNG> childrenCell = new AtomicCache<>();
private transient AtomicCache<CNG> biomeGenerator = new AtomicCache<>();
private transient AtomicCache<Integer> maxHeight = new AtomicCache<>();
private transient AtomicCache<KList<IrisBiome>> realChildren = new AtomicCache<>();
@@ -159,13 +163,9 @@ public class IrisBiome extends IrisRegistrant implements IRare {
});
}
public RarityCellGenerator<IrisBiome> getChildrenGenerator(RNG random, int sig, double scale) {
return childrenCell.aquire(() -> {
RarityCellGenerator<IrisBiome> childrenCell = new RarityCellGenerator<IrisBiome>(
random.nextParallelRNG(sig * 2137));
childrenCell.setCellScale(scale);
return childrenCell;
});
public CNG getChildrenGenerator(RNG random, int sig, double scale) {
return childrenCell
.aquire(() -> getChildStyle().create(random.nextParallelRNG(sig * 2137)).bake().scale(scale).bake());
}
public KList<BlockData> generateLayers(double wx, double wz, RNG random, int maxDepth, int height) {

View File

@@ -57,6 +57,14 @@ public class IrisDimension extends IrisRegistrant {
@Desc("The cave web scale. Smaller values means scaled up vein networks.")
private double caveScale = 1D;
@DontObfuscate
@Desc("The placement style of regions")
private NoiseStyle regionStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE;
@DontObfuscate
@Desc("The placement style of land/sea")
private NoiseStyle continentalStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE;
@MinNumber(-256)
@MaxNumber(256)
@DontObfuscate
@@ -211,18 +219,6 @@ public class IrisDimension extends IrisRegistrant {
@Desc("Change the size of regions")
private double regionZoom = 1;
@MinNumber(0)
@MaxNumber(8192)
@DontObfuscate
@Desc("The shuffle of regions")
private double regionShuffle = 11;
@MinNumber(0)
@MaxNumber(8192)
@DontObfuscate
@Desc("The shuffle of land vs sea")
private double continentalShuffle = 99;
@DontObfuscate
@Desc("Disable this to stop placing schematics in biomes")
private boolean placeObjects = true;

View File

@@ -22,8 +22,7 @@ import lombok.EqualsAndHashCode;
@Desc("Represents an iris region")
@Data
@EqualsAndHashCode(callSuper = false)
public class IrisRegion extends IrisRegistrant implements IRare
{
public class IrisRegion extends IrisRegistrant implements IRare {
@MinNumber(2)
@Required
@DontObfuscate
@@ -51,11 +50,6 @@ public class IrisRegion extends IrisRegistrant implements IRare
@DontObfuscate
@Desc("The min shore height")
private double shoreHeightMin = 1.2;
@DontObfuscate
@MinNumber(0)
@Desc("The scrambling between biomes")
private double biomeShuffle = 11;
@MinNumber(0)
@DontObfuscate
@@ -165,33 +159,29 @@ public class IrisRegion extends IrisRegistrant implements IRare
private transient AtomicCache<KList<IrisBiome>> realSkylandBiomes = new AtomicCache<>();
private transient AtomicCache<KList<IrisBiome>> realCaveBiomes = new AtomicCache<>();
public double getBiomeZoom(InferredType t)
{
switch(t)
{
case CAVE:
return caveBiomeZoom;
case ISLAND:
return islandBiomeZoom;
case LAND:
return landBiomeZoom;
case SEA:
return seaBiomeZoom;
case SHORE:
return shoreBiomeZoom;
case SKYLAND:
return skylandBiomeZoom;
default:
break;
public double getBiomeZoom(InferredType t) {
switch (t) {
case CAVE:
return caveBiomeZoom;
case ISLAND:
return islandBiomeZoom;
case LAND:
return landBiomeZoom;
case SEA:
return seaBiomeZoom;
case SHORE:
return shoreBiomeZoom;
case SKYLAND:
return skylandBiomeZoom;
default:
break;
}
return 1;
}
public KList<String> getRidgeBiomeKeys()
{
return cacheRidge.aquire(() ->
{
public KList<String> getRidgeBiomeKeys() {
return cacheRidge.aquire(() -> {
KList<String> cacheRidge = new KList<String>();
ridgeBiomes.forEach((i) -> cacheRidge.add(i.getBiome()));
@@ -199,31 +189,27 @@ public class IrisRegion extends IrisRegistrant implements IRare
});
}
public KList<String> getSpotBiomeKeys()
{
return cacheSpot.aquire(() ->
{
public KList<String> getSpotBiomeKeys() {
return cacheSpot.aquire(() -> {
KList<String> cacheSpot = new KList<String>();
spotBiomes.forEach((i) -> cacheSpot.add(i.getBiome()));
return cacheSpot;
});
}
public CNG getShoreHeightGenerator()
{
return shoreHeightGenerator.aquire(() ->
{
return CNG.signature(new RNG((long) (getName().length() + getIslandBiomes().size() + getLandBiomeZoom() + getLandBiomes().size() + 3458612)));
public CNG getShoreHeightGenerator() {
return shoreHeightGenerator.aquire(() -> {
return CNG.signature(new RNG((long) (getName().length() + getIslandBiomes().size() + getLandBiomeZoom()
+ getLandBiomes().size() + 3458612)));
});
}
public double getShoreHeight(double x, double z)
{
return getShoreHeightGenerator().fitDouble(shoreHeightMin, shoreHeightMax, x / shoreHeightZoom, z / shoreHeightZoom);
public double getShoreHeight(double x, double z) {
return getShoreHeightGenerator().fitDouble(shoreHeightMin, shoreHeightMax, x / shoreHeightZoom,
z / shoreHeightZoom);
}
public KList<IrisBiome> getAllBiomes(ContextualChunkGenerator g)
{
public KList<IrisBiome> getAllBiomes(ContextualChunkGenerator g) {
KMap<String, IrisBiome> b = new KMap<>();
KSet<String> names = new KSet<>();
names.addAll(landBiomes);
@@ -235,12 +221,9 @@ public class IrisRegion extends IrisRegistrant implements IRare
spotBiomes.forEach((i) -> names.add(i.getBiome()));
ridgeBiomes.forEach((i) -> names.add(i.getBiome()));
while(!names.isEmpty())
{
for(String i : new KList<>(names))
{
if(b.containsKey(i))
{
while (!names.isEmpty()) {
for (String i : new KList<>(names)) {
if (b.containsKey(i)) {
names.remove(i);
continue;
}
@@ -255,49 +238,39 @@ public class IrisRegion extends IrisRegistrant implements IRare
return b.v();
}
public KList<IrisBiome> getBiomes(ContextualChunkGenerator g, InferredType type)
{
if(type.equals(InferredType.LAND))
{
public KList<IrisBiome> getBiomes(ContextualChunkGenerator g, InferredType type) {
if (type.equals(InferredType.LAND)) {
return getRealLandBiomes(g);
}
else if(type.equals(InferredType.SEA))
{
else if (type.equals(InferredType.SEA)) {
return getRealSeaBiomes(g);
}
else if(type.equals(InferredType.SHORE))
{
else if (type.equals(InferredType.SHORE)) {
return getRealShoreBiomes(g);
}
else if(type.equals(InferredType.CAVE))
{
else if (type.equals(InferredType.CAVE)) {
return getRealCaveBiomes(g);
}
else if(type.equals(InferredType.ISLAND))
{
else if (type.equals(InferredType.ISLAND)) {
return getRealIslandBiomes(g);
}
else if(type.equals(InferredType.SKYLAND))
{
else if (type.equals(InferredType.SKYLAND)) {
return getRealSkylandBiomes(g);
}
return new KList<>();
}
public KList<IrisBiome> getRealCaveBiomes(ContextualChunkGenerator g)
{
return realCaveBiomes.aquire(() ->
{
public KList<IrisBiome> getRealCaveBiomes(ContextualChunkGenerator g) {
return realCaveBiomes.aquire(() -> {
KList<IrisBiome> realCaveBiomes = new KList<>();
for(String i : getCaveBiomes())
{
for (String i : getCaveBiomes()) {
realCaveBiomes.add((g == null ? Iris.globaldata : g.getData()).getBiomeLoader().load(i));
}
@@ -305,14 +278,11 @@ public class IrisRegion extends IrisRegistrant implements IRare
});
}
public KList<IrisBiome> getRealSkylandBiomes(ContextualChunkGenerator g)
{
return realSkylandBiomes.aquire(() ->
{
public KList<IrisBiome> getRealSkylandBiomes(ContextualChunkGenerator g) {
return realSkylandBiomes.aquire(() -> {
KList<IrisBiome> realSkylandBiomes = new KList<>();
for(String i : getSkylandBiomes())
{
for (String i : getSkylandBiomes()) {
realSkylandBiomes.add((g == null ? Iris.globaldata : g.getData()).getBiomeLoader().load(i));
}
@@ -320,14 +290,11 @@ public class IrisRegion extends IrisRegistrant implements IRare
});
}
public KList<IrisBiome> getRealIslandBiomes(ContextualChunkGenerator g)
{
return realIslandBiomes.aquire(() ->
{
public KList<IrisBiome> getRealIslandBiomes(ContextualChunkGenerator g) {
return realIslandBiomes.aquire(() -> {
KList<IrisBiome> realIslandBiomes = new KList<>();
for(String i : getIslandBiomes())
{
for (String i : getIslandBiomes()) {
realIslandBiomes.add((g == null ? Iris.globaldata : g.getData()).getBiomeLoader().load(i));
}
@@ -335,14 +302,11 @@ public class IrisRegion extends IrisRegistrant implements IRare
});
}
public KList<IrisBiome> getRealShoreBiomes(ContextualChunkGenerator g)
{
return realShoreBiomes.aquire(() ->
{
public KList<IrisBiome> getRealShoreBiomes(ContextualChunkGenerator g) {
return realShoreBiomes.aquire(() -> {
KList<IrisBiome> realShoreBiomes = new KList<>();
for(String i : getShoreBiomes())
{
for (String i : getShoreBiomes()) {
realShoreBiomes.add((g == null ? Iris.globaldata : g.getData()).getBiomeLoader().load(i));
}
@@ -350,14 +314,11 @@ public class IrisRegion extends IrisRegistrant implements IRare
});
}
public KList<IrisBiome> getRealSeaBiomes(ContextualChunkGenerator g)
{
return realSeaBiomes.aquire(() ->
{
public KList<IrisBiome> getRealSeaBiomes(ContextualChunkGenerator g) {
return realSeaBiomes.aquire(() -> {
KList<IrisBiome> realSeaBiomes = new KList<>();
for(String i : getSeaBiomes())
{
for (String i : getSeaBiomes()) {
realSeaBiomes.add((g == null ? Iris.globaldata : g.getData()).getBiomeLoader().load(i));
}
@@ -365,14 +326,11 @@ public class IrisRegion extends IrisRegistrant implements IRare
});
}
public KList<IrisBiome> getRealLandBiomes(ContextualChunkGenerator g)
{
return realLandBiomes.aquire(() ->
{
public KList<IrisBiome> getRealLandBiomes(ContextualChunkGenerator g) {
return realLandBiomes.aquire(() -> {
KList<IrisBiome> realLandBiomes = new KList<>();
for(String i : getLandBiomes())
{
for (String i : getLandBiomes()) {
realLandBiomes.add((g == null ? Iris.globaldata : g.getData()).getBiomeLoader().load(i));
}