mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Remove base noise features
This commit is contained in:
parent
5bc019d3d3
commit
2fd3abbb14
@ -90,11 +90,7 @@ public class PlannedStructure {
|
|||||||
int startHeight = pieces.get(0).getPosition().getY();
|
int startHeight = pieces.get(0).getPosition().getY();
|
||||||
|
|
||||||
for (PlannedPiece i : pieces) {
|
for (PlannedPiece i : pieces) {
|
||||||
if (i.getPiece().getPlacementOptions().usesFeatures()) {
|
place(i, startHeight, options, placer, e);
|
||||||
place(i, startHeight, options, placer, e);
|
|
||||||
} else {
|
|
||||||
post.accept(() -> place(i, startHeight, options, placer, e));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,32 +126,13 @@ public class PlannedStructure {
|
|||||||
|
|
||||||
height += offset + (v.getH() / 2);
|
height += offset + (v.getH() / 2);
|
||||||
|
|
||||||
if (options.getMode().equals(ObjectPlaceMode.PAINT) || options.isVacuum()) {
|
if (options.getMode().equals(ObjectPlaceMode.PAINT)) {
|
||||||
height = -1;
|
height = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int id = rng.i(0, Integer.MAX_VALUE);
|
int id = rng.i(0, Integer.MAX_VALUE);
|
||||||
int h = vo.place(xx, height, zz, placer, options, rng, (b)
|
vo.place(xx, height, zz, placer, options, rng, (b)
|
||||||
-> e.set(b.getX(), b.getY(), b.getZ(), v.getLoadKey() + "@" + id), null, getData());
|
-> e.set(b.getX(), b.getY(), b.getZ(), v.getLoadKey() + "@" + id), null, getData());
|
||||||
|
|
||||||
if (options.isVacuum()) {
|
|
||||||
double a = Math.max(v.getW(), v.getD());
|
|
||||||
IrisFeature f = new IrisFeature();
|
|
||||||
f.setConvergeToHeight(h - (v.getH() >> 1) - 1);
|
|
||||||
f.setBlockRadius(a);
|
|
||||||
f.setInterpolationRadius(a / 4);
|
|
||||||
f.setInterpolator(InterpolationMethod.BILINEAR_STARCAST_9);
|
|
||||||
f.setStrength(1D);
|
|
||||||
e.set(xx, 0, zz, new IrisFeaturePositional(xx, zz, f));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options.getAddFeatures().isNotEmpty()) {
|
|
||||||
for (IrisFeaturePotential j : options.getAddFeatures()) {
|
|
||||||
if (rngf.nextInt(j.getRarity()) == 0) {
|
|
||||||
e.set(xx, 0, zz, new IrisFeaturePositional(xx, zz, j.getZone()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void place(World world) {
|
public void place(World world) {
|
||||||
|
@ -43,21 +43,21 @@ public class MantleObjectComponent extends IrisMantleComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generateLayer(MantleWriter writer, int x, int z, Consumer<Runnable> post) {
|
public void generateLayer(MantleWriter writer, int x, int z) {
|
||||||
RNG rng = new RNG(Cache.key(x, z) + seed());
|
RNG rng = new RNG(Cache.key(x, z) + seed());
|
||||||
int xxx = 8 + (x << 4);
|
int xxx = 8 + (x << 4);
|
||||||
int zzz = 8 + (z << 4);
|
int zzz = 8 + (z << 4);
|
||||||
IrisRegion region = getComplex().getRegionStream().get(xxx, zzz);
|
IrisRegion region = getComplex().getRegionStream().get(xxx, zzz);
|
||||||
IrisBiome biome = getComplex().getTrueBiomeStreamNoFeatures().get(xxx, zzz);
|
IrisBiome biome = getComplex().getTrueBiomeStreamNoFeatures().get(xxx, zzz);
|
||||||
placeObjects(writer, rng, x, z, biome, region, post);
|
placeObjects(writer, rng, x, z, biome, region);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ChunkCoordinates
|
@ChunkCoordinates
|
||||||
private void placeObjects(MantleWriter writer, RNG rng, int x, int z, IrisBiome biome, IrisRegion region, Consumer<Runnable> post) {
|
private void placeObjects(MantleWriter writer, RNG rng, int x, int z, IrisBiome biome, IrisRegion region) {
|
||||||
for (IrisObjectPlacement i : biome.getSurfaceObjects()) {
|
for (IrisObjectPlacement i : biome.getSurfaceObjects()) {
|
||||||
if (rng.chance(i.getChance() + rng.d(-0.005, 0.005)) && rng.chance(getComplex().getObjectChanceStream().get(x << 4, z << 4))) {
|
if (rng.chance(i.getChance() + rng.d(-0.005, 0.005)) && rng.chance(getComplex().getObjectChanceStream().get(x << 4, z << 4))) {
|
||||||
try {
|
try {
|
||||||
placeObject(writer, rng, x << 4, z << 4, i, post);
|
placeObject(writer, rng, x << 4, z << 4, i);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Iris.reportError(e);
|
Iris.reportError(e);
|
||||||
Iris.error("Failed to place objects in the following biome: " + biome.getName());
|
Iris.error("Failed to place objects in the following biome: " + biome.getName());
|
||||||
@ -71,7 +71,7 @@ public class MantleObjectComponent extends IrisMantleComponent {
|
|||||||
for (IrisObjectPlacement i : region.getSurfaceObjects()) {
|
for (IrisObjectPlacement i : region.getSurfaceObjects()) {
|
||||||
if (rng.chance(i.getChance() + rng.d(-0.005, 0.005)) && rng.chance(getComplex().getObjectChanceStream().get(x << 4, z << 4))) {
|
if (rng.chance(i.getChance() + rng.d(-0.005, 0.005)) && rng.chance(getComplex().getObjectChanceStream().get(x << 4, z << 4))) {
|
||||||
try {
|
try {
|
||||||
placeObject(writer, rng, x << 4, z << 4, i, post);
|
placeObject(writer, rng, x << 4, z << 4, i);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Iris.reportError(e);
|
Iris.reportError(e);
|
||||||
Iris.error("Failed to place objects in the following region: " + region.getName());
|
Iris.error("Failed to place objects in the following region: " + region.getName());
|
||||||
@ -84,7 +84,7 @@ public class MantleObjectComponent extends IrisMantleComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@BlockCoordinates
|
@BlockCoordinates
|
||||||
private void placeObject(MantleWriter writer, RNG rng, int x, int z, IrisObjectPlacement objectPlacement, Consumer<Runnable> post) {
|
private void placeObject(MantleWriter writer, RNG rng, int x, int z, IrisObjectPlacement objectPlacement) {
|
||||||
for (int i = 0; i < objectPlacement.getDensity(); i++) {
|
for (int i = 0; i < objectPlacement.getDensity(); i++) {
|
||||||
IrisObject v = objectPlacement.getScale().get(rng, objectPlacement.getObject(getComplex(), rng));
|
IrisObject v = objectPlacement.getScale().get(rng, objectPlacement.getObject(getComplex(), rng));
|
||||||
if (v == null) {
|
if (v == null) {
|
||||||
@ -93,28 +93,9 @@ public class MantleObjectComponent extends IrisMantleComponent {
|
|||||||
int xx = rng.i(x, x + 15);
|
int xx = rng.i(x, x + 15);
|
||||||
int zz = rng.i(z, z + 15);
|
int zz = rng.i(z, z + 15);
|
||||||
int id = rng.i(0, Integer.MAX_VALUE);
|
int id = rng.i(0, Integer.MAX_VALUE);
|
||||||
|
v.place(xx, -1, zz, writer, objectPlacement, rng,
|
||||||
int h = v.place(xx, -1, zz, writer, objectPlacement, rng,
|
|
||||||
(b) -> writer.setData(b.getX(), b.getY(), b.getZ(),
|
(b) -> writer.setData(b.getX(), b.getY(), b.getZ(),
|
||||||
v.getLoadKey() + "@" + id), null, getData());
|
v.getLoadKey() + "@" + id), null, getData());
|
||||||
if (objectPlacement.usesFeatures() && h >= 0) {
|
|
||||||
if (objectPlacement.isVacuum()) {
|
|
||||||
double a = Math.max(v.getW(), v.getD());
|
|
||||||
IrisFeature f = new IrisFeature();
|
|
||||||
f.setConvergeToHeight(h);
|
|
||||||
f.setBlockRadius(a);
|
|
||||||
f.setInterpolationRadius(objectPlacement.getVacuumInterpolationRadius());
|
|
||||||
f.setInterpolator(objectPlacement.getVacuumInterpolationMethod());
|
|
||||||
f.setStrength(1D);
|
|
||||||
writer.setData(xx, 0, zz, new IrisFeaturePositional(xx, zz, f));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (IrisFeaturePotential j : objectPlacement.getAddFeatures()) {
|
|
||||||
if (j.hasZone(rng, xx >> 4, zz >> 4)) {
|
|
||||||
writer.setData(xx, 0, zz, new IrisFeaturePositional(xx, zz, j.getZone()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -528,7 +528,7 @@ public class IrisObject extends IrisRegistrant {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (config.getMode().equals(ObjectPlaceMode.FAST_MAX_HEIGHT) || config.getMode().equals(ObjectPlaceMode.VACUUM) || config.getMode().equals(ObjectPlaceMode.FAST_STILT)) {
|
} else if (config.getMode().equals(ObjectPlaceMode.FAST_MAX_HEIGHT) || config.getMode().equals(ObjectPlaceMode.FAST_STILT)) {
|
||||||
BlockVector offset = new BlockVector(config.getTranslate().getX(), config.getTranslate().getY(), config.getTranslate().getZ());
|
BlockVector offset = new BlockVector(config.getTranslate().getX(), config.getTranslate().getY(), config.getTranslate().getZ());
|
||||||
BlockVector rotatedDimensions = config.getRotation().rotate(new BlockVector(getW(), getH(), getD()), spinx, spiny, spinz).clone();
|
BlockVector rotatedDimensions = config.getRotation().rotate(new BlockVector(getW(), getH(), getD()), spinx, spiny, spinz).clone();
|
||||||
|
|
||||||
|
@ -63,9 +63,7 @@ public class IrisObjectPlacement {
|
|||||||
private IrisObjectRotation rotation = new IrisObjectRotation();
|
private IrisObjectRotation rotation = new IrisObjectRotation();
|
||||||
@Desc("Limit the max height or min height of placement.")
|
@Desc("Limit the max height or min height of placement.")
|
||||||
private IrisObjectLimit clamp = new IrisObjectLimit();
|
private IrisObjectLimit clamp = new IrisObjectLimit();
|
||||||
@ArrayType(min = 1, type = IrisFeaturePotential.class)
|
|
||||||
@Desc("Place additional noise features in the object's place location")
|
|
||||||
private KList<IrisFeaturePotential> addFeatures = new KList<>();
|
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@MaxNumber(1)
|
@MaxNumber(1)
|
||||||
@Desc("The maximum layer level of a snow filter overtop of this placement. Set to 0 to disable. Max of 1.")
|
@Desc("The maximum layer level of a snow filter overtop of this placement. Set to 0 to disable. Max of 1.")
|
||||||
@ -89,15 +87,7 @@ public class IrisObjectPlacement {
|
|||||||
@MinNumber(-1)
|
@MinNumber(-1)
|
||||||
@Desc("When bore is enabled, lower min-y of the cuboid it removes")
|
@Desc("When bore is enabled, lower min-y of the cuboid it removes")
|
||||||
private int boreExtendMinY = 0;
|
private int boreExtendMinY = 0;
|
||||||
@MaxNumber(64)
|
@Desc("If set to true, objects will place on the terrain height, ignoring the water surface.")
|
||||||
@MinNumber(4)
|
|
||||||
@Desc("When vacuum is enabled, define the interpolation radius")
|
|
||||||
private int vacuumInterpolationRadius = 16;
|
|
||||||
@MaxNumber(64)
|
|
||||||
@MinNumber(4)
|
|
||||||
@Desc("When vacuum is enabled, define the interpolation method")
|
|
||||||
private InterpolationMethod vacuumInterpolationMethod = InterpolationMethod.BILINEAR_STARCAST_9;
|
|
||||||
@Desc("If set to true, objects will place on the terrain height, ignoring the water surface.")
|
|
||||||
private boolean underwater = false;
|
private boolean underwater = false;
|
||||||
@Desc("If set to true, objects will place in carvings (such as underground) or under an overhang.")
|
@Desc("If set to true, objects will place in carvings (such as underground) or under an overhang.")
|
||||||
private CarvingMode carvingSupport = CarvingMode.SURFACE_ONLY;
|
private CarvingMode carvingSupport = CarvingMode.SURFACE_ONLY;
|
||||||
@ -146,7 +136,6 @@ public class IrisObjectPlacement {
|
|||||||
p.setWarp(warp);
|
p.setWarp(warp);
|
||||||
p.setBore(bore);
|
p.setBore(bore);
|
||||||
p.setMeld(meld);
|
p.setMeld(meld);
|
||||||
p.setAddFeatures(addFeatures.copy());
|
|
||||||
p.setWaterloggable(waterloggable);
|
p.setWaterloggable(waterloggable);
|
||||||
p.setOnwater(onwater);
|
p.setOnwater(onwater);
|
||||||
p.setSmartBore(smartBore);
|
p.setSmartBore(smartBore);
|
||||||
@ -193,14 +182,6 @@ public class IrisObjectPlacement {
|
|||||||
return g.getData().getObjectLoader().load(place.get(random.nextInt(place.size())));
|
return g.getData().getObjectLoader().load(place.get(random.nextInt(place.size())));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVacuum() {
|
|
||||||
return getMode().equals(ObjectPlaceMode.VACUUM);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean usesFeatures() {
|
|
||||||
return isVacuum() || getAddFeatures().isNotEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean matches(IrisTreeSize size, TreeType type) {
|
public boolean matches(IrisTreeSize size, TreeType type) {
|
||||||
for (IrisTree i : getTrees()) {
|
for (IrisTree i : getTrees()) {
|
||||||
if (i.matches(size, type)) {
|
if (i.matches(size, type)) {
|
||||||
|
@ -52,9 +52,5 @@ public enum ObjectPlaceMode {
|
|||||||
|
|
||||||
@Desc("Samples the height of the terrain at every x,z position of your object and pushes it down to the surface. It's pretty much like a melt function over the terrain.")
|
@Desc("Samples the height of the terrain at every x,z position of your object and pushes it down to the surface. It's pretty much like a melt function over the terrain.")
|
||||||
|
|
||||||
PAINT,
|
PAINT
|
||||||
|
|
||||||
@Desc("Applies multiple terrain features into the parallax layer before this object places to distort the height, essentially vacuuming the terrain's heightmap closer to the bottom of this object. Uses MAX_HEIGHT to place")
|
|
||||||
|
|
||||||
VACUUM
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user