This commit is contained in:
Daniel Mills 2020-07-30 03:52:23 -04:00
parent aec5486144
commit d92c96ecc2
6 changed files with 16 additions and 21 deletions

View File

@ -831,7 +831,7 @@ public class Iris extends JavaPlugin implements BoardProvider
imsg(i, "Creating Iris " + dimm + "...");
}
int tc = Math.max(Runtime.getRuntime().availableProcessors(), 4);
int tc = Math.max(Runtime.getRuntime().availableProcessors() * 4, 4);
IrisChunkGenerator gx = new IrisChunkGenerator(dimm, tc);
info("Generating with " + tc + " threads per chunk");
O<Boolean> done = new O<Boolean>();

View File

@ -1,9 +0,0 @@
package com.volmit.iris;
import lombok.Data;
@Data
public class IrisSettings
{
private int threads = 8;
}

View File

@ -170,8 +170,6 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
@Override
protected void onPostGenerate(RNG random, int x, int z, ChunkData data, BiomeGrid grid, HeightMap height, BiomeMap biomeMap)
{
setCaching(false);
if(getSliverCache().size() > 20000)
{
getSliverCache().clear();
@ -194,7 +192,6 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
p.end();
getMetrics().getParallax().put(p.getMilliseconds());
super.onPostParallaxPostGenerate(random, x, z, data, grid, height, biomeMap);
setCaching(true);
}
protected void injectBiomeSky(int x, int z, BiomeGrid grid)

View File

@ -26,6 +26,7 @@ public abstract class ParallelChunkGenerator extends BiomeChunkGenerator
protected int cacheX;
protected int cacheZ;
private ReentrantLock genlock;
protected boolean cachingAllowed;
public ParallelChunkGenerator(String dimensionName, int threads)
{
@ -77,7 +78,6 @@ public abstract class ParallelChunkGenerator extends BiomeChunkGenerator
String key = "c" + x + "," + z;
BiomeMap biomeMap = new BiomeMap();
int ii, jj;
unsafe = true;
for(ii = 0; ii < 16; ii++)
{
@ -97,11 +97,14 @@ public abstract class ParallelChunkGenerator extends BiomeChunkGenerator
}
}
setCachingAllowed(true);
setUnsafe(true);
accelerant.waitFor(key);
setUnsafe(false);
setCachingAllowed(false);
map.write(data, grid, height);
getMetrics().getTerrain().put(p.getMilliseconds());
p = PrecisionStopwatch.start();
unsafe = false;
onPostGenerate(random, x, z, data, grid, height, biomeMap);
genlock.unlock();
}

View File

@ -41,14 +41,13 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
private int[] cacheHeightMap;
private IrisBiome[] cacheTrueBiome;
private ReentrantLock cacheLock;
private boolean caching;
public TerrainChunkGenerator(String dimensionName, int threads)
{
super(dimensionName, threads);
cacheHeightMap = new int[256];
cacheTrueBiome = new IrisBiome[256];
caching = true;
cachingAllowed = true;
cacheLock = new ReentrantLock();
}
@ -100,7 +99,7 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
throw new RuntimeException("Null Biome!");
}
if(caching)
if(cachingAllowed)
{
try
{
@ -245,7 +244,7 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
}
}
if(caching && highestPlaced < height)
if(cachingAllowed && highestPlaced < height)
{
cacheHeightMap[(z << 4) | x] = highestPlaced;
}

View File

@ -49,7 +49,7 @@ public class GenLayerCave extends GenLayer
gg.SetCellularReturnType(CellularReturnType.Distance2Sub);
gg.SetCellularDistanceFunction(CellularDistanceFunction.Natural);
for(int i = 0; i < 2; i++)
for(int i = 0; i < 3; i++)
{
double wx = wxx + (shuffle.noise(wxx, wzz) * shuffleDistance);
double wz = wzz + (shuffle.noise(wzz, wxx) * shuffleDistance);
@ -57,7 +57,7 @@ public class GenLayerCave extends GenLayer
double baseWidth = (14 * iris.getDimension().getCaveScale());
double distanceCheck = 0.0132 * baseWidth;
double distanceTake = 0.0022 * baseWidth;
double drop = (-i * 7) + 44 + iris.getDimension().getCaveShift();
double drop = (-i * 17) + 44 + iris.getDimension().getCaveShift();
double caveHeightNoise = incline * gincline.noise((wx + (10000 * i)), (wz - (10000 * i)));
caveHeightNoise += shuffle.fitDoubleD(-1, 1, wxx - caveHeightNoise, wzz + caveHeightNoise) * 3;
@ -73,6 +73,11 @@ public class GenLayerCave extends GenLayer
int pu = (int) (caveHeight + tunnelHeight);
int pd = (int) (caveHeight - tunnelHeight);
if((pu > 255 && pd > 255) || (pu < 0 && pd < 0))
{
continue;
}
if(data == null)
{
ceiling = pu > ceiling ? pu : ceiling;