mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Precache height
This commit is contained in:
parent
2283f1ddc9
commit
4a3ac17a2f
@ -19,6 +19,7 @@
|
||||
package com.volmit.iris.engine;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.engine.framework.*;
|
||||
import com.volmit.iris.engine.hunk.Hunk;
|
||||
import com.volmit.iris.engine.object.IrisBiome;
|
||||
@ -26,7 +27,11 @@ import com.volmit.iris.engine.object.IrisBiomePaletteLayer;
|
||||
import com.volmit.iris.engine.object.IrisDecorator;
|
||||
import com.volmit.iris.engine.object.IrisObjectPlacement;
|
||||
import com.volmit.iris.engine.parallel.BurstExecutor;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
import com.volmit.iris.util.documentation.ChunkCoordinates;
|
||||
import com.volmit.iris.util.format.C;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||
@ -162,27 +167,25 @@ public class IrisEngine extends BlockPopulator implements Engine {
|
||||
try {
|
||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||
Hunk<BlockData> blocks = vblocks.listen((xx, y, zz, t) -> catchBlockUpdates(x + xx, y + getMinHeight(), z + zz, t));
|
||||
|
||||
// This is a very weird optimization, but it works
|
||||
// Basically we precache multicore the biome stream which effectivley
|
||||
// makes the biome stream, interpolation & noise engine run in parallel without mca
|
||||
BurstExecutor b = burst().burst(16);
|
||||
|
||||
PrecisionStopwatch px = PrecisionStopwatch.start();
|
||||
for (int i = 0; i < vblocks.getWidth(); i++) {
|
||||
int finalI = i;
|
||||
b.queue(() -> {
|
||||
for (int j = 0; j < vblocks.getDepth(); j++) {
|
||||
getFramework().getComplex().getTrueBiomeStream().get(x + finalI, z + j);
|
||||
getFramework().getComplex().getTrueHeightStream().get(x + finalI, z + j);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
b.complete();
|
||||
getMetrics().getPrecache().put(px.getMilliseconds());
|
||||
|
||||
switch (getDimension().getTerrainMode()) {
|
||||
case NORMAL -> {
|
||||
getFramework().getEngineParallax().generateParallaxArea(x >> 4, z >> 4);
|
||||
getFramework().getTerrainActuator().actuate(x, z, vblocks);
|
||||
getFramework().getTerrainActuator().actuate(x, z, vblocks.synchronize());
|
||||
getFramework().getBiomeActuator().actuate(x, z, vbiomes);
|
||||
getFramework().getCaveModifier().modify(x, z, vblocks);
|
||||
getFramework().getRavineModifier().modify(x, z, vblocks);
|
||||
@ -196,6 +199,22 @@ public class IrisEngine extends BlockPopulator implements Engine {
|
||||
}
|
||||
}
|
||||
getMetrics().getTotal().put(p.getMilliseconds());
|
||||
|
||||
if(IrisSettings.get().getGeneral().isDebug())
|
||||
{
|
||||
KList<String> v = new KList<>();
|
||||
KMap<String, Double> g = getMetrics().pull();
|
||||
|
||||
for(String i : g.sortKNumber())
|
||||
{
|
||||
if(g.get(i) != null)
|
||||
{
|
||||
v.add(C.RESET + "" + C.LIGHT_PURPLE + i + ": " + C.UNDERLINE + C.BLUE + Form.duration(g.get(i), 0) + C.RESET + C.GRAY + "");
|
||||
}
|
||||
}
|
||||
|
||||
Iris.debug(v.toString(", "));
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
Iris.reportError(e);
|
||||
fail("Failed to generate " + x + ", " + z, e);
|
||||
|
Loading…
x
Reference in New Issue
Block a user