mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Cubic & Hermite
This commit is contained in:
parent
c62be9573d
commit
8c5fdd4673
@ -24,7 +24,7 @@ public class Settings
|
||||
public static class GeneratorSettings
|
||||
{
|
||||
public InterpolationType linearFunction = InterpolationType.PARAMETRIC_2;
|
||||
public int linearSampleRadius = 2;
|
||||
public int linearSampleRadius = 6;
|
||||
public int interpolationIntervals = 1;
|
||||
public double horizontalZoom = 1;
|
||||
public double heightFracture = 155;
|
||||
|
@ -128,7 +128,6 @@ public class IrisGenerator extends ParallelChunkGenerator
|
||||
{
|
||||
this.world = world;
|
||||
rTerrain = new RNG(world.getSeed() + 1024);
|
||||
lerpf = new CNG(rTerrain.nextParallelRNG(-10000), 1D, 2).scale(Iris.settings.gen.linearSampleFractureScale);
|
||||
glLNoise = new GenLayerLayeredNoise(this, world, random, rTerrain.nextParallelRNG(2));
|
||||
glBiome = new GenLayerBiome(this, world, random, rTerrain.nextParallelRNG(4), dim.getBiomes());
|
||||
glCaves = new GenLayerCaves(this, world, random, rTerrain.nextParallelRNG(-1));
|
||||
@ -183,13 +182,8 @@ public class IrisGenerator extends ParallelChunkGenerator
|
||||
IrisBiome biome = getBiome(wxx, wzx);
|
||||
double hv = IrisInterpolation.getNoise(wxx, wzx,
|
||||
Iris.settings.gen.linearSampleRadius,
|
||||
Iris.settings.gen.bilinearSampleRadius,
|
||||
Iris.settings.gen.trilinearSampleRadius,
|
||||
(xf, zf) -> getBiomedHeight((int) Math.round(xf), (int) Math.round(zf), plan),
|
||||
(a, b) -> lerpf.noise(a, b),
|
||||
Iris.settings.gen.linearFunction,
|
||||
Iris.settings.gen.bilinearFunction,
|
||||
Iris.settings.gen.trilinearFunction);
|
||||
Iris.settings.gen.linearFunction);
|
||||
hv += glLNoise.generateLayer(hv * Iris.settings.gen.roughness * 215, wxx * Iris.settings.gen.roughness * 0.82, wzx * Iris.settings.gen.roughness * 0.82) * (1.6918 * (hv * 2.35));
|
||||
int height = (int) Math.round(M.clip(hv, 0D, 1D) * 253);
|
||||
int max = Math.max(height, seaLevel);
|
||||
|
@ -71,7 +71,39 @@ public class IrisInterpolation
|
||||
return lerpParametric(lerpParametric(a, b, tx, v), lerpParametric(c, d, tx, v), ty, v);
|
||||
}
|
||||
|
||||
public static double getLinearNoise(int x, int z, int rad, NoiseProvider n, NoiseProvider f, InterpolationType type)
|
||||
public static double hermite(double y0, double y1, double y2, double y3, double mu, double tension, double bias)
|
||||
{
|
||||
double m0, m1, mu2, mu3;
|
||||
double a0, a1, a2, a3;
|
||||
|
||||
mu2 = mu * mu;
|
||||
mu3 = mu2 * mu;
|
||||
m0 = (y1 - y0) * (1 + bias) * (1 - tension) / 2;
|
||||
m0 += (y2 - y1) * (1 - bias) * (1 - tension) / 2;
|
||||
m1 = (y2 - y1) * (1 + bias) * (1 - tension) / 2;
|
||||
m1 += (y3 - y2) * (1 - bias) * (1 - tension) / 2;
|
||||
a0 = 2 * mu3 - 3 * mu2 + 1;
|
||||
a1 = mu3 - 2 * mu2 + mu;
|
||||
a2 = mu3 - mu2;
|
||||
a3 = -2 * mu3 + 3 * mu2;
|
||||
|
||||
return (a0 * y1 + a1 * m0 + a2 * m1 + a3 * y2);
|
||||
}
|
||||
|
||||
public static double cubic(double y0, double y1, double y2, double y3, double mu)
|
||||
{
|
||||
double a0, a1, a2, a3, mu2;
|
||||
|
||||
mu2 = mu * mu;
|
||||
a0 = y3 - y2 - y0 + y1;
|
||||
a1 = y0 - y1 - a0;
|
||||
a2 = y2 - y0;
|
||||
a3 = y1;
|
||||
|
||||
return a0 * mu * mu2 + a1 * mu2 + a2 * mu + a3;
|
||||
}
|
||||
|
||||
public static double getLinearNoise(int x, int z, int rad, NoiseProvider n, InterpolationType type)
|
||||
{
|
||||
int h = rad;
|
||||
int fx = x >> h;
|
||||
@ -86,17 +118,16 @@ public class IrisInterpolation
|
||||
double nd = n.noise(xb, zb);
|
||||
double px = M.rangeScale(0, 1, xa, xb, x);
|
||||
double pz = M.rangeScale(0, 1, za, zb, z);
|
||||
|
||||
return blerp(na, nc, nb, nd, px, pz, type);
|
||||
}
|
||||
|
||||
public static double getNoise(int x, int z, int lrad, NoiseProvider n, NoiseProvider fli, InterpolationType linear)
|
||||
public static double getNoise(int x, int z, int lrad, NoiseProvider n, InterpolationType linear)
|
||||
{
|
||||
if(linear.equals(InterpolationType.NONE))
|
||||
{
|
||||
return n.noise(x, z);
|
||||
}
|
||||
|
||||
return getLinearNoise(x, z, lrad, n, fli, linear);
|
||||
return getLinearNoise(x, z, lrad, n, linear);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user