mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-30 20:39:21 +00:00
Beautiful Interpolation
This commit is contained in:
@@ -10,6 +10,42 @@ public enum InterpolationMethod
|
||||
@DontObfuscate
|
||||
BILINEAR,
|
||||
|
||||
@DontObfuscate
|
||||
STARCAST_3,
|
||||
|
||||
@DontObfuscate
|
||||
STARCAST_6,
|
||||
|
||||
@DontObfuscate
|
||||
STARCAST_9,
|
||||
|
||||
@DontObfuscate
|
||||
STARCAST_12,
|
||||
|
||||
@DontObfuscate
|
||||
BILINEAR_STARCAST_3,
|
||||
|
||||
@DontObfuscate
|
||||
BILINEAR_STARCAST_6,
|
||||
|
||||
@DontObfuscate
|
||||
BILINEAR_STARCAST_9,
|
||||
|
||||
@DontObfuscate
|
||||
BILINEAR_STARCAST_12,
|
||||
|
||||
@DontObfuscate
|
||||
HERMITE_STARCAST_3,
|
||||
|
||||
@DontObfuscate
|
||||
HERMITE_STARCAST_6,
|
||||
|
||||
@DontObfuscate
|
||||
HERMITE_STARCAST_9,
|
||||
|
||||
@DontObfuscate
|
||||
HERMITE_STARCAST_12,
|
||||
|
||||
@DontObfuscate
|
||||
BILINEAR_BEZIER,
|
||||
|
||||
@@ -39,13 +75,13 @@ public enum InterpolationMethod
|
||||
|
||||
@DontObfuscate
|
||||
HERMITE_LOOSE_HALF_POSITIVE_BIAS,
|
||||
|
||||
|
||||
@DontObfuscate
|
||||
HERMITE_LOOSE_HALF_NEGATIVE_BIAS,
|
||||
|
||||
|
||||
@DontObfuscate
|
||||
HERMITE_LOOSE_FULL_POSITIVE_BIAS,
|
||||
|
||||
|
||||
@DontObfuscate
|
||||
HERMITE_LOOSE_FULL_NEGATIVE_BIAS,
|
||||
|
||||
|
||||
@@ -69,15 +69,8 @@ public class IrisGenerator extends IrisRegistrant
|
||||
|
||||
@Required
|
||||
@DontObfuscate
|
||||
@Desc("The interpolation method when two biomes use different heights but this same generator")
|
||||
private InterpolationMethod interpolationFunction = InterpolationMethod.BICUBIC;
|
||||
|
||||
@Required
|
||||
@MinNumber(1)
|
||||
@MaxNumber(8192)
|
||||
@DontObfuscate
|
||||
@Desc("The interpolation distance scale (blocks) when two biomes use different heights but this same generator")
|
||||
private double interpolationScale = 7;
|
||||
@Desc("The interpolator to use when smoothing this generator into other regions & generators")
|
||||
private IrisInterpolator interpolator = new IrisInterpolator();
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(8192)
|
||||
@@ -255,7 +248,7 @@ public class IrisGenerator extends IrisRegistrant
|
||||
return 0;
|
||||
}
|
||||
|
||||
int hc = (int) ((cliffHeightMin * 10) + 10 + cliffHeightMax + interpolationScale * seed + offsetX + offsetZ);
|
||||
int hc = (int) ((cliffHeightMin * 10) + 10 + cliffHeightMax * seed + offsetX + offsetZ);
|
||||
double h = 0;
|
||||
double tp = 0;
|
||||
|
||||
@@ -291,7 +284,7 @@ public class IrisGenerator extends IrisRegistrant
|
||||
|
||||
public double getCliffHeight(double rx, double rz, double superSeed)
|
||||
{
|
||||
int hc = (int) ((cliffHeightMin * 10) + 10 + cliffHeightMax + interpolationScale * seed + offsetX + offsetZ);
|
||||
int hc = (int) ((cliffHeightMin * 10) + 10 + cliffHeightMax * seed + offsetX + offsetZ);
|
||||
double h = cliffHeightGenerator.getNoise((long) (seed + superSeed + hc), (rx + offsetX) / zoom, (rz + offsetZ) / zoom);
|
||||
return IrisInterpolation.lerp(cliffHeightMin, cliffHeightMax, h);
|
||||
}
|
||||
|
||||
43
src/main/java/com/volmit/iris/object/IrisInterpolator.java
Normal file
43
src/main/java/com/volmit/iris/object/IrisInterpolator.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package com.volmit.iris.object;
|
||||
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.IrisInterpolation;
|
||||
import com.volmit.iris.util.MaxNumber;
|
||||
import com.volmit.iris.util.MinNumber;
|
||||
import com.volmit.iris.util.NoiseProvider;
|
||||
import com.volmit.iris.util.Required;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Desc("Configures rotation for iris")
|
||||
@Data
|
||||
public class IrisInterpolator
|
||||
{
|
||||
@Required
|
||||
@DontObfuscate
|
||||
@Desc("The interpolation method when two biomes use different heights but this same generator")
|
||||
private InterpolationMethod function = InterpolationMethod.BICUBIC;
|
||||
|
||||
@Required
|
||||
@MinNumber(1)
|
||||
@MaxNumber(8192)
|
||||
@DontObfuscate
|
||||
@Desc("The range checked horizontally. Smaller ranges yeild more detail but are not as smooth.")
|
||||
private double horizontalScale = 3;
|
||||
|
||||
public IrisInterpolator()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public double interpolate(double x, double z, NoiseProvider provider)
|
||||
{
|
||||
return interpolate((int) Math.round(x), (int) Math.round(z), provider);
|
||||
}
|
||||
|
||||
public double interpolate(int x, int z, NoiseProvider provider)
|
||||
{
|
||||
return IrisInterpolation.getNoise(getFunction(), x, z, getHorizontalScale(), provider);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user