mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
MPC Modifier support
This commit is contained in:
parent
48f581525e
commit
d1c6f5f98e
@ -49,53 +49,67 @@ public class IrisCaveModifier extends EngineAssignedModifier<BlockData> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onModify(int x, int z, Hunk<BlockData> a) {
|
public void onModify(int x, int z, Hunk<BlockData> a, boolean multicore) {
|
||||||
if (!getDimension().isCaves()) {
|
if (!getDimension().isCaves()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||||
BurstExecutor e = getEngine().burst().burst(a.getWidth());
|
if(multicore)
|
||||||
for (int i = 0; i < a.getWidth(); i++) {
|
{
|
||||||
int finalI = i;
|
BurstExecutor e = getEngine().burst().burst(a.getWidth());
|
||||||
e.queue(() -> {
|
for (int i = 0; i < a.getWidth(); i++) {
|
||||||
for (int j = 0; j < a.getDepth(); j++) {
|
int finalI = i;
|
||||||
KList<CaveResult> caves = genCaves(x + finalI, z + j, finalI, j, a);
|
e.queue(() -> modifySliver(x, z, finalI, a));
|
||||||
int he = (int) Math.round(getComplex().getHeightStream().get(x + finalI, z + j));
|
}
|
||||||
if (caves != null && caves.isNotEmpty()) {
|
|
||||||
IrisBiome cave = getComplex().getCaveBiomeStream().get(x + finalI, z + j);
|
|
||||||
|
|
||||||
if (cave == null) {
|
e.complete();
|
||||||
continue;
|
}
|
||||||
}
|
|
||||||
|
else
|
||||||
for (CaveResult cl : caves) {
|
{
|
||||||
if (cl.getFloor() < 0 || cl.getFloor() > getEngine().getHeight() || cl.getCeiling() > getEngine().getHeight() || cl.getCeiling() < 0) {
|
for (int i = 0; i < a.getWidth(); i++) {
|
||||||
continue;
|
modifySliver(x, z, i, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
KList<BlockData> floor = cave.generateLayers(x + finalI, z + j, rng, cl.getFloor(), cl.getFloor(), getData(), getComplex());
|
|
||||||
KList<BlockData> ceiling = cave.generateLayers(x + finalI + 656, z + j - 656, rng,
|
|
||||||
he - cl.getCeiling(),
|
|
||||||
he - cl.getCeiling(), getData(), getComplex());
|
|
||||||
|
|
||||||
for (int g = 0; g < floor.size(); g++) {
|
|
||||||
a.set(finalI, cl.getFloor() - g, j, floor.get(g));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int g = ceiling.size() - 1; g > 0; g--) {
|
|
||||||
a.set(finalI, cl.getCeiling() + g, j, ceiling.get(g));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
e.complete();
|
|
||||||
getEngine().getMetrics().getCave().put(p.getMilliseconds());
|
getEngine().getMetrics().getCave().put(p.getMilliseconds());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void modifySliver(int x, int z, int finalI, Hunk<BlockData> a)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < a.getDepth(); j++) {
|
||||||
|
KList<CaveResult> caves = genCaves(x + finalI, z + j, finalI, j, a);
|
||||||
|
int he = (int) Math.round(getComplex().getHeightStream().get(x + finalI, z + j));
|
||||||
|
if (caves != null && caves.isNotEmpty()) {
|
||||||
|
IrisBiome cave = getComplex().getCaveBiomeStream().get(x + finalI, z + j);
|
||||||
|
|
||||||
|
if (cave == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (CaveResult cl : caves) {
|
||||||
|
if (cl.getFloor() < 0 || cl.getFloor() > getEngine().getHeight() || cl.getCeiling() > getEngine().getHeight() || cl.getCeiling() < 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
KList<BlockData> floor = cave.generateLayers(x + finalI, z + j, rng, cl.getFloor(), cl.getFloor(), getData(), getComplex());
|
||||||
|
KList<BlockData> ceiling = cave.generateLayers(x + finalI + 656, z + j - 656, rng,
|
||||||
|
he - cl.getCeiling(),
|
||||||
|
he - cl.getCeiling(), getData(), getComplex());
|
||||||
|
|
||||||
|
for (int g = 0; g < floor.size(); g++) {
|
||||||
|
a.set(finalI, cl.getFloor() - g, j, floor.get(g));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int g = ceiling.size() - 1; g > 0; g--) {
|
||||||
|
a.set(finalI, cl.getCeiling() + g, j, ceiling.get(g));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public KList<CaveResult> genCaves(double wxx, double wzz, int x, int z, Hunk<BlockData> data) {
|
public KList<CaveResult> genCaves(double wxx, double wzz, int x, int z, Hunk<BlockData> data) {
|
||||||
if (!getDimension().isCaves()) {
|
if (!getDimension().isCaves()) {
|
||||||
return EMPTY;
|
return EMPTY;
|
||||||
|
@ -40,7 +40,7 @@ public class IrisDepositModifier extends EngineAssignedModifier<BlockData> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onModify(int x, int z, Hunk<BlockData> output) {
|
public void onModify(int x, int z, Hunk<BlockData> output, boolean multicore) {
|
||||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||||
generateDeposits(rng, output, Math.floorDiv(x, 16), Math.floorDiv(z, 16));
|
generateDeposits(rng, output, Math.floorDiv(x, 16), Math.floorDiv(z, 16));
|
||||||
getEngine().getMetrics().getDeposit().put(p.getMilliseconds());
|
getEngine().getMetrics().getDeposit().put(p.getMilliseconds());
|
||||||
|
@ -47,20 +47,33 @@ public class IrisPostModifier extends EngineAssignedModifier<BlockData> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onModify(int x, int z, Hunk<BlockData> output) {
|
public void onModify(int x, int z, Hunk<BlockData> output, boolean multicore) {
|
||||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||||
BurstExecutor e = getEngine().burst().burst(output.getWidth());
|
|
||||||
int i;
|
int i;
|
||||||
AtomicInteger j = new AtomicInteger();
|
AtomicInteger j = new AtomicInteger();
|
||||||
for (i = 0; i < output.getWidth(); i++) {
|
if(multicore)
|
||||||
int finalI = i;
|
{
|
||||||
e.queue(() -> {
|
BurstExecutor e = getEngine().burst().burst(output.getWidth());
|
||||||
for (j.set(0); j.get() < output.getDepth(); j.getAndIncrement()) {
|
for (i = 0; i < output.getWidth(); i++) {
|
||||||
post(finalI, j.get(), output, finalI + x, j.get() + z);
|
int finalI = i;
|
||||||
}
|
e.queue(() -> {
|
||||||
});
|
for (j.set(0); j.get() < output.getDepth(); j.getAndIncrement()) {
|
||||||
|
post(finalI, j.get(), output, finalI + x, j.get() + z);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
e.complete();
|
||||||
}
|
}
|
||||||
e.complete();
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (i = 0; i < output.getWidth(); i++) {
|
||||||
|
for (j.set(0); j.get() < output.getDepth(); j.getAndIncrement()) {
|
||||||
|
post(i, j.get(), output, i + x, j.get() + z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
getEngine().getMetrics().getPost().put(p.getMilliseconds());
|
getEngine().getMetrics().getPost().put(p.getMilliseconds());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ public class IrisRavineModifier extends EngineAssignedModifier<BlockData> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onModify(int x, int z, Hunk<BlockData> output) {
|
public void onModify(int x, int z, Hunk<BlockData> output, boolean multicore) {
|
||||||
if (!getDimension().isRavines()) {
|
if (!getDimension().isRavines()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user