9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-29 20:19:06 +00:00

Performance

This commit is contained in:
Daniel Mills
2020-09-01 20:41:26 -04:00
parent 683becabda
commit e8addbc954
12 changed files with 235 additions and 81 deletions

View File

@@ -61,7 +61,7 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
public void onInit(World world, RNG rng)
{
super.onInit(world, rng);
parallaxMap = new AtomicWorldData(world, "floor");
parallaxMap = new AtomicWorldData(world);
glText = new GenLayerText(this, rng.nextParallelRNG(32485));
}

View File

@@ -59,6 +59,8 @@ public abstract class ParallelChunkGenerator extends DimensionChunkGenerator
protected abstract void onPostGenerate(RNG random, int x, int z, ChunkData data, BiomeGrid grid, HeightMap height, BiomeMap biomeMap, AtomicSliverMap map);
protected abstract void onPreGenerate(RNG random, int x, int z, ChunkData data, BiomeGrid grid, HeightMap height, BiomeMap biomeMap, AtomicSliverMap map);
protected int sampleHeight(int x, int z)
{
return onSampleColumnHeight(x >> 4, z >> 4, x, z, x & 15, z & 15);
@@ -76,6 +78,8 @@ public abstract class ParallelChunkGenerator extends DimensionChunkGenerator
BiomeMap biomeMap = new BiomeMap();
int ii, jj;
onPreGenerate(random, x, z, data, grid, height, biomeMap, map);
for(ii = 0; ii < 16; ii++)
{
int i = ii;

View File

@@ -82,6 +82,12 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
return glCave.genCaves(x, z, x & 15, z & 15, null);
}
@Override
protected void onPreGenerate(RNG random, int x, int z, ChunkData data, BiomeGrid grid, HeightMap height, BiomeMap biomeMap, AtomicSliverMap map)
{
}
@Override
protected void onGenerateColumn(int cx, int cz, int rx, int rz, int x, int z, AtomicSliver sliver, BiomeMap biomeMap, boolean sampled)
{

View File

@@ -51,7 +51,7 @@ public class AtomicMulticache
return -5784;
}
Long pos = pos(x, z);
long pos = pos(x, z);
Double r = height.get(pos);
if(r == null)
@@ -65,7 +65,7 @@ public class AtomicMulticache
public IrisRegion getRegion(int x, int z, Supplier<IrisRegion> g)
{
Long pos = pos(x, z);
long pos = pos(x, z);
IrisRegion r = region.get(pos);
if(r == null)
@@ -79,7 +79,7 @@ public class AtomicMulticache
public BiomeResult getBiome(int x, int z, Supplier<BiomeResult> g)
{
Long pos = pos(x, z);
long pos = pos(x, z);
BiomeResult r = biome.get(pos);
if(r == null)
@@ -97,7 +97,7 @@ public class AtomicMulticache
{
return null;
}
Long pos = pos(x, z);
long pos = pos(x, z);
BiomeResult r = rawBiome.get(pos);
if(r == null)

View File

@@ -23,9 +23,8 @@ public class AtomicWorldData
private KList<ChunkPosition> unloadRegions;
private KList<ChunkPosition> unloadChunks;
private long last = M.ms();
private String prefix;
public AtomicWorldData(World world, String prefix)
public AtomicWorldData(World world)
{
this.world = world;
loadedSections = new KMap<>();
@@ -34,7 +33,6 @@ public class AtomicWorldData
lastChunk = new KMap<>();
unloadRegions = new KList<>();
unloadChunks = new KList<>();
this.prefix = prefix;
getSubregionFolder().mkdirs();
}
@@ -256,7 +254,7 @@ public class AtomicWorldData
public File getSubregionFolder()
{
return new File(world.getWorldFolder(), "subregion-" + prefix);
return new File(world.getWorldFolder(), "region-parallax");
}
public KMap<ChunkPosition, AtomicSliverMap> getLoadedChunks()