Fixes (for now)

This commit is contained in:
Daniel Mills 2020-01-17 00:11:35 -05:00
parent 05eb0b20be
commit 165517608d
12 changed files with 174 additions and 177 deletions

View File

@ -12,34 +12,33 @@ public class Settings
public PerformanceMode performanceMode = PerformanceMode.UNLIMITED; public PerformanceMode performanceMode = PerformanceMode.UNLIMITED;
public boolean fastDecoration = true; public boolean fastDecoration = true;
public int threadPriority = Thread.MAX_PRIORITY; public int threadPriority = Thread.MAX_PRIORITY;
public int compilerPriority = Thread.MAX_PRIORITY;
public int threadCount = 4; public int threadCount = 4;
public boolean debugMode = false; public boolean debugMode = true;
public int compilerThreads = 12;
public int decorationAccuracy = 1; public int decorationAccuracy = 1;
public int cascadeLimit = 14; public int cascadeLimit = 14;
public boolean interpolation = true;
public boolean surfaceNoise = true;
public boolean baseNoise = true;
} }
public static class GeneratorSettings public static class GeneratorSettings
{ {
public int hermiteSampleRadius = 6; public int hermiteSampleRadius = 6;
public double horizontalZoom = 1; public double horizontalZoom = 2;
public double heightFracture = 155; public double heightFracture = 155;
public double beachScale = 76; public double landScale = 0.5;
public double landScale = 0.325; public double landChance = 0.5;
public double landChance = 0.62;
public double biomeEdgeScramble = 1550D; // 1550D public double biomeEdgeScramble = 1550D; // 1550D
public double roughness = 1.55; public double roughness = 1.55;
public double heightMultiplier = 0.806; public double heightMultiplier = 0.806;
public double heightExponentBase = 1; public double heightExponentBase = 1;
public double heightExponentMultiplier = 1.41; public double heightExponentMultiplier = 1.41;
public double heightScale = 0.56; public double heightScale = 0.56;
public double superHeightScale = 0.95;
public double baseHeight = 0.165; public double baseHeight = 0.165;
public int seaLevel = 63; public int seaLevel = 63;
public double caveDensity = 4; public double caveDensity = 4;
public double caveScale = 1.45; public double caveScale = 1.45;
public double biomeScale = 2.5; public double biomeScale = 1.65;
public boolean flatBedrock = true; public boolean flatBedrock = true;
public boolean genObjects = false; public boolean genObjects = false;
public boolean genCarving = false; public boolean genCarving = false;

View File

@ -18,8 +18,6 @@ import ninja.bytecode.shuriken.bench.PrecisionStopwatch;
import ninja.bytecode.shuriken.collections.GList; import ninja.bytecode.shuriken.collections.GList;
import ninja.bytecode.shuriken.collections.GMap; import ninja.bytecode.shuriken.collections.GMap;
import ninja.bytecode.shuriken.execution.J; import ninja.bytecode.shuriken.execution.J;
import ninja.bytecode.shuriken.execution.TaskExecutor;
import ninja.bytecode.shuriken.execution.TaskExecutor.TaskGroup;
import ninja.bytecode.shuriken.format.F; import ninja.bytecode.shuriken.format.F;
import ninja.bytecode.shuriken.io.IO; import ninja.bytecode.shuriken.io.IO;
import ninja.bytecode.shuriken.json.JSONException; import ninja.bytecode.shuriken.json.JSONException;
@ -106,16 +104,11 @@ public class PackController implements IrisController
L.v(ChatColor.LIGHT_PURPLE + "Processing Content"); L.v(ChatColor.LIGHT_PURPLE + "Processing Content");
TaskExecutor exf = new TaskExecutor(Iris.settings.performance.compilerThreads, Iris.settings.performance.compilerPriority, "Iris Compiler");
TaskGroup gg = exf.startWork();
for(GenObjectGroup i : genObjectGroups.v()) for(GenObjectGroup i : genObjectGroups.v())
{ {
gg.queue(i::processVariants); i.processVariants();
} }
gg.execute();
exf.close();
for(String i : dimensions.k()) for(String i : dimensions.k())
{ {
IrisDimension id = dimensions.get(i); IrisDimension id = dimensions.get(i);

View File

@ -59,7 +59,6 @@ public class IrisGenerator extends ParallelChunkGenerator
private double[][][] scatterCache; private double[][][] scatterCache;
private CNG scatter; private CNG scatter;
private CNG fff;
public GMap<String, IrisBiome> biomeCache = new GMap<>(); public GMap<String, IrisBiome> biomeCache = new GMap<>();
private MB WATER = new MB(Material.STATIONARY_WATER); private MB WATER = new MB(Material.STATIONARY_WATER);
private MB ICE = new MB(Material.ICE); private MB ICE = new MB(Material.ICE);
@ -145,7 +144,6 @@ public class IrisGenerator extends ParallelChunkGenerator
glCliffs = new GenLayerCliffs(this, world, random, rTerrain.nextParallelRNG(9)); glCliffs = new GenLayerCliffs(this, world, random, rTerrain.nextParallelRNG(9));
scatterCache = new double[16][][]; scatterCache = new double[16][][];
scatter = new CNG(rTerrain.nextParallelRNG(52), 1, 1).scale(10); scatter = new CNG(rTerrain.nextParallelRNG(52), 1, 1).scale(10);
fff = new CNG(rTerrain.nextParallelRNG(53), 1, 1).scale(0.01);
for(int i = 0; i < 16; i++) for(int i = 0; i < 16; i++)
{ {
@ -162,7 +160,12 @@ public class IrisGenerator extends ParallelChunkGenerator
} }
} }
L.i("Signature = " + world.getSeed() + " + " + glBiome.getBiome(0, 0).getRealBiome().ordinal() + " + " + computeHeight(0, 0, new ChunkPlan(), biome("Plains"))); int m = 0;
for(IrisBiome i : biomeCache.values())
{
i.seal(getRTerrain().nextParallelRNG(1922 - m++));
}
} }
@Override @Override
@ -173,9 +176,7 @@ public class IrisGenerator extends ParallelChunkGenerator
public IrisBiome getBiome(int wxx, int wzx) public IrisBiome getBiome(int wxx, int wzx)
{ {
double wx = Math.round((double) wxx * (Iris.settings.gen.horizontalZoom / 1.90476190476)); return glBiome.getBiome(wxx, wzx);
double wz = Math.round((double) wzx * (Iris.settings.gen.horizontalZoom / 1.90476190476));
return glBiome.getBiome(wx * Iris.settings.gen.biomeScale, wz * Iris.settings.gen.biomeScale);
} }
public IrisBiome biome(String name) public IrisBiome biome(String name)
@ -240,8 +241,8 @@ public class IrisGenerator extends ParallelChunkGenerator
public double getANoise(int x, int z, ChunkPlan plan, IrisBiome biome) public double getANoise(int x, int z, ChunkPlan plan, IrisBiome biome)
{ {
double hv = IrisInterpolation.getNoise(x, z, Iris.settings.gen.hermiteSampleRadius, (xf, zf) -> getBiomedHeight((int) Math.round(xf), (int) Math.round(zf), plan)); double hv = Iris.settings.performance.interpolation ? IrisInterpolation.getNoise(x, z, Iris.settings.gen.hermiteSampleRadius, (xf, zf) -> getBiomedHeight((int) Math.round(xf), (int) Math.round(zf), plan)) : getBiomedHeight((int) Math.round(x), (int) Math.round(z), plan);
hv += glLNoise.generateLayer(hv * Iris.settings.gen.roughness * 215, (double) x * Iris.settings.gen.roughness * 0.82, (double) z * Iris.settings.gen.roughness * 0.82) * (1.6918 * (hv * 2.35)); hv += Iris.settings.performance.surfaceNoise ? glLNoise.generateLayer(hv * Iris.settings.gen.roughness * 215, (double) x * Iris.settings.gen.roughness * 0.82, (double) z * Iris.settings.gen.roughness * 0.82) * (1.6918 * (hv * 2.35)) : 0;
if(biome.hasCliffs()) if(biome.hasCliffs())
{ {
@ -272,6 +273,7 @@ public class IrisGenerator extends ParallelChunkGenerator
IrisBiome nbiome = height < 63 ? getOcean(biome, height) : biome; IrisBiome nbiome = height < 63 ? getOcean(biome, height) : biome;
biome = nbiome; biome = nbiome;
biome = height > 61 && height < 65 ? frozen ? biome : getBeach(biome) : biome; biome = height > 61 && height < 65 ? frozen ? biome : getBeach(biome) : biome;
biome = height > 63 && biome.isCore() ? getBeach(biome) : biome;
for(int i = 0; i < max; i++) for(int i = 0; i < max; i++)
{ {
@ -378,11 +380,19 @@ public class IrisGenerator extends ParallelChunkGenerator
if(xh == -1) if(xh == -1)
{ {
int wx = (int) Math.round((double) x * (Iris.settings.gen.horizontalZoom / 1.90476190476)); IrisBiome biome = glBiome.getBiome(x, z);
int wz = (int) Math.round((double) z * (Iris.settings.gen.horizontalZoom / 1.90476190476));
IrisBiome biome = glBiome.getBiome(wx * Iris.settings.gen.biomeScale, wz * Iris.settings.gen.biomeScale);
double h = Iris.settings.gen.baseHeight + biome.getHeight(); double h = Iris.settings.gen.baseHeight + biome.getHeight();
h += (glBase.getHeight(wx, wz) * 0.5) - (0.33 * 0.5);
if(Iris.settings.performance.baseNoise)
{
h += (glBase.getHeight(x, z) * 0.5) - (0.08);
}
else
{
h += 0.00001;
}
plan.setHeight(x, z, h); plan.setHeight(x, z, h);
return h; return h;
} }

View File

@ -199,32 +199,22 @@ public class GenObjectGroup
GList<GenObject> inject = new GList<>(); GList<GenObject> inject = new GList<>();
String x = Thread.currentThread().getName(); String x = Thread.currentThread().getName();
ReentrantLock rr = new ReentrantLock(); ReentrantLock rr = new ReentrantLock();
TaskExecutor ex = new TaskExecutor(Iris.settings.performance.compilerThreads, Iris.settings.performance.compilerPriority, x + "/Subroutine ");
TaskGroup gg = ex.startWork();
for(GenObject i : getSchematics()) for(GenObject i : getSchematics())
{ {
for(Direction j : new Direction[] {Direction.S, Direction.E, Direction.W}) for(Direction j : new Direction[] {Direction.S, Direction.E, Direction.W})
{ {
GenObject cp = i.copy(); GenObject cp = i.copy();
gg.queue(() ->
{
GenObject f = cp; GenObject f = cp;
f.rotate(Direction.N, j); f.rotate(Direction.N, j);
rr.lock(); rr.lock();
inject.add(f); inject.add(f);
rr.unlock(); rr.unlock();
});
} }
} }
gg.execute();
gg = ex.startWork();
getSchematics().add(inject); getSchematics().add(inject);
for(GenObject i : getSchematics()) for(GenObject i : getSchematics())
{
gg.queue(() ->
{ {
i.recalculateMountShift(); i.recalculateMountShift();
@ -232,12 +222,8 @@ public class GenObjectGroup
{ {
i.computeFlag(j); i.computeFlag(j);
} }
});
} }
gg.execute();
ex.close();
L.i(ChatColor.LIGHT_PURPLE + "Processed " + ChatColor.WHITE + F.f(schematics.size()) + ChatColor.LIGHT_PURPLE + " Schematics in " + ChatColor.WHITE + name); L.i(ChatColor.LIGHT_PURPLE + "Processed " + ChatColor.WHITE + F.f(schematics.size()) + ChatColor.LIGHT_PURPLE + " Schematics in " + ChatColor.WHITE + name);
} }
} }

View File

@ -24,16 +24,16 @@ public class GenLayerBase extends GenLayer
//@builder //@builder
super(iris, world, random, rng); super(iris, world, random, rng);
hfracture = new CNG(rng.nextParallelRNG(6), 1, 2) hfracture = new CNG(rng.nextParallelRNG(6), 1, 2)
.scale(0.0124); .scale(0.0024);
gen = new CNG(rng.nextParallelRNG(7), 0.19D, 7) gen = new CNG(rng.nextParallelRNG(7), 0.24D, 7)
.scale(0.012) .scale(0.0072)
.amp(0.5) .amp(0.5)
.freq(1.1) .freq(1.1)
.fractureWith(new CNG(rng.nextParallelRNG(8), 1, 6) .fractureWith(new CNG(rng.nextParallelRNG(8), 1, 6)
.scale(0.018) .scale(0.0007)
.injectWith(CNG.MULTIPLY) .injectWith(CNG.MULTIPLY)
.child(new CNG(rng.nextParallelRNG(9), 0.745, 2) .child(new CNG(rng.nextParallelRNG(9), 0.745, 2)
.scale(0.1)), 44); .scale(0.001)), 44);
height = new CNG(rng.nextParallelRNG(10), 1, 8) height = new CNG(rng.nextParallelRNG(10), 1, 8)
.scale(0.0017601 * Iris.settings.gen.heightScale) .scale(0.0017601 * Iris.settings.gen.heightScale)
.fractureWith(new CNG(rng.nextParallelRNG(11), 1, 6) .fractureWith(new CNG(rng.nextParallelRNG(11), 1, 6)
@ -42,11 +42,11 @@ public class GenLayerBase extends GenLayer
.scale(0.0034), 31) .scale(0.0034), 31)
.scale(0.066), 58); .scale(0.066), 58);
superheight = new CNG(rng.nextParallelRNG(13), 1, 6) superheight = new CNG(rng.nextParallelRNG(13), 1, 6)
.scale(0.025 * Iris.settings.gen.superHeightScale) .scale(0.0125)
.fractureWith(new CNG(rng.nextParallelRNG(14), 1, 1) .fractureWith(new CNG(rng.nextParallelRNG(14), 1, 1)
.scale(0.13), 250); .scale(0.013), 250);
fracture = new CNG(rng.nextParallelRNG(15), 0.6D, 4) fracture = new CNG(rng.nextParallelRNG(15), 0.6D, 4)
.scale(0.118); .scale(0.01);
//@done //@done
} }

