mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Multicore terrain
This commit is contained in:
parent
3e11ff65db
commit
91526674be
@ -22,6 +22,7 @@ import com.volmit.iris.engine.framework.Engine;
|
|||||||
import com.volmit.iris.engine.framework.EngineAssignedActuator;
|
import com.volmit.iris.engine.framework.EngineAssignedActuator;
|
||||||
import com.volmit.iris.engine.hunk.Hunk;
|
import com.volmit.iris.engine.hunk.Hunk;
|
||||||
import com.volmit.iris.engine.object.IrisBiome;
|
import com.volmit.iris.engine.object.IrisBiome;
|
||||||
|
import com.volmit.iris.engine.parallel.BurstExecutor;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.documentation.BlockCoordinates;
|
import com.volmit.iris.util.documentation.BlockCoordinates;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
@ -52,12 +53,30 @@ public class IrisTerrainNormalActuator extends EngineAssignedActuator<BlockData>
|
|||||||
@Override
|
@Override
|
||||||
public void onActuate(int x, int z, Hunk<BlockData> h) {
|
public void onActuate(int x, int z, Hunk<BlockData> h) {
|
||||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||||
int i, zf, depth, realX, realZ, hf, he, b, fdepth;
|
BurstExecutor e = getEngine().burst().burst(h.getWidth());
|
||||||
|
for (int xf = 0; xf < h.getWidth(); xf++) {
|
||||||
|
int finalXf = xf;
|
||||||
|
e.queue(() -> terrainSliver(x, z, finalXf, h));
|
||||||
|
}
|
||||||
|
|
||||||
|
e.complete();
|
||||||
|
getEngine().getMetrics().getTerrain().put(p.getMilliseconds());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is calling 1/16th of a chunk x/z slice. It is a plane from sky to bedrock 1 thick in the x direction.
|
||||||
|
* @param x the chunk x in blocks
|
||||||
|
* @param z the chunk z in blocks
|
||||||
|
* @param xf the current x slice
|
||||||
|
* @param h the blockdata
|
||||||
|
*/
|
||||||
|
@BlockCoordinates
|
||||||
|
public void terrainSliver(int x, int z, int xf, Hunk<BlockData> h) {
|
||||||
|
int i, depth, realX, realZ, hf, he, b, fdepth;
|
||||||
IrisBiome biome;
|
IrisBiome biome;
|
||||||
KList<BlockData> blocks, fblocks;
|
KList<BlockData> blocks, fblocks;
|
||||||
|
|
||||||
for (int xf = 0; xf < h.getWidth(); xf++) {
|
for (int zf = 0; zf < h.getDepth(); zf++) {
|
||||||
for (zf = 0; zf < h.getDepth(); zf++) {
|
|
||||||
realX = (int) modX(xf + x);
|
realX = (int) modX(xf + x);
|
||||||
realZ = (int) modZ(zf + z);
|
realZ = (int) modZ(zf + z);
|
||||||
b = hasUnder ? (int) Math.round(getDimension().getUndercarriage().get(rng, realX, realZ)) : 0;
|
b = hasUnder ? (int) Math.round(getDimension().getUndercarriage().get(rng, realX, realZ)) : 0;
|
||||||
@ -120,7 +139,4 @@ public class IrisTerrainNormalActuator extends EngineAssignedActuator<BlockData>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getEngine().getMetrics().getTerrain().put(p.getMilliseconds());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user