mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-04-06 07:46:08 +00:00
Engine stages
This commit is contained in:
@@ -49,18 +49,17 @@ public class IrisFluidBodies {
|
||||
|
||||
@BlockCoordinates
|
||||
public void generate(MantleWriter writer, RNG rng, Engine engine, int x, int y, int z) {
|
||||
//TODO: Impl
|
||||
// if (rivers.isNotEmpty()) {
|
||||
// for (IrisRiver i : rivers) {
|
||||
// i.generate(writer, rng, engine, x, y, z);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (lakes.isNotEmpty()) {
|
||||
// for (IrisLake i : lakes) {
|
||||
// i.generate(writer, rng, engine, x, y, z);
|
||||
// }
|
||||
// }
|
||||
if (rivers.isNotEmpty()) {
|
||||
for (IrisRiver i : rivers) {
|
||||
i.generate(writer, rng, engine, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
if (lakes.isNotEmpty()) {
|
||||
for (IrisLake i : lakes) {
|
||||
i.generate(writer, rng, engine, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getMaxRange(IrisData data) {
|
||||
|
||||
@@ -22,7 +22,11 @@ import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.mantle.MantleWriter;
|
||||
import com.volmit.iris.engine.object.annotations.*;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
import com.volmit.iris.util.matter.MatterFluidBody;
|
||||
import com.volmit.iris.util.matter.slices.FluidBodyMatter;
|
||||
import com.volmit.iris.util.noise.CNG;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -50,10 +54,57 @@ public class IrisRiver implements IRare {
|
||||
@Desc("Force this river to only generate the specified custom biome")
|
||||
private String customBiome = "";
|
||||
|
||||
@Desc("The width style of this lake")
|
||||
private IrisShapedGeneratorStyle widthStyle = new IrisShapedGeneratorStyle(NoiseStyle.PERLIN.style(), 5, 9);
|
||||
|
||||
@Desc("The depth style of this lake")
|
||||
private IrisShapedGeneratorStyle depthStyle = new IrisShapedGeneratorStyle(NoiseStyle.PERLIN.style(), 4, 7);
|
||||
|
||||
public int getSize(IrisData data) {
|
||||
return worm.getMaxDistance();
|
||||
}
|
||||
|
||||
public void generate(MantleWriter writer, RNG rng, Engine engine, int x, int y, int z) {
|
||||
KList<IrisPosition> pos = getWorm().generate(rng, engine.getData(), writer, null, x, y, z, (at) -> {
|
||||
});
|
||||
CNG dg = depthStyle.getGenerator().createNoCache(rng, engine.getData());
|
||||
CNG bw = widthStyle.getGenerator().createNoCache(rng, engine.getData());
|
||||
IrisPosition avg;
|
||||
double ax = 0;
|
||||
double ay = 0;
|
||||
double az = 0;
|
||||
double[] surfaces = new double[pos.size()];
|
||||
int i = 0;
|
||||
|
||||
for (IrisPosition p : pos) {
|
||||
surfaces[i] = engine.getComplex().getHeightStream().get(x, z);
|
||||
ax += p.getX();
|
||||
ay += surfaces[i];
|
||||
az += p.getZ();
|
||||
i++;
|
||||
}
|
||||
|
||||
avg = new IrisPosition(ax / pos.size(), ay / pos.size(), az / pos.size());
|
||||
MatterFluidBody body = FluidBodyMatter.get(customBiome, false);
|
||||
i = 0;
|
||||
|
||||
for (IrisPosition p : pos) {
|
||||
|
||||
double surface = surfaces[i];
|
||||
double depth = dg.fitDouble(depthStyle.getMin(), depthStyle.getMax(), p.getX(), p.getZ()) + (surface - avg.getY());
|
||||
double width = bw.fitDouble(widthStyle.getMin(), widthStyle.getMax(), p.getX(), p.getZ());
|
||||
|
||||
if (depth > 1) {
|
||||
writer.setElipsoidFunction(p.getX(), avg.getY(), p.getZ(), width, depth, width, true, (xx, yy, zz) -> {
|
||||
if (yy > avg.getY()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return body;
|
||||
});
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user