9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-29 20:19:06 +00:00
This commit is contained in:
Daniel Mills
2020-11-22 13:00:24 -05:00
parent 34040abc8f
commit d6b7a4bdba
11 changed files with 219 additions and 100 deletions

View File

@@ -1,5 +1,6 @@
package com.volmit.iris.object;
import com.volmit.iris.generator.IrisComplex;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.generator.noise.CNG;
import com.volmit.iris.manager.IrisDataManager;
@@ -320,11 +321,11 @@ public class IrisBiome extends IrisRegistrant implements IRare
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, IrisDataManager rdata)
public KList<BlockData> generateLayers(double wx, double wz, RNG random, int maxDepth, int height, IrisDataManager rdata, IrisComplex complex)
{
if(isLockLayers())
{
return generateLockedLayers(wx, wz, random, maxDepth, height, rdata);
return generateLockedLayers(wx, wz, random, maxDepth, height, rdata, complex);
}
KList<BlockData> data = new KList<>();
@@ -337,9 +338,19 @@ public class IrisBiome extends IrisRegistrant implements IRare
for(int i = 0; i < layers.size(); i++)
{
CNG hgen = getLayerHeightGenerators(random, rdata).get(i);
int d = hgen.fit(layers.get(i).getMinHeight(), layers.get(i).getMaxHeight(), wx / layers.get(i).getZoom(), wz / layers.get(i).getZoom());
double d = hgen.fit(layers.get(i).getMinHeight(), layers.get(i).getMaxHeight(), wx / layers.get(i).getZoom(), wz / layers.get(i).getZoom());
if(d < 0)
IrisSlopeClip sc = getLayers().get(i).getSlopeCondition();
if(!sc.isDefault())
{
if(!sc.isValid(complex.getSlopeStream().get(wx, wz)))
{
d = 0;
}
}
if(d <= 0)
{
continue;
}
@@ -371,7 +382,7 @@ public class IrisBiome extends IrisRegistrant implements IRare
return data;
}
public KList<BlockData> generateLockedLayers(double wx, double wz, RNG random, int maxDepthf, int height, IrisDataManager rdata)
public KList<BlockData> generateLockedLayers(double wx, double wz, RNG random, int maxDepthf, int height, IrisDataManager rdata, IrisComplex complex)
{
KList<BlockData> data = new KList<>();
KList<BlockData> real = new KList<>();
@@ -384,9 +395,20 @@ public class IrisBiome extends IrisRegistrant implements IRare
for(int i = 0; i < layers.size(); i++)
{
CNG hgen = getLayerHeightGenerators(random, rdata).get(i);
int d = hgen.fit(layers.get(i).getMinHeight(), layers.get(i).getMaxHeight(), wx / layers.get(i).getZoom(), wz / layers.get(i).getZoom());
double d = hgen.fit(layers.get(i).getMinHeight(), layers.get(i).getMaxHeight(), wx / layers.get(i).getZoom(), wz / layers.get(i).getZoom());
if(d < 0)
IrisSlopeClip sc = getLayers().get(i).getSlopeCondition();
if(!sc.isDefault())
{
if(!sc.isValid(complex.getSlopeStream().get(wx, wz)))
{
d = 0;
}
}
if(d <= 0)
{
continue;
}

View File

@@ -44,6 +44,10 @@ public class IrisBiomePaletteLayer
@Desc("The max thickness of this layer")
private int maxHeight = 1;
@DontObfuscate
@Desc("If set, this layer will change size depending on the slope. If in bounds, the layer will get larger (taller) the closer to the center of this slope clip it is. If outside of the slipe's bounds, this layer will not show.")
private IrisSlopeClip slopeCondition = new IrisSlopeClip();
@MinNumber(0.0001)
@DontObfuscate
@Desc("The terrain zoom mostly for zooming in on a wispy palette")

View File

@@ -0,0 +1,46 @@
package com.volmit.iris.object;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("Translate objects")
@Data
public class IrisSlopeClip
{
@MinNumber(0)
@MaxNumber(255)
@DontObfuscate
@Desc("The minimum slope for placement")
private double minimumSlope = 0;
@MinNumber(0)
@MaxNumber(255)
@DontObfuscate
@Desc("The maximum slope for placement")
private double maximumSlope = 10;
public boolean isDefault() {
return minimumSlope <= 0 && maximumSlope >= 10;
}
public boolean isValid(double slope)
{
if(isDefault())
{
return true;
}
if(minimumSlope > slope || maximumSlope < slope)
{
return false;
}
return true;
}
}