View File

@ -35,7 +35,7 @@ public class GenLayerBiome extends GenLayer
for(IrisBiome i : biomes) for(IrisBiome i : biomes)
{ {
if(i.getName().equals("Beach")) if(i.getRegion().equals("default"))
{ {
continue; continue;
} }
@ -61,6 +61,18 @@ public class GenLayerBiome extends GenLayer
v += 13 - i.getName().length(); v += 13 - i.getName().length();
i.setGen(new EnumPolygonGenerator<IrisBiome>(rng.nextParallelRNG(33 + v), 0.000255 * i.getBiomes().size() * Iris.settings.gen.biomeScale, 1, i.getBiomes().toArray(new IrisBiome[i.getBiomes().size()]), factory)); i.setGen(new EnumPolygonGenerator<IrisBiome>(rng.nextParallelRNG(33 + v), 0.000255 * i.getBiomes().size() * Iris.settings.gen.biomeScale, 1, i.getBiomes().toArray(new IrisBiome[i.getBiomes().size()]), factory));
} }
int m = 0;
for(IrisRegion i : regions.values())
{
for(IrisBiome j : i.getBiomes())
{
j.seal(iris.getRTerrain().nextParallelRNG(3922 - m++));
}
i.getBeach().seal(iris.getRTerrain().nextParallelRNG(3922 - m++));
}
} }
public boolean hasBorder(int checks, double distance, double... dims) public boolean hasBorder(int checks, double distance, double... dims)
@ -115,24 +127,31 @@ public class GenLayerBiome extends GenLayer
return regionGenerator.getChoice(xx, zz).getGen(); return regionGenerator.getChoice(xx, zz).getGen();
} }
public IrisBiome getBiome(double xx, double zz) public IrisBiome getBiome(double wxx, double wzx)
{ {
double x = xx + (Iris.settings.gen.biomeEdgeScramble == 0 ? 0 : (fracture.noise(zz, xx) * Iris.settings.gen.biomeEdgeScramble)); double wx = Math.round((double) wxx * (Iris.settings.gen.horizontalZoom / 1.90476190476)) * Iris.settings.gen.biomeScale;
double z = zz - (Iris.settings.gen.biomeEdgeScramble == 0 ? 0 : (fracture.noise(xx, zz) * Iris.settings.gen.biomeEdgeScramble)); double wz = Math.round((double) wzx * (Iris.settings.gen.horizontalZoom / 1.90476190476)) * Iris.settings.gen.biomeScale;
double x = wx + (Iris.settings.gen.biomeEdgeScramble == 0 ? 0 : (fracture.noise(wz, wx) * Iris.settings.gen.biomeEdgeScramble));
double z = wz - (Iris.settings.gen.biomeEdgeScramble == 0 ? 0 : (fracture.noise(wx, wz) * Iris.settings.gen.biomeEdgeScramble));
IrisBiome cbi = iris.biome("Ocean"); IrisBiome cbi = iris.biome("Ocean");
double land = island.noise(x, z); double land = island.noise(x, z);
double landChance = 1D - M.clip(Iris.settings.gen.landChance, 0D, 1D); double landChance = 1D - M.clip(Iris.settings.gen.landChance, 0D, 1D);
if(land > landChance + 0.0175) if(land > landChance)
{ {
cbi = getRegionGenerator(x, z).getChoice(x, z); cbi = getRegionGenerator(x, z).getChoice(x, z);
} }
else if(land < 0.3) else if(land < 0.4)
{ {
cbi = iris.biome("Deep Ocean"); cbi = iris.biome("Deep Ocean");
} }
else
{
cbi = iris.biome("Ocean");
}
return cbi; return cbi;
} }

View File

@ -14,6 +14,7 @@ import ninja.bytecode.shuriken.collections.GMap;
import ninja.bytecode.shuriken.execution.J; import ninja.bytecode.shuriken.execution.J;
import ninja.bytecode.shuriken.json.JSONArray; import ninja.bytecode.shuriken.json.JSONArray;
import ninja.bytecode.shuriken.json.JSONObject; import ninja.bytecode.shuriken.json.JSONObject;
import ninja.bytecode.shuriken.logging.L;
import ninja.bytecode.shuriken.math.CNG; import ninja.bytecode.shuriken.math.CNG;
import ninja.bytecode.shuriken.math.M; import ninja.bytecode.shuriken.math.M;
import ninja.bytecode.shuriken.math.RNG; import ninja.bytecode.shuriken.math.RNG;
@ -26,17 +27,17 @@ public class IrisBiome
//@builder //@builder
private static final IrisBiome OCEAN = new IrisBiome("Ocean", Biome.OCEAN) private static final IrisBiome OCEAN = new IrisBiome("Ocean", Biome.OCEAN)
.height(-0.2) .height(-0.4)
.coreBiome() .coreBiome()
.surface(MB.of(Material.SAND), MB.of(Material.SAND), MB.of(Material.SAND), MB.of(Material.CLAY), MB.of(Material.GRAVEL)) .surface(MB.of(Material.SAND), MB.of(Material.SAND), MB.of(Material.SAND), MB.of(Material.CLAY), MB.of(Material.GRAVEL))
.simplexSurface(); .simplexSurface();
private static final IrisBiome FROZEN_OCEAN = new IrisBiome("Frozen Ocean", Biome.FROZEN_OCEAN) private static final IrisBiome FROZEN_OCEAN = new IrisBiome("Frozen Ocean", Biome.FROZEN_OCEAN)
.height(-0.16) .height(-0.4)
.coreBiome() .coreBiome()
.surface(MB.of(Material.SAND), MB.of(Material.SAND), MB.of(Material.SAND), MB.of(Material.CLAY), MB.of(Material.GRAVEL)) .surface(MB.of(Material.SAND), MB.of(Material.SAND), MB.of(Material.SAND), MB.of(Material.CLAY), MB.of(Material.GRAVEL))
.simplexSurface(); .simplexSurface();
private static final IrisBiome DEEP_OCEAN = new IrisBiome("Deep Ocean", Biome.DEEP_OCEAN) private static final IrisBiome DEEP_OCEAN = new IrisBiome("Deep Ocean", Biome.DEEP_OCEAN)
.height(-0.4) .height(-0.6)
.coreBiome() .coreBiome()
.surface(MB.of(Material.SAND), MB.of(Material.CLAY), MB.of(Material.GRAVEL)) .surface(MB.of(Material.SAND), MB.of(Material.CLAY), MB.of(Material.GRAVEL))
.simplexSurface(); .simplexSurface();
@ -176,6 +177,57 @@ public class IrisBiome
fromJSON(o, true); fromJSON(o, true);
} }
public void seal(RNG rng)
{
if(simplexScatter)
{
poly = new PolygonGenerator.EnumPolygonGenerator<MB>(rng, 0.125, 2, getSurface().toArray(new MB[getSurface().size()]), (g) ->
{
return g.scale(0.09 * surfaceScale).fractureWith(new CNG(rng.nextParallelRNG(56), 1D, 2).scale(0.0955), 55);
});
}
else
{
poly = new PolygonGenerator.EnumPolygonGenerator<MB>(rng, 15.05, 2, getSurface().toArray(new MB[getSurface().size()]), (g) ->
{
return g.scale(surfaceScale).fractureWith(new CNG(rng.nextParallelRNG(55), 1D, 2).scale(0.0155), 224);
});
}
if(simplexScatterSub)
{
polySub = new PolygonGenerator.EnumPolygonGenerator<MB>(rng, 0.125, 2, getDirt().toArray(new MB[getDirt().size()]), (g) ->
{
return g.scale(0.06 * subSurfaceScale).fractureWith(new CNG(rng.nextParallelRNG(526), 1D, 2).scale(0.0955), 55);
});
}
else
{
polySub = new PolygonGenerator.EnumPolygonGenerator<MB>(rng, 15.05, 2, getDirt().toArray(new MB[getDirt().size()]), (g) ->
{
return g.scale(subSurfaceScale).fractureWith(new CNG(rng.nextParallelRNG(515), 1D, 2).scale(0.0155), 224);
});
}
if(simplexScatterRock)
{
polyRock = new PolygonGenerator.EnumPolygonGenerator<MB>(rng, 0.125, 2, getRock().toArray(new MB[getRock().size()]), (g) ->
{
return g.scale(0.08 * rockScale).fractureWith(new CNG(rng.nextParallelRNG(562), 1D, 2).scale(0.0955), 55);
});
}
else
{
polyRock = new PolygonGenerator.EnumPolygonGenerator<MB>(rng, 15.05, 2, getRock().toArray(new MB[getRock().size()]), (g) ->
{
return g.scale(rockScale).fractureWith(new CNG(rng.nextParallelRNG(551), 1D, 2).scale(0.0155), 224);
});
}
}
public void fromJSON(JSONObject o, boolean chain) public void fromJSON(JSONObject o, boolean chain)
{ {
name = o.getString("name"); name = o.getString("name");
@ -462,29 +514,19 @@ public class IrisBiome
{ {
double wx = x + 1000D; double wx = x + 1000D;
double wz = z + 1000D; double wz = z + 1000D;
if(simplexScatter)
if(polySub == null)
{ {
if(poly == null) L.w(getName() + " is not sealed!");
{
poly = new PolygonGenerator.EnumPolygonGenerator<MB>(rng, 0.125, 2, getSurface().toArray(new MB[getSurface().size()]), (g) ->
{
return g.scale(0.09 * surfaceScale).fractureWith(new CNG(rng.nextParallelRNG(56), 1D, 2).scale(0.0955), 55);
});
} }
if(simplexScatter)
{
return poly.getChoice(wx / 3, wz / 3); return poly.getChoice(wx / 3, wz / 3);
} }
if(scatterSurface) if(scatterSurface)
{ {
if(poly == null)
{
poly = new PolygonGenerator.EnumPolygonGenerator<MB>(rng, 15.05, 2, getSurface().toArray(new MB[getSurface().size()]), (g) ->
{
return g.scale(surfaceScale).fractureWith(new CNG(rng.nextParallelRNG(55), 1D, 2).scale(0.0155), 224);
});
}
return poly.getChoice(wx * 0.2D, wz * 0.2D); return poly.getChoice(wx * 0.2D, wz * 0.2D);
} }
@ -495,29 +537,19 @@ public class IrisBiome
{ {
double wx = x + 1000D; double wx = x + 1000D;
double wz = z + 1000D; double wz = z + 1000D;
if(simplexScatterSub)
{
if(polySub == null) if(polySub == null)
{ {
polySub = new PolygonGenerator.EnumPolygonGenerator<MB>(rng, 0.125, 2, getDirt().toArray(new MB[getDirt().size()]), (g) -> L.w(getName() + " is not sealed!");
{
return g.scale(0.06 * subSurfaceScale).fractureWith(new CNG(rng.nextParallelRNG(526), 1D, 2).scale(0.0955), 55);
});
} }
if(simplexScatterSub)
{
return polySub.getChoice(wx / 3, i / 3, wz / 3); return polySub.getChoice(wx / 3, i / 3, wz / 3);
} }
if(scatterSurfaceSub) if(scatterSurfaceSub)
{ {
if(polySub == null)
{
polySub = new PolygonGenerator.EnumPolygonGenerator<MB>(rng, 15.05, 2, getDirt().toArray(new MB[getDirt().size()]), (g) ->
{
return g.scale(subSurfaceScale).fractureWith(new CNG(rng.nextParallelRNG(515), 1D, 2).scale(0.0155), 224);
});
}
return polySub.getChoice(wx * 0.2D, i / 3, wz * 0.2D); return polySub.getChoice(wx * 0.2D, i / 3, wz * 0.2D);
} }
@ -528,29 +560,19 @@ public class IrisBiome
{ {
double wx = x + 1000D; double wx = x + 1000D;
double wz = z + 1000D; double wz = z + 1000D;
if(simplexScatterRock)
if(polySub == null)
{ {
if(polyRock == null) L.w(getName() + " is not sealed!");
{
polyRock = new PolygonGenerator.EnumPolygonGenerator<MB>(rng, 0.125, 2, getRock().toArray(new MB[getRock().size()]), (g) ->
{
return g.scale(0.08 * rockScale).fractureWith(new CNG(rng.nextParallelRNG(562), 1D, 2).scale(0.0955), 55);
});
} }
if(simplexScatterRock)
{
return polyRock.getChoice(wx / 3, i / 3, wz / 3); return polyRock.getChoice(wx / 3, i / 3, wz / 3);
} }
if(scatterSurfaceRock) if(scatterSurfaceRock)
{ {
if(polyRock == null)
{
polyRock = new PolygonGenerator.EnumPolygonGenerator<MB>(rng, 15.05, 2, getRock().toArray(new MB[getRock().size()]), (g) ->
{
return g.scale(rockScale).fractureWith(new CNG(rng.nextParallelRNG(551), 1D, 2).scale(0.0155), 224);
});
}
return polyRock.getChoice(wx * 0.2D, i * 0.2D, wz * 0.2D); return polyRock.getChoice(wx * 0.2D, i * 0.2D, wz * 0.2D);
} }
@ -824,5 +846,4 @@ public class IrisBiome
return false; return false;
return true; return true;
} }
} }

View File

@ -68,26 +68,14 @@ public class IrisDimension
private GList<IrisBiome> biomesFromArray(JSONArray a) throws JSONException, IOException private GList<IrisBiome> biomesFromArray(JSONArray a) throws JSONException, IOException
{ {
GList<IrisBiome> b = new GList<>(); GList<IrisBiome> b = new GList<>();
TaskExecutor ex = new TaskExecutor(Iris.settings.performance.compilerThreads, Iris.settings.performance.compilerPriority, "Iris Loader");
TaskGroup g = ex.startWork();
ReentrantLock lock = new ReentrantLock();
for(int i = 0; i < a.length(); i++) for(int i = 0; i < a.length(); i++)
{ {
int ii = i; int ii = i;
g.queue(() ->
{
IrisBiome bb = Iris.getController(PackController.class).loadBiome(a.getString(ii)); IrisBiome bb = Iris.getController(PackController.class).loadBiome(a.getString(ii));
lock.lock();
Iris.getController(PackController.class).registerBiome(a.getString(ii), bb); Iris.getController(PackController.class).registerBiome(a.getString(ii), bb);
b.add(bb); b.add(bb);
lock.unlock();
});
} }
g.execute();
ex.close();
return b; return b;
} }

View File

@ -40,7 +40,6 @@ public final class AtomicChunkData implements ChunkGenerator.ChunkData
{ {
this.maxHeight = world.getMaxHeight(); this.maxHeight = world.getMaxHeight();
this.w = world; this.w = world;
} }
@Override @Override

View File

@ -1,6 +1,5 @@
package ninja.bytecode.iris.util; package ninja.bytecode.iris.util;
import ninja.bytecode.iris.Iris;
import ninja.bytecode.shuriken.math.M; import ninja.bytecode.shuriken.math.M;
public class IrisInterpolation public class IrisInterpolation
@ -115,17 +114,16 @@ public class IrisInterpolation
public static double getHermiteNoise(int x, int z, int rad, NoiseProvider n) public static double getHermiteNoise(int x, int z, int rad, NoiseProvider n)
{ {
int h = rad; int fx = x >> rad;
int fx = x >> h; int fz = z >> rad;
int fz = z >> h; int x0 = ((fx - 1) << rad);
int x0 = ((fx - 1) << h); int z0 = ((fz - 1) << rad);
int z0 = ((fz - 1) << h); int x1 = (fx << rad);
int x1 = (fx << h); int z1 = (fz << rad);
int z1 = (fz << h); int x2 = ((fx + 1) << rad);
int x2 = ((fx + 1) << h); int z2 = ((fz + 1) << rad);
int z2 = ((fz + 1) << h); int x3 = ((fx + 2) << rad);
int x3 = ((fx + 2) << h); int z3 = ((fz + 2) << rad);
int z3 = ((fz + 2) << h);
double px = M.rangeScale(0, 1, x1, x2, x); double px = M.rangeScale(0, 1, x1, x2, x);
double pz = M.rangeScale(0, 1, z1, z2, z); double pz = M.rangeScale(0, 1, z1, z2, z);
//@builder //@builder
@ -146,7 +144,7 @@ public class IrisInterpolation
n.noise(x3, z1), n.noise(x3, z1),
n.noise(x3, z2), n.noise(x3, z2),
n.noise(x3, z3), n.noise(x3, z3),
px, pz, 0.01, 0); px, pz, 0.00001, 0.5);
//@done //@done
} }

View File

@ -1,15 +0,0 @@
package ninja.bytecode.iris.util;
import org.bukkit.generator.ChunkGenerator;
import ninja.bytecode.shuriken.collections.GList;
public class MulticoreChunkGenerator extends ChunkGenerator
{
private GList<ParallelChunkGenerator> generators;
public MulticoreChunkGenerator(int tc)
{
}
}

View File

@ -1,6 +1,7 @@
package ninja.bytecode.iris.util; package ninja.bytecode.iris.util;
import java.util.Random; import java.util.Random;
import java.util.concurrent.locks.ReentrantLock;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
@ -24,6 +25,7 @@ public abstract class ParallelChunkGenerator extends ChunkGenerator
private int wx; private int wx;
private int wz; private int wz;
private AtomicChunkData data; private AtomicChunkData data;
private ReentrantLock biomeLock;
private TaskGroup tg; private TaskGroup tg;
private boolean ready = false; private boolean ready = false;
int cg = 0; int cg = 0;
@ -52,20 +54,11 @@ public abstract class ParallelChunkGenerator extends ChunkGenerator
genPool = Iris.getController(ExecutionController.class).getExecutor(world); genPool = Iris.getController(ExecutionController.class).getExecutor(world);
} }
if(this.world == null)
{
ready = false;
}
if(this.world != null && world.getSeed() != this.world.getSeed())
{
ready = false;
}
this.world = world; this.world = world;
data = new AtomicChunkData(world); data = new AtomicChunkData(world);
if(!ready) if(!ready)
{ {
biomeLock = new ReentrantLock();
onInit(world, random); onInit(world, random);
ready = true; ready = true;
} }
@ -75,16 +68,22 @@ public abstract class ParallelChunkGenerator extends ChunkGenerator
for(i = 0; i < 16; i++) for(i = 0; i < 16; i++)
{ {
wx = (x * 16) + i; wx = (x << 4) + i;
for(j = 0; j < 16; j++) for(j = 0; j < 16; j++)
{ {
wz = (z * 16) + j; wz = (z << 4) + j;
int a = wx; int a = wx;
int b = wz; int b = wz;
int c = i; int c = i;
int d = j; int d = j;
tg.queue(() -> biome.setBiome(c, d, generateFullColumn(a, b, c, d, plan.get()))); tg.queue(() ->
{
Biome f = generateFullColumn(a, b, c, d, plan.get());
biomeLock.lock();
biome.setBiome(c, d, f);
biomeLock.unlock();
});
} }
} }