mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Insane Loader Propagation
This commit is contained in:
parent
9fb4798c77
commit
ffa5fd5b2a
@ -19,6 +19,7 @@
|
||||
package com.volmit.iris.core;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.project.loader.IrisData;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.framework.IrisAccess;
|
||||
@ -116,15 +117,16 @@ public class TreeManager implements Listener {
|
||||
IrisObject object = worldAccess.getData().getObjectLoader().load(placement.getPlace().getRandom(RNG.r));
|
||||
List<BlockState> blockStateList = new KList<>();
|
||||
KMap<Location, BlockData> dataCache = new KMap<>();
|
||||
// TODO: REAL CLASSES!!!!
|
||||
IObjectPlacer placer = new IObjectPlacer() {
|
||||
|
||||
@Override
|
||||
public int getHighest(int x, int z) {
|
||||
public int getHighest(int x, int z, IrisData data) {
|
||||
return event.getWorld().getHighestBlockYAt(x, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHighest(int x, int z, boolean ignoreFluid) {
|
||||
public int getHighest(int x, int z, IrisData data, boolean ignoreFluid) {
|
||||
return event.getWorld().getHighestBlockYAt(x, z, ignoreFluid ? HeightMap.OCEAN_FLOOR : HeightMap.WORLD_SURFACE);
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ public class IrisComplex implements DataProvider {
|
||||
.getGenerators()
|
||||
.forEach((c) -> registerGenerator(c.getCachedGenerator(this)))));
|
||||
overlayStream = ProceduralStream.ofDouble((x, z) -> 0D);
|
||||
engine.getDimension().getOverlayNoise().forEach((i) -> overlayStream.add((x, z) -> i.get(rng, x, z)));
|
||||
engine.getDimension().getOverlayNoise().forEach((i) -> overlayStream.add((x, z) -> i.get(rng, getData(), x, z)));
|
||||
rngStream = ProceduralStream.of((x, z) -> new RNG(((x.longValue()) << 32) | (z.longValue() & 0xffffffffL))
|
||||
.nextParallelRNG(engine.getWorld().seed()), Interpolated.RNG);
|
||||
chunkRngStream = rngStream.blockToChunkCoords();
|
||||
@ -147,7 +147,7 @@ public class IrisComplex implements DataProvider {
|
||||
.select(engine.getDimension().getRockPalette().getBlockData(data));
|
||||
fluidStream = engine.getDimension().getFluidPalette().getLayerGenerator(rng.nextParallelRNG(78), data).stream()
|
||||
.select(engine.getDimension().getFluidPalette().getBlockData(data));
|
||||
regionStyleStream = engine.getDimension().getRegionStyle().create(rng.nextParallelRNG(883)).stream()
|
||||
regionStyleStream = engine.getDimension().getRegionStyle().create(rng.nextParallelRNG(883), getData()).stream()
|
||||
.zoom(engine.getDimension().getRegionZoom());
|
||||
regionIdentityStream = regionStyleStream.fit(Integer.MIN_VALUE, Integer.MAX_VALUE);
|
||||
regionStream = focusRegion != null ?
|
||||
@ -159,11 +159,11 @@ public class IrisComplex implements DataProvider {
|
||||
islandStream = regionStyleStream
|
||||
.seededChance(rng.nextParallelRNG(29349), 23968888888L,
|
||||
1D / engine.getDimension().getIslandMode().getIslandChance());
|
||||
islandHeightStream = regionIdentityStream.style(rng.nextParallelRNG(330466), engine.getDimension().getIslandMode().getHeight());
|
||||
islandDepthStream = engine.getDimension().getIslandMode().getIslandDepth().stream(rng.nextParallelRNG(-39578888));
|
||||
islandHeightStream = regionIdentityStream.style(rng.nextParallelRNG(330466), engine.getDimension().getIslandMode().getHeight(), data);
|
||||
islandDepthStream = engine.getDimension().getIslandMode().getIslandDepth().stream(rng.nextParallelRNG(-39578888), data);
|
||||
regionIDStream = regionIdentityStream.convertCached((i) -> new UUID(Double.doubleToLongBits(i), String.valueOf(i * 38445).hashCode() * 3245556666L));
|
||||
caveBiomeStream = regionStream.convert((r)
|
||||
-> engine.getDimension().getCaveBiomeStyle().create(rng.nextParallelRNG(InferredType.CAVE.ordinal())).stream()
|
||||
-> engine.getDimension().getCaveBiomeStyle().create(rng.nextParallelRNG(InferredType.CAVE.ordinal()), getData()).stream()
|
||||
.zoom(r.getCaveBiomeZoom())
|
||||
.selectRarity(r.getCaveBiomes(), (i) -> data.getBiomeLoader().load(i))
|
||||
.onNull("")
|
||||
@ -178,7 +178,7 @@ public class IrisComplex implements DataProvider {
|
||||
).convertAware2D(ProceduralStream::get).cache2D(cacheSize);
|
||||
inferredStreams.put(InferredType.CAVE, caveBiomeStream);
|
||||
landBiomeStream = regionStream.convert((r)
|
||||
-> engine.getDimension().getLandBiomeStyle().create(rng.nextParallelRNG(InferredType.LAND.ordinal())).stream()
|
||||
-> engine.getDimension().getLandBiomeStyle().create(rng.nextParallelRNG(InferredType.LAND.ordinal()), getData()).stream()
|
||||
.zoom(r.getLandBiomeZoom())
|
||||
.selectRarity(r.getLandBiomes(), (i) -> data.getBiomeLoader().load(i))
|
||||
.convertCached((s) -> data.getBiomeLoader().load(s)
|
||||
@ -187,7 +187,7 @@ public class IrisComplex implements DataProvider {
|
||||
.cache2D(cacheSize);
|
||||
inferredStreams.put(InferredType.LAND, landBiomeStream);
|
||||
seaBiomeStream = regionStream.convert((r)
|
||||
-> engine.getDimension().getSeaBiomeStyle().create(rng.nextParallelRNG(InferredType.SEA.ordinal())).stream()
|
||||
-> engine.getDimension().getSeaBiomeStyle().create(rng.nextParallelRNG(InferredType.SEA.ordinal()), getData()).stream()
|
||||
.zoom(r.getSeaBiomeZoom())
|
||||
.selectRarity(r.getSeaBiomes(), (i) -> data.getBiomeLoader().load(i))
|
||||
.convertCached((s) -> data.getBiomeLoader().load(s)
|
||||
@ -196,7 +196,7 @@ public class IrisComplex implements DataProvider {
|
||||
.cache2D(cacheSize);
|
||||
inferredStreams.put(InferredType.SEA, seaBiomeStream);
|
||||
shoreBiomeStream = regionStream.convert((r)
|
||||
-> engine.getDimension().getShoreBiomeStyle().create(rng.nextParallelRNG(InferredType.SHORE.ordinal())).stream()
|
||||
-> engine.getDimension().getShoreBiomeStyle().create(rng.nextParallelRNG(InferredType.SHORE.ordinal()), getData()).stream()
|
||||
.zoom(r.getShoreBiomeZoom())
|
||||
.selectRarity(r.getShoreBiomes(), (i) -> data.getBiomeLoader().load(i))
|
||||
.convertCached((s) -> data.getBiomeLoader().load(s)
|
||||
@ -205,7 +205,7 @@ public class IrisComplex implements DataProvider {
|
||||
inferredStreams.put(InferredType.SHORE, shoreBiomeStream);
|
||||
bridgeStream = focus != null ? ProceduralStream.of((x, z) -> focus.getInferredType(),
|
||||
Interpolated.of(a -> 0D, a -> focus.getInferredType())) :
|
||||
engine.getDimension().getContinentalStyle().create(rng.nextParallelRNG(234234565))
|
||||
engine.getDimension().getContinentalStyle().create(rng.nextParallelRNG(234234565), getData())
|
||||
.bake().scale(1D / engine.getDimension().getContinentZoom()).bake().stream()
|
||||
.convert((v) -> v >= engine.getDimension().getLandChance() ? InferredType.SEA : InferredType.LAND).cache2D(cacheSize);
|
||||
baseBiomeStream = focus != null ? ProceduralStream.of((x, z) -> focus,
|
||||
@ -225,7 +225,7 @@ public class IrisComplex implements DataProvider {
|
||||
if (engine.getDimension().hasFeatures(engine)) {
|
||||
AtomicDouble str = new AtomicDouble(1D);
|
||||
for (IrisFeaturePositional i : engine.getFramework().getEngineParallax().forEachFeature(x, z)) {
|
||||
str.set(Math.min(str.get(), i.getObjectChanceModifier(x, z, rng)));
|
||||
str.set(Math.min(str.get(), i.getObjectChanceModifier(x, z, rng, getData())));
|
||||
}
|
||||
|
||||
return str.get();
|
||||
@ -324,10 +324,10 @@ public class IrisComplex implements DataProvider {
|
||||
int m = heightf;
|
||||
|
||||
if (engine.getDimension().isCarving() && engine.getDimension().getTerrainMode().equals(IrisTerrainMode.NORMAL)) {
|
||||
if (engine.getDimension().isCarved(rx, m, rz, ((IrisTerrainNormalActuator) engine.getFramework().getTerrainActuator()).getRng(), heightf)) {
|
||||
if (engine.getDimension().isCarved(getData(), rx, m, rz, ((IrisTerrainNormalActuator) engine.getFramework().getTerrainActuator()).getRng(), heightf)) {
|
||||
m--;
|
||||
|
||||
while (engine.getDimension().isCarved(rx, m, rz, ((IrisTerrainNormalActuator) engine.getFramework().getTerrainActuator()).getRng(), heightf)) {
|
||||
while (engine.getDimension().isCarved(getData(), rx, m, rz, ((IrisTerrainNormalActuator) engine.getFramework().getTerrainActuator()).getRng(), heightf)) {
|
||||
m--;
|
||||
}
|
||||
}
|
||||
@ -470,7 +470,7 @@ public class IrisComplex implements DataProvider {
|
||||
List<IrisFeaturePositional> p = engine.getFramework().getEngineParallax().forEachFeature(x, z);
|
||||
|
||||
for (IrisFeaturePositional i : p) {
|
||||
noise.set(i.filter(x, z, noise.get(), rng));
|
||||
noise.set(i.filter(x, z, noise.get(), rng, getData()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ public class IrisTerrainNormalActuator extends EngineAssignedActuator<BlockData>
|
||||
for (int zf = 0; zf < h.getDepth(); zf++) {
|
||||
realX = (int) modX(xf + x);
|
||||
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, getData(), realX, realZ)) : 0;
|
||||
he = (int) Math.round(Math.min(h.getHeight(), getComplex().getHeightStream().get(realX, realZ)));
|
||||
hf = Math.round(Math.max(Math.min(h.getHeight(), getDimension().getFluidHeight()), he));
|
||||
biome = getComplex().getTrueBiomeStream().get(realX, realZ);
|
||||
@ -112,11 +112,11 @@ public class IrisTerrainNormalActuator extends EngineAssignedActuator<BlockData>
|
||||
}
|
||||
}
|
||||
|
||||
if (carving && getDimension().isCarved(realX, i, realZ, rng, he)) {
|
||||
if (carving && getDimension().isCarved(getData(), realX, i, realZ, rng, he)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (getDimension().getCaverns() != null && getDimension().getCaverns().isCavern(rng, realX, i, realZ, he)) {
|
||||
if (getDimension().getCaverns() != null && getDimension().getCaverns().isCavern(rng, realX, i, realZ, he, getData())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ public interface Engine extends DataProvider, Fallible, GeneratorAccess, LootPro
|
||||
@BlockCoordinates
|
||||
@Override
|
||||
default int getHeight(int x, int z) {
|
||||
return getFramework().getEngineParallax().getHighest(x, z, true);
|
||||
return getFramework().getEngineParallax().getHighest(x, z, getData(), true);
|
||||
}
|
||||
|
||||
@BlockCoordinates
|
||||
|
@ -206,7 +206,7 @@ public interface EngineParallaxManager extends DataProvider, IObjectPlacer {
|
||||
}
|
||||
|
||||
for (IrisFeaturePositional i : getEngine().getDimension().getSpecificFeatures()) {
|
||||
if (i.shouldFilter(x, z, getEngine().getFramework().getComplex().getRng())) {
|
||||
if (i.shouldFilter(x, z, getEngine().getFramework().getComplex().getRng(), getData())) {
|
||||
pos.add(i);
|
||||
}
|
||||
}
|
||||
@ -223,7 +223,7 @@ public interface EngineParallaxManager extends DataProvider, IObjectPlacer {
|
||||
|
||||
try {
|
||||
for (IrisFeaturePositional k : m.getFeatures()) {
|
||||
if (k.shouldFilter(x, z, getEngine().getFramework().getComplex().getRng())) {
|
||||
if (k.shouldFilter(x, z, getEngine().getFramework().getComplex().getRng(), getData())) {
|
||||
pos.add(k);
|
||||
}
|
||||
}
|
||||
@ -815,13 +815,21 @@ public interface EngineParallaxManager extends DataProvider, IObjectPlacer {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
default int getHighest(int x, int z) {
|
||||
return getHighest(x, z, false);
|
||||
return getHighest(x, z, getData());
|
||||
}
|
||||
|
||||
default int getHighest(int x, int z, boolean ignoreFluid) {
|
||||
return getHighest(x, z, getData(), ignoreFluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
default int getHighest(int x, int z, boolean ignoreFluid) {
|
||||
default int getHighest(int x, int z, IrisData data) {
|
||||
return getHighest(x, z, data, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
default int getHighest(int x, int z, IrisData data, boolean ignoreFluid) {
|
||||
return ignoreFluid ? trueHeight(x, z) : Math.max(trueHeight(x, z), getEngine().getDimension().getFluidHeight());
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
package com.volmit.iris.engine.framework.placer;
|
||||
|
||||
import com.volmit.iris.core.project.loader.IrisData;
|
||||
import com.volmit.iris.engine.object.IrisObjectPlacement;
|
||||
import com.volmit.iris.engine.object.common.IObjectPlacer;
|
||||
import com.volmit.iris.engine.object.tile.TileData;
|
||||
@ -36,12 +37,12 @@ public class HeightmapObjectPlacer implements IObjectPlacer {
|
||||
this.oplacer = oplacer;
|
||||
}
|
||||
|
||||
public int getHighest(int param1Int1, int param1Int2) {
|
||||
return (int) Math.round(config.getHeightmap().getNoise(this.s, param1Int1, param1Int2));
|
||||
public int getHighest(int param1Int1, int param1Int2, IrisData data) {
|
||||
return (int) Math.round(config.getHeightmap().getNoise(this.s, param1Int1, param1Int2, data));
|
||||
}
|
||||
|
||||
public int getHighest(int param1Int1, int param1Int2, boolean param1Boolean) {
|
||||
return (int) Math.round(config.getHeightmap().getNoise(this.s, param1Int1, param1Int2));
|
||||
public int getHighest(int param1Int1, int param1Int2, IrisData data, boolean param1Boolean) {
|
||||
return (int) Math.round(config.getHeightmap().getNoise(this.s, param1Int1, param1Int2, data));
|
||||
}
|
||||
|
||||
public void set(int param1Int1, int param1Int2, int param1Int3, BlockData param1BlockData) {
|
||||
|
@ -153,14 +153,15 @@ public class PlannedPiece {
|
||||
getPiece().getPlacementOptions().getRotation().setEnabled(false);
|
||||
int finalMinY = minY;
|
||||
RNG rng = getStructure().getRng().nextParallelRNG(37555);
|
||||
// TODO: REAL CLASSES!!!!!!!
|
||||
getObject().place(position.getX() + getObject().getCenter().getBlockX(), position.getY() + getObject().getCenter().getBlockY(), position.getZ() + getObject().getCenter().getBlockZ(), new IObjectPlacer() {
|
||||
@Override
|
||||
public int getHighest(int x, int z) {
|
||||
public int getHighest(int x, int z, IrisData data) {
|
||||
return position.getY();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHighest(int x, int z, boolean ignoreFluid) {
|
||||
public int getHighest(int x, int z, IrisData data, boolean ignoreFluid) {
|
||||
return position.getY();
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ public class PlannedStructure {
|
||||
int xx = i.getPosition().getX() + sx;
|
||||
int zz = i.getPosition().getZ() + sz;
|
||||
int offset = i.getPosition().getY() - startHeight;
|
||||
int height = placer.getHighest(xx, zz) + offset + (v.getH() / 2);
|
||||
int height = placer.getHighest(xx, zz, getData()) + offset + (v.getH() / 2);
|
||||
|
||||
if (options.getMode().equals(ObjectPlaceMode.PAINT) || options.isVacuum()) {
|
||||
height = -1;
|
||||
@ -133,7 +133,7 @@ public class PlannedStructure {
|
||||
}
|
||||
|
||||
if (options.getMode().equals(ObjectPlaceMode.PAINT) || options.isVacuum()) {
|
||||
p.setY(placer.getHighest(xx, zz) + offset + (v.getH() / 2));
|
||||
p.setY(placer.getHighest(xx, zz, getData()) + offset + (v.getH() / 2));
|
||||
} else {
|
||||
p.setY(height);
|
||||
}
|
||||
|
@ -141,12 +141,12 @@ public class IrisCaveModifier extends EngineAssignedModifier<BlockData> {
|
||||
};
|
||||
|
||||
int surface = (int) Math.round(getComplex().getHeightStream().get(wxx, wzz));
|
||||
double wx = wxx + layer.getHorizontalSlope().get(rng, wxx, wzz);
|
||||
double wz = wzz + layer.getHorizontalSlope().get(rng, -wzz, -wxx);
|
||||
double wx = wxx + layer.getHorizontalSlope().get(rng, getData(), wxx, wzz);
|
||||
double wz = wzz + layer.getHorizontalSlope().get(rng, getData(), -wzz, -wxx);
|
||||
double baseWidth = (14 * scale);
|
||||
double distanceCheck = 0.0132 * baseWidth;
|
||||
double distanceTake = 0.0022 * baseWidth;
|
||||
double caveHeightNoise = layer.getVerticalSlope().get(rng, wxx, wzz);
|
||||
double caveHeightNoise = layer.getVerticalSlope().get(rng, getData(), wxx, wzz);
|
||||
|
||||
if (caveHeightNoise > 259 || caveHeightNoise < -1) {
|
||||
return;
|
||||
|
@ -61,6 +61,7 @@ public class CNG {
|
||||
private double up;
|
||||
private double down;
|
||||
private double power;
|
||||
private ProceduralStream<Double> customGenerator;
|
||||
|
||||
public NoiseGenerator getGen() {
|
||||
return generator;
|
||||
@ -173,9 +174,14 @@ public class CNG {
|
||||
this(random, NoiseType.SIMPLEX, opacity, octaves);
|
||||
}
|
||||
|
||||
public CNG(RNG random, NoiseType t, double opacity, int octaves) {
|
||||
public CNG(RNG random, NoiseType type, double opacity, int octaves) {
|
||||
this(random, type.create(random.nextParallelRNG((long) ((1113334944L * opacity) + 12922 + octaves)).lmax()), opacity, octaves);
|
||||
}
|
||||
|
||||
public CNG(RNG random, NoiseGenerator generator, double opacity, int octaves) {
|
||||
customGenerator = null;
|
||||
creates++;
|
||||
noscale = t.equals(NoiseType.WHITE);
|
||||
noscale = generator.isNoScale();
|
||||
this.oct = octaves;
|
||||
this.rng = random;
|
||||
power = 1;
|
||||
@ -186,7 +192,7 @@ public class CNG {
|
||||
down = 0;
|
||||
up = 0;
|
||||
fracture = null;
|
||||
generator = t.create(random.nextParallelRNG(33).lmax());
|
||||
this.generator = generator;
|
||||
this.opacity = opacity;
|
||||
this.injector = ADD;
|
||||
|
||||
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2021 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.volmit.iris.engine.noise;
|
||||
|
||||
import com.volmit.iris.engine.object.IrisExpression;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
|
||||
public class ExpressionNoise implements NoiseGenerator{
|
||||
private final RNG rng;
|
||||
private final IrisExpression expression;
|
||||
|
||||
public ExpressionNoise(RNG rng, IrisExpression expression)
|
||||
{
|
||||
this.rng = rng;
|
||||
this.expression = expression;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double noise(double x) {
|
||||
return expression.evaluate(rng, x, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double noise(double x, double z) {
|
||||
return expression.evaluate(rng, x, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double noise(double x, double y, double z) {
|
||||
return expression.evaluate(rng, x, y, z);
|
||||
}
|
||||
}
|
@ -28,4 +28,9 @@ public interface NoiseGenerator {
|
||||
default boolean isStatic() {
|
||||
return false;
|
||||
}
|
||||
|
||||
default boolean isNoScale()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,11 @@ public class WhiteNoise implements NoiseGenerator {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isNoScale()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
private double f(double m) {
|
||||
return (m % 8192) * 1024;
|
||||
}
|
||||
|
@ -304,11 +304,11 @@ public class IrisBiome extends IrisRegistrant implements IRare {
|
||||
|
||||
public CNG getBiomeGenerator(RNG random) {
|
||||
return biomeGenerator.aquire(() ->
|
||||
biomeStyle.create(random.nextParallelRNG(213949 + 228888 + getRarity() + getName().length())));
|
||||
biomeStyle.create(random.nextParallelRNG(213949 + 228888 + getRarity() + getName().length()), getLoader()));
|
||||
}
|
||||
|
||||
public CNG getChildrenGenerator(RNG random, int sig, double scale) {
|
||||
return childrenCell.aquire(() -> getChildStyle().create(random.nextParallelRNG(sig * 2137)).bake().scale(scale).bake());
|
||||
return childrenCell.aquire(() -> getChildStyle().create(random.nextParallelRNG(sig * 2137), getLoader()).bake().scale(scale).bake());
|
||||
}
|
||||
|
||||
public KList<BlockData> generateLayers(double wx, double wz, RNG random, int maxDepth, int height, IrisData rdata, IrisComplex complex) {
|
||||
|
@ -90,7 +90,7 @@ public class IrisBiomePaletteLayer {
|
||||
return layerGenerator.aquire(() ->
|
||||
{
|
||||
RNG rngx = rng.nextParallelRNG(minHeight + maxHeight + getBlockData(data).size());
|
||||
return style.create(rngx);
|
||||
return style.create(rngx, data);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
package com.volmit.iris.engine.object;
|
||||
|
||||
import com.volmit.iris.core.project.loader.IrisData;
|
||||
import com.volmit.iris.engine.cache.AtomicCache;
|
||||
import com.volmit.iris.engine.interpolation.IrisInterpolation;
|
||||
import com.volmit.iris.engine.noise.CNG;
|
||||
@ -68,30 +69,30 @@ public class IrisCarveLayer {
|
||||
private final transient AtomicCache<ProceduralStream<Double>> rawStreamCache = new AtomicCache<>();
|
||||
private final transient AtomicCache<CNG> cng = new AtomicCache<>();
|
||||
|
||||
public boolean isCarved(RNG rng, double x, double y, double z) {
|
||||
public boolean isCarved(RNG rng, IrisData data, double x, double y, double z) {
|
||||
if (y > getMaxHeight() || y < getMinHeight()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
double opacity = Math.pow(IrisInterpolation.sinCenter(M.lerpInverse(getMinHeight(), getMaxHeight(), y)), 4);
|
||||
return getCng(rng).fitDouble(0D, 1D, x, y, z) * opacity > getThreshold();
|
||||
return getCng(rng, data).fitDouble(0D, 1D, x, y, z) * opacity > getThreshold();
|
||||
}
|
||||
|
||||
public ProceduralStream<Boolean> stream(RNG rng) {
|
||||
return streamCache.aquire(() -> ProceduralStream.of((x, y, z) -> isCarved(rng, x, y, z), Interpolated.BOOLEAN));
|
||||
public ProceduralStream<Boolean> stream(RNG rng, IrisData data) {
|
||||
return streamCache.aquire(() -> ProceduralStream.of((x, y, z) -> isCarved(rng, data, x, y, z), Interpolated.BOOLEAN));
|
||||
}
|
||||
|
||||
public ProceduralStream<Double> rawStream(RNG rng) {
|
||||
public ProceduralStream<Double> rawStream(RNG rng, IrisData data) {
|
||||
return rawStreamCache.aquire(() -> ProceduralStream.of((x, y, z) -> {
|
||||
return getCng(rng).fitDouble(0D, 1D, x, y, z) * Math.pow(IrisInterpolation.sinCenter(M.lerpInverse(getMinHeight(), getMaxHeight(), y)), 4);
|
||||
return getCng(rng, data).fitDouble(0D, 1D, x, y, z) * Math.pow(IrisInterpolation.sinCenter(M.lerpInverse(getMinHeight(), getMaxHeight(), y)), 4);
|
||||
}, Interpolated.DOUBLE));
|
||||
}
|
||||
|
||||
public CNG getCng(RNG rng) {
|
||||
return cng.aquire(() -> getStyle().create(rng.nextParallelRNG(-2340 * getMaxHeight() * getMinHeight())));
|
||||
public CNG getCng(RNG rng, IrisData data) {
|
||||
return cng.aquire(() -> getStyle().create(rng.nextParallelRNG(-2340 * getMaxHeight() * getMinHeight()), data));
|
||||
}
|
||||
|
||||
public boolean isCarved2(RNG rng, double x, double y, double z) {
|
||||
public boolean isCarved2(RNG rng, IrisData data, double x, double y, double z) {
|
||||
if (y > getMaxHeight() || y < getMinHeight()) {
|
||||
return false;
|
||||
}
|
||||
@ -105,6 +106,6 @@ public class IrisCarveLayer {
|
||||
opacity = IrisInterpolation.bezier(1D - M.lerpInverse(maxHeight - innerRange, getMaxHeight(), y));
|
||||
}
|
||||
|
||||
return cng.aquire(() -> getStyle().create(rng.nextParallelRNG(-2340 * getMaxHeight() * getMinHeight()))).fitDouble(0D, 1D, x, y, z) * opacity > getThreshold();
|
||||
return cng.aquire(() -> getStyle().create(rng.nextParallelRNG(-2340 * getMaxHeight() * getMinHeight()), data)).fitDouble(0D, 1D, x, y, z) * opacity > getThreshold();
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
package com.volmit.iris.engine.object;
|
||||
|
||||
import com.volmit.iris.core.project.loader.IrisData;
|
||||
import com.volmit.iris.engine.cache.AtomicCache;
|
||||
import com.volmit.iris.engine.object.annotations.Desc;
|
||||
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||
@ -49,17 +50,17 @@ public class IrisCavernZone implements IRare {
|
||||
|
||||
private transient AtomicCache<ProceduralStream<Boolean>> carveCache = new AtomicCache<>();
|
||||
|
||||
public boolean isCarved(RNG rng, double xx, double yy, double zz) {
|
||||
public boolean isCarved(RNG rng, IrisData data, double xx, double yy, double zz) {
|
||||
if (carver != null) {
|
||||
return carver.isCarved(rng, xx, yy, zz);
|
||||
return carver.isCarved(rng, data, xx, yy, zz);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public double getCarved(RNG rng, double xx, double yy, double zz) {
|
||||
public double getCarved(RNG rng, IrisData data, double xx, double yy, double zz) {
|
||||
if (carver != null) {
|
||||
return carver.rawStream(rng).get(xx, yy, zz) / (carver.getThreshold() * 2);
|
||||
return carver.rawStream(rng, data).get(xx, yy, zz) / (carver.getThreshold() * 2);
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
package com.volmit.iris.engine.object;
|
||||
|
||||
import com.volmit.iris.core.project.loader.IrisData;
|
||||
import com.volmit.iris.engine.cache.AtomicCache;
|
||||
import com.volmit.iris.engine.object.annotations.ArrayType;
|
||||
import com.volmit.iris.engine.object.annotations.Desc;
|
||||
@ -58,8 +59,8 @@ public class IrisCaverns {
|
||||
private transient AtomicCache<ProceduralStream<IrisCavernZone>> zonesRarity = new AtomicCache<>();
|
||||
private transient AtomicCache<ProceduralStream<Double>> streamCache = new AtomicCache<>();
|
||||
|
||||
public IrisCavernZone getZone(double x, double y, double z, RNG rng) {
|
||||
return zonesRarity.aquire(() -> zoneStyle.create(rng)
|
||||
public IrisCavernZone getZone(double x, double y, double z, RNG rng, IrisData data) {
|
||||
return zonesRarity.aquire(() -> zoneStyle.create(rng, data)
|
||||
.stream().selectRarity(getZones())).get(x, y, z);
|
||||
}
|
||||
|
||||
@ -67,26 +68,26 @@ public class IrisCaverns {
|
||||
return 0.5;
|
||||
}
|
||||
|
||||
public ProceduralStream<Double> stream(RNG rng) {
|
||||
public ProceduralStream<Double> stream(RNG rng, IrisData data) {
|
||||
if (preThresholdInterpolation) {
|
||||
return streamCache.aquire(() -> ProceduralStream.of((xx, yy, zz)
|
||||
-> (getZone(xx, yy, zz, rng)
|
||||
.getCarved(rng, xx, yy, zz)), Interpolated.DOUBLE)
|
||||
-> (getZone(xx, yy, zz, rng, data)
|
||||
.getCarved(rng, data, xx, yy, zz)), Interpolated.DOUBLE)
|
||||
.cache3D(65535));
|
||||
}
|
||||
|
||||
return streamCache.aquire(() -> ProceduralStream.of((xx, yy, zz)
|
||||
-> (getZone(xx, yy, zz, rng)
|
||||
.isCarved(rng, xx, yy, zz) ? 1D : 0D), Interpolated.DOUBLE)
|
||||
-> (getZone(xx, yy, zz, rng, data)
|
||||
.isCarved(rng, data, xx, yy, zz) ? 1D : 0D), Interpolated.DOUBLE)
|
||||
.cache3D(65535));
|
||||
}
|
||||
|
||||
public boolean isCavern(RNG rng, double x, double y, double z, double height) {
|
||||
public boolean isCavern(RNG rng, double x, double y, double z, double height, IrisData data) {
|
||||
if (zones.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return getInterpolator().interpolate(x, y, z, (xx, yy, zz)
|
||||
-> stream(rng).get(xx, yy, zz)) > threshold(height);
|
||||
-> stream(rng, data).get(xx, yy, zz)) > threshold(height);
|
||||
}
|
||||
}
|
||||
|
@ -108,18 +108,17 @@ public class IrisDecorator {
|
||||
|
||||
public CNG getHeightGenerator(RNG rng, IrisData data) {
|
||||
return heightGenerator.aquire(() ->
|
||||
heightVariance.create(rng.nextParallelRNG(getBlockData(data).size() + stackMax + stackMin)));
|
||||
heightVariance.create(rng.nextParallelRNG(getBlockData(data).size() + stackMax + stackMin), data));
|
||||
}
|
||||
|
||||
public CNG getGenerator(RNG rng, IrisData data) {
|
||||
return layerGenerator.aquire(() -> style.create(rng.nextParallelRNG(getBlockData(data).size())));
|
||||
return layerGenerator.aquire(() -> style.create(rng.nextParallelRNG(getBlockData(data).size()), data));
|
||||
}
|
||||
|
||||
public CNG getVarianceGenerator(RNG rng, IrisData data) {
|
||||
return varianceGenerator.aquire(() ->
|
||||
variance.create(
|
||||
rng.nextParallelRNG(getBlockData(data).size()))
|
||||
|
||||
rng.nextParallelRNG(getBlockData(data).size()), data)
|
||||
.scale(1D / variance.getZoom()));
|
||||
}
|
||||
|
||||
|
@ -326,10 +326,10 @@ public class IrisDimension extends IrisRegistrant {
|
||||
return rad.aquire(() -> Math.toRadians(dimensionAngleDeg));
|
||||
}
|
||||
|
||||
public boolean isCarved(int x, int y, int z, RNG rng, int terrainHeight) {
|
||||
public boolean isCarved(IrisData data, int x, int y, int z, RNG rng, int terrainHeight) {
|
||||
if (isCarving() && terrainHeight > getFluidHeight() || y < terrainHeight) {
|
||||
for (IrisCarveLayer j : getCarveLayers()) {
|
||||
if (j.isCarved(rng, x, y, z)) {
|
||||
if (j.isCarved(rng, data, x, y, z)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ public class IrisExpression extends IrisRegistrant {
|
||||
double[] g = new double[3 + getVariables().size()];
|
||||
int m = 0;
|
||||
for (IrisExpressionLoad i : getVariables()) {
|
||||
g[m++] = i.getValue(rng, x, z);
|
||||
g[m++] = i.getValue(rng, getLoader(), x, z);
|
||||
}
|
||||
|
||||
g[m++] = x;
|
||||
@ -109,7 +109,7 @@ public class IrisExpression extends IrisRegistrant {
|
||||
double[] g = new double[3 + getVariables().size()];
|
||||
int m = 0;
|
||||
for (IrisExpressionLoad i : getVariables()) {
|
||||
g[m++] = i.getValue(rng, x, y, z);
|
||||
g[m++] = i.getValue(rng, getLoader(), x, y, z);
|
||||
}
|
||||
|
||||
g[m++] = x;
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
package com.volmit.iris.engine.object;
|
||||
|
||||
import com.volmit.iris.core.project.loader.IrisData;
|
||||
import com.volmit.iris.engine.object.annotations.Desc;
|
||||
import com.volmit.iris.engine.object.annotations.Required;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
@ -45,17 +46,17 @@ public class IrisExpressionLoad {
|
||||
@Desc("If defined, this variable will use a generator style as it's result")
|
||||
private IrisGeneratorStyle styleValue = null;
|
||||
|
||||
public double getValue(RNG rng, double x, double z) {
|
||||
public double getValue(RNG rng, IrisData data, double x, double z) {
|
||||
if (styleValue != null) {
|
||||
return styleValue.create(rng).noise(x, z);
|
||||
return styleValue.create(rng, data).noise(x, z);
|
||||
}
|
||||
|
||||
return staticValue;
|
||||
}
|
||||
|
||||
public double getValue(RNG rng, double x, double y, double z) {
|
||||
public double getValue(RNG rng, IrisData data, double x, double y, double z) {
|
||||
if (styleValue != null) {
|
||||
return styleValue.create(rng).noise(x, y, z);
|
||||
return styleValue.create(rng, data).noise(x, y, z);
|
||||
}
|
||||
|
||||
return staticValue;
|
||||
|
@ -19,6 +19,7 @@
|
||||
package com.volmit.iris.engine.object;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.volmit.iris.core.project.loader.IrisData;
|
||||
import com.volmit.iris.engine.cache.AtomicCache;
|
||||
import com.volmit.iris.engine.interpolation.IrisInterpolation;
|
||||
import com.volmit.iris.engine.object.annotations.Desc;
|
||||
@ -69,9 +70,9 @@ public class IrisFeaturePositional {
|
||||
}
|
||||
|
||||
@BlockCoordinates
|
||||
public boolean shouldFilter(double x, double z, RNG rng) {
|
||||
public boolean shouldFilter(double x, double z, RNG rng, IrisData data) {
|
||||
double actualRadius = getFeature().getActualRadius();
|
||||
double dist2 = distance2(x, z, rng);
|
||||
double dist2 = distance2(x, z, rng, data);
|
||||
|
||||
if (getFeature().isInvertZone()) {
|
||||
if (dist2 < Math.pow(getFeature().getBlockRadius() - actualRadius, 2)) {
|
||||
@ -82,16 +83,16 @@ public class IrisFeaturePositional {
|
||||
return !(dist2 > Math.pow(getFeature().getBlockRadius() + actualRadius, 2));
|
||||
}
|
||||
|
||||
public double getStrength(double x, double z, RNG rng) {
|
||||
public double getStrength(double x, double z, RNG rng, IrisData data) {
|
||||
double actualRadius = getFeature().getActualRadius();
|
||||
double dist2 = distance2(x, z, rng);
|
||||
double dist2 = distance2(x, z, rng, data);
|
||||
|
||||
if (getFeature().isInvertZone()) {
|
||||
if (dist2 < Math.pow(getFeature().getBlockRadius() - actualRadius, 2)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
NoiseProvider d = provider.aquire(() -> getNoiseProvider(rng));
|
||||
NoiseProvider d = provider.aquire(() -> getNoiseProvider(rng, data));
|
||||
double s = IrisInterpolation.getNoise(getFeature().getInterpolator(), (int) x, (int) z, getFeature().getInterpolationRadius(), d);
|
||||
|
||||
if (s <= 0) {
|
||||
@ -104,7 +105,7 @@ public class IrisFeaturePositional {
|
||||
return 0;
|
||||
}
|
||||
|
||||
NoiseProvider d = provider.aquire(() -> getNoiseProvider(rng));
|
||||
NoiseProvider d = provider.aquire(() -> getNoiseProvider(rng, data));
|
||||
double s = IrisInterpolation.getNoise(getFeature().getInterpolator(), (int) x, (int) z, getFeature().getInterpolationRadius(), d);
|
||||
|
||||
if (s <= 0) {
|
||||
@ -115,17 +116,17 @@ public class IrisFeaturePositional {
|
||||
}
|
||||
}
|
||||
|
||||
public double getObjectChanceModifier(double x, double z, RNG rng) {
|
||||
public double getObjectChanceModifier(double x, double z, RNG rng, IrisData data) {
|
||||
if (getFeature().getObjectChance() >= 1) {
|
||||
return getFeature().getObjectChance();
|
||||
}
|
||||
|
||||
return M.lerp(1, getFeature().getObjectChance(), getStrength(x, z, rng));
|
||||
return M.lerp(1, getFeature().getObjectChance(), getStrength(x, z, rng, data));
|
||||
}
|
||||
|
||||
public IrisBiome filter(double x, double z, IrisBiome biome, RNG rng) {
|
||||
if (getFeature().getCustomBiome() != null) {
|
||||
if (getStrength(x, z, rng) >= getFeature().getBiomeStrengthThreshold()) {
|
||||
if (getStrength(x, z, rng, biome.getLoader()) >= getFeature().getBiomeStrengthThreshold()) {
|
||||
IrisBiome b = biome.getLoader().getBiomeLoader().load(getFeature().getCustomBiome());
|
||||
b.setInferredType(biome.getInferredType());
|
||||
return b;
|
||||
@ -135,8 +136,8 @@ public class IrisFeaturePositional {
|
||||
return null;
|
||||
}
|
||||
|
||||
public double filter(double x, double z, double noise, RNG rng) {
|
||||
double s = getStrength(x, z, rng);
|
||||
public double filter(double x, double z, double noise, RNG rng, IrisData data) {
|
||||
double s = getStrength(x, z, rng, data);
|
||||
|
||||
if (s <= 0) {
|
||||
return noise;
|
||||
@ -154,24 +155,24 @@ public class IrisFeaturePositional {
|
||||
return M.lerp(noise, fx, s);
|
||||
}
|
||||
|
||||
public double distance(double x, double z, RNG rng) {
|
||||
public double distance(double x, double z, RNG rng, IrisData data) {
|
||||
double mul = getFeature().getFractureRadius() != null ? getFeature().getFractureRadius().getMultiplier() / 2 : 1;
|
||||
double mod = getFeature().getFractureRadius() != null ? getFeature().getFractureRadius().create(rng).fitDouble(-mul, mul, x, z) : 0;
|
||||
double mod = getFeature().getFractureRadius() != null ? getFeature().getFractureRadius().create(rng, data).fitDouble(-mul, mul, x, z) : 0;
|
||||
return Math.sqrt(Math.pow(this.x - (x + mod), 2) + Math.pow(this.z - (z + mod), 2));
|
||||
}
|
||||
|
||||
public double distance2(double x, double z, RNG rng) {
|
||||
public double distance2(double x, double z, RNG rng, IrisData data) {
|
||||
double mul = getFeature().getFractureRadius() != null ? getFeature().getFractureRadius().getMultiplier() / 2 : 1;
|
||||
double mod = getFeature().getFractureRadius() != null ? getFeature().getFractureRadius().create(rng).fitDouble(-mul, mul, x, z) : 0;
|
||||
double mod = getFeature().getFractureRadius() != null ? getFeature().getFractureRadius().create(rng, data).fitDouble(-mul, mul, x, z) : 0;
|
||||
|
||||
return Math.pow(this.x - (x + mod), 2) + Math.pow(this.z - (z + mod), 2);
|
||||
}
|
||||
|
||||
private NoiseProvider getNoiseProvider(RNG rng) {
|
||||
private NoiseProvider getNoiseProvider(RNG rng, IrisData data) {
|
||||
if (getFeature().isInvertZone()) {
|
||||
return (x, z) -> distance(x, z, rng) > getFeature().getBlockRadius() ? 1D : 0D;
|
||||
return (x, z) -> distance(x, z, rng, data) > getFeature().getBlockRadius() ? 1D : 0D;
|
||||
} else {
|
||||
return (x, z) -> distance(x, z, rng) < getFeature().getBlockRadius() ? 1D : 0D;
|
||||
return (x, z) -> distance(x, z, rng, data) < getFeature().getBlockRadius() ? 1D : 0D;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -225,10 +225,10 @@ public class IrisGenerator extends IrisRegistrant {
|
||||
|
||||
for (IrisNoiseGenerator i : composite) {
|
||||
if (multiplicitive) {
|
||||
h *= i.getNoise(seed + superSeed + hc, (rx + offsetX) / zoom, (rz + offsetZ) / zoom);
|
||||
h *= i.getNoise(seed + superSeed + hc, (rx + offsetX) / zoom, (rz + offsetZ) / zoom, getLoader());
|
||||
} else {
|
||||
tp += i.getOpacity();
|
||||
h += i.getNoise(seed + superSeed + hc, (rx + offsetX) / zoom, (rz + offsetZ) / zoom);
|
||||
h += i.getNoise(seed + superSeed + hc, (rx + offsetX) / zoom, (rz + offsetZ) / zoom, getLoader());
|
||||
}
|
||||
}
|
||||
|
||||
@ -255,7 +255,7 @@ public class IrisGenerator extends IrisRegistrant {
|
||||
|
||||
public double getCliffHeight(double rx, double rz, double superSeed) {
|
||||
int hc = (int) ((cliffHeightMin * 10) + 10 + cliffHeightMax * seed + offsetX + offsetZ);
|
||||
double h = cliffHeightGenerator.getNoise((long) (seed + superSeed + hc), (rx + offsetX) / zoom, (rz + offsetZ) / zoom);
|
||||
double h = cliffHeightGenerator.getNoise((long) (seed + superSeed + hc), (rx + offsetX) / zoom, (rz + offsetZ) / zoom, getLoader());
|
||||
return IrisInterpolation.lerp(cliffHeightMin, cliffHeightMax, h);
|
||||
}
|
||||
|
||||
|
@ -18,12 +18,11 @@
|
||||
|
||||
package com.volmit.iris.engine.object;
|
||||
|
||||
import com.volmit.iris.core.project.loader.IrisData;
|
||||
import com.volmit.iris.engine.cache.AtomicCache;
|
||||
import com.volmit.iris.engine.noise.CNG;
|
||||
import com.volmit.iris.engine.object.annotations.Desc;
|
||||
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||
import com.volmit.iris.engine.object.annotations.Required;
|
||||
import com.volmit.iris.engine.noise.ExpressionNoise;
|
||||
import com.volmit.iris.engine.object.annotations.*;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@ -36,14 +35,17 @@ import lombok.experimental.Accessors;
|
||||
@Desc("A gen style")
|
||||
@Data
|
||||
public class IrisGeneratorStyle {
|
||||
@Required
|
||||
@Desc("The chance is 1 in CHANCE per interval")
|
||||
private NoiseStyle style = NoiseStyle.IRIS;
|
||||
private NoiseStyle style = NoiseStyle.FLAT;
|
||||
|
||||
@MinNumber(0.00001)
|
||||
@Desc("The zoom of this style")
|
||||
private double zoom = 1;
|
||||
|
||||
@Desc("Instead of using the style property, use a custom expression to represent this style.")
|
||||
@RegistryListResource(IrisExpression.class)
|
||||
private String expression = null;
|
||||
|
||||
@MinNumber(0.00001)
|
||||
@Desc("The Output multiplier. Only used if parent is fracture.")
|
||||
private double multiplier = 1;
|
||||
@ -70,14 +72,30 @@ public class IrisGeneratorStyle {
|
||||
return this;
|
||||
}
|
||||
|
||||
public CNG create(RNG rng) {
|
||||
public CNG create(RNG rng, IrisData data) {
|
||||
return cng.aquire(() ->
|
||||
{
|
||||
if(getExpression() != null)
|
||||
{
|
||||
IrisExpression e = data.getExpressionLoader().load(getExpression());
|
||||
|
||||
if(e != null)
|
||||
{
|
||||
CNG cng = new CNG(rng, new ExpressionNoise(rng, e), 1D, 1)
|
||||
.bake().scale(1D / zoom).pow(exponent).bake();
|
||||
cng.setTrueFracturing(axialFracturing);
|
||||
|
||||
if (fracture != null) {
|
||||
cng.fractureWith(fracture.create(rng.nextParallelRNG(2934), data), fracture.getMultiplier());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CNG cng = style.create(rng).bake().scale(1D / zoom).pow(exponent).bake();
|
||||
cng.setTrueFracturing(axialFracturing);
|
||||
|
||||
if (fracture != null) {
|
||||
cng.fractureWith(fracture.create(rng.nextParallelRNG(2934)), fracture.getMultiplier());
|
||||
cng.fractureWith(fracture.create(rng.nextParallelRNG(2934), data), fracture.getMultiplier());
|
||||
}
|
||||
|
||||
return cng;
|
||||
|
@ -71,7 +71,7 @@ public class IrisMaterialPalette {
|
||||
return layerGenerator.aquire(() ->
|
||||
{
|
||||
RNG rngx = rng.nextParallelRNG(-23498896 + getBlockData(rdata).size());
|
||||
return style.create(rngx);
|
||||
return style.create(rngx, rdata);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
package com.volmit.iris.engine.object;
|
||||
|
||||
import com.volmit.iris.core.project.loader.IrisData;
|
||||
import com.volmit.iris.engine.cache.AtomicCache;
|
||||
import com.volmit.iris.engine.interpolation.IrisInterpolation;
|
||||
import com.volmit.iris.engine.noise.CNG;
|
||||
@ -94,15 +95,15 @@ public class IrisNoiseGenerator {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
protected CNG getGenerator(long superSeed) {
|
||||
return generator.aquire(() -> style.create(new RNG(superSeed + 33955677 - seed)).oct(octaves));
|
||||
protected CNG getGenerator(long superSeed, IrisData data) {
|
||||
return generator.aquire(() -> style.create(new RNG(superSeed + 33955677 - seed), data).oct(octaves));
|
||||
}
|
||||
|
||||
public double getMax() {
|
||||
return getOffsetY() + opacity;
|
||||
}
|
||||
|
||||
public double getNoise(long superSeed, double xv, double zv) {
|
||||
public double getNoise(long superSeed, double xv, double zv, IrisData data) {
|
||||
if (!enabled) {
|
||||
return offsetY;
|
||||
}
|
||||
@ -113,13 +114,13 @@ public class IrisNoiseGenerator {
|
||||
|
||||
for (IrisNoiseGenerator i : fracture) {
|
||||
if (i.isEnabled()) {
|
||||
x += i.getNoise(superSeed + seed + g, xv, zv) - (opacity / 2D);
|
||||
z -= i.getNoise(superSeed + seed + g, zv, xv) - (opacity / 2D);
|
||||
x += i.getNoise(superSeed + seed + g, xv, zv, data) - (opacity / 2D);
|
||||
z -= i.getNoise(superSeed + seed + g, zv, xv, data) - (opacity / 2D);
|
||||
}
|
||||
g += 819;
|
||||
}
|
||||
|
||||
double n = getGenerator(superSeed).fitDouble(0, opacity, (x / zoom) + offsetX, (z / zoom) + offsetZ);
|
||||
double n = getGenerator(superSeed, data).fitDouble(0, opacity, (x / zoom) + offsetX, (z / zoom) + offsetZ);
|
||||
n = negative ? (-n + opacity) : n;
|
||||
n = (exponent != 1 ? n < 0 ? -Math.pow(-n, exponent) : Math.pow(n, exponent) : n) + offsetY;
|
||||
n = parametric ? IrisInterpolation.parametric(n, 1) : n;
|
||||
|
@ -448,14 +448,14 @@ public class IrisObject extends IrisRegistrant {
|
||||
|
||||
if (yv < 0) {
|
||||
if (config.getMode().equals(ObjectPlaceMode.CENTER_HEIGHT)) {
|
||||
y = (c != null ? c.getSurface() : placer.getHighest(x, z, config.isUnderwater())) + rty;
|
||||
y = (c != null ? c.getSurface() : placer.getHighest(x, z, getLoader(), config.isUnderwater())) + rty;
|
||||
} else if (config.getMode().equals(ObjectPlaceMode.MAX_HEIGHT) || config.getMode().equals(ObjectPlaceMode.STILT)) {
|
||||
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();
|
||||
|
||||
for (int i = x - (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i <= x + (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i++) {
|
||||
for (int j = z - (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j <= z + (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j++) {
|
||||
int h = placer.getHighest(i, j, config.isUnderwater()) + rty;
|
||||
int h = placer.getHighest(i, j, getLoader(), config.isUnderwater()) + rty;
|
||||
|
||||
if (h > y) {
|
||||
y = h;
|
||||
@ -468,7 +468,7 @@ public class IrisObject extends IrisRegistrant {
|
||||
|
||||
for (int i = x - (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i <= x + (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i += (rotatedDimensions.getBlockX() / 2) + 1) {
|
||||
for (int j = z - (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j <= z + (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j += (rotatedDimensions.getBlockZ() / 2) + 1) {
|
||||
int h = placer.getHighest(i, j, config.isUnderwater()) + rty;
|
||||
int h = placer.getHighest(i, j, getLoader(), config.isUnderwater()) + rty;
|
||||
|
||||
if (h > y) {
|
||||
y = h;
|
||||
@ -482,7 +482,7 @@ public class IrisObject extends IrisRegistrant {
|
||||
|
||||
for (int i = x - (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i <= x + (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i++) {
|
||||
for (int j = z - (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j <= z + (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j++) {
|
||||
int h = placer.getHighest(i, j, config.isUnderwater()) + rty;
|
||||
int h = placer.getHighest(i, j, getLoader(), config.isUnderwater()) + rty;
|
||||
|
||||
if (h < y) {
|
||||
y = h;
|
||||
@ -496,7 +496,7 @@ public class IrisObject extends IrisRegistrant {
|
||||
|
||||
for (int i = x - (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i <= x + (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i += (rotatedDimensions.getBlockX() / 2) + 1) {
|
||||
for (int j = z - (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j <= z + (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j += (rotatedDimensions.getBlockZ() / 2) + 1) {
|
||||
int h = placer.getHighest(i, j, config.isUnderwater()) + rty;
|
||||
int h = placer.getHighest(i, j, getLoader(), config.isUnderwater()) + rty;
|
||||
|
||||
if (h < y) {
|
||||
y = h;
|
||||
@ -504,7 +504,7 @@ public class IrisObject extends IrisRegistrant {
|
||||
}
|
||||
}
|
||||
} else if (config.getMode().equals(ObjectPlaceMode.PAINT)) {
|
||||
y = placer.getHighest(x, z, config.isUnderwater()) + rty;
|
||||
y = placer.getHighest(x, z, getLoader(), config.isUnderwater()) + rty;
|
||||
}
|
||||
} else {
|
||||
y = yv;
|
||||
@ -600,12 +600,12 @@ public class IrisObject extends IrisRegistrant {
|
||||
zz = z + (int) Math.round(i.getZ());
|
||||
|
||||
if (warped) {
|
||||
xx += config.warp(rng, i.getX() + x, i.getY() + y, i.getZ() + z);
|
||||
zz += config.warp(rng, i.getZ() + z, i.getY() + y, i.getX() + x);
|
||||
xx += config.warp(rng, i.getX() + x, i.getY() + y, i.getZ() + z, getLoader());
|
||||
zz += config.warp(rng, i.getZ() + z, i.getY() + y, i.getX() + x, getLoader());
|
||||
}
|
||||
|
||||
if (yv < 0 && (config.getMode().equals(ObjectPlaceMode.PAINT))) {
|
||||
yy = (int) Math.round(i.getY()) + Math.floorDiv(h, 2) + placer.getHighest(xx, zz, config.isUnderwater());
|
||||
yy = (int) Math.round(i.getY()) + Math.floorDiv(h, 2) + placer.getHighest(xx, zz, getLoader(), config.isUnderwater());
|
||||
}
|
||||
|
||||
if (heightmap != null) {
|
||||
@ -680,11 +680,11 @@ public class IrisObject extends IrisRegistrant {
|
||||
zz = z + (int) Math.round(i.getZ());
|
||||
|
||||
if (warped) {
|
||||
xx += config.warp(rng, i.getX() + x, i.getY() + y, i.getZ() + z);
|
||||
zz += config.warp(rng, i.getZ() + z, i.getY() + y, i.getX() + x);
|
||||
xx += config.warp(rng, i.getX() + x, i.getY() + y, i.getZ() + z, getLoader());
|
||||
zz += config.warp(rng, i.getZ() + z, i.getY() + y, i.getX() + x, getLoader());
|
||||
}
|
||||
|
||||
int yg = placer.getHighest(xx, zz, config.isUnderwater());
|
||||
int yg = placer.getHighest(xx, zz, getLoader(), config.isUnderwater());
|
||||
|
||||
if (yv >= 0 && config.isBottom()) {
|
||||
y += Math.floorDiv(h, 2);
|
||||
|
@ -180,13 +180,13 @@ public class IrisObjectPlacement {
|
||||
|
||||
private final transient AtomicCache<CNG> surfaceWarp = new AtomicCache<>();
|
||||
|
||||
public CNG getSurfaceWarp(RNG rng) {
|
||||
public CNG getSurfaceWarp(RNG rng, IrisData data) {
|
||||
return surfaceWarp.aquire(() ->
|
||||
getWarp().create(rng));
|
||||
getWarp().create(rng, data));
|
||||
}
|
||||
|
||||
public double warp(RNG rng, double x, double y, double z) {
|
||||
return getSurfaceWarp(rng).fitDouble(-(getWarp().getMultiplier() / 2D), (getWarp().getMultiplier() / 2D), x, y, z);
|
||||
public double warp(RNG rng, double x, double y, double z, IrisData data) {
|
||||
return getSurfaceWarp(rng, data).fitDouble(-(getWarp().getMultiplier() / 2D), (getWarp().getMultiplier() / 2D), x, y, z);
|
||||
}
|
||||
|
||||
public int getTriesForChunk(RNG random) {
|
||||
|
@ -269,11 +269,11 @@ public class IrisRegion extends IrisRegistrant implements IRare {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getRiverChanceGen().aquire(() -> getRiverChanceStyle().create(rng)).fit(1, getRiverRarity(), x, z) != 1) {
|
||||
if (getRiverChanceGen().aquire(() -> getRiverChanceStyle().create(rng, getLoader())).fit(1, getRiverRarity(), x, z) != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return getRiverGen().aquire(() -> getRiverStyle().create(rng)).fitDouble(0, 1, x, z) < getRiverThickness();
|
||||
return getRiverGen().aquire(() -> getRiverStyle().create(rng, getLoader())).fitDouble(0, 1, x, z) < getRiverThickness();
|
||||
}
|
||||
|
||||
public boolean isLake(RNG rng, double x, double z) {
|
||||
@ -285,7 +285,7 @@ public class IrisRegion extends IrisRegistrant implements IRare {
|
||||
return false;
|
||||
}
|
||||
|
||||
return getLakeGen().aquire(() -> getLakeStyle().create(rng)).fit(1, getLakeRarity(), x, z) == 1;
|
||||
return getLakeGen().aquire(() -> getLakeStyle().create(rng, getLoader())).fit(1, getLakeRarity(), x, z) == 1;
|
||||
}
|
||||
|
||||
public double getBiomeZoom(InferredType t) {
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
package com.volmit.iris.engine.object;
|
||||
|
||||
import com.volmit.iris.core.project.loader.IrisData;
|
||||
import com.volmit.iris.engine.object.annotations.Desc;
|
||||
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||
@ -50,8 +51,8 @@ public class IrisShapedGeneratorStyle {
|
||||
@Desc("The max block value")
|
||||
private int max = 0;
|
||||
|
||||
public double get(RNG rng, double... dim) {
|
||||
return generator.create(rng).fitDouble(min, max, dim);
|
||||
public double get(RNG rng, IrisData data, double... dim) {
|
||||
return generator.create(rng, data).fitDouble(min, max, dim);
|
||||
}
|
||||
|
||||
public IrisShapedGeneratorStyle(NoiseStyle style, int min, int max) {
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
package com.volmit.iris.engine.object;
|
||||
|
||||
import com.volmit.iris.core.project.loader.IrisData;
|
||||
import com.volmit.iris.engine.object.annotations.Desc;
|
||||
import com.volmit.iris.engine.stream.ProceduralStream;
|
||||
import com.volmit.iris.engine.stream.interpolation.Interpolated;
|
||||
@ -43,7 +44,7 @@ public class IrisStyledRange {
|
||||
@Desc("The style to pick the range")
|
||||
private IrisGeneratorStyle style = new IrisGeneratorStyle(NoiseStyle.STATIC);
|
||||
|
||||
public double get(RNG rng, double x, double z) {
|
||||
public double get(RNG rng, double x, double z, IrisData data) {
|
||||
if (min == max) {
|
||||
return min;
|
||||
}
|
||||
@ -52,10 +53,10 @@ public class IrisStyledRange {
|
||||
return M.lerp(min, max, 0.5);
|
||||
}
|
||||
|
||||
return style.create(rng).fitDouble(min, max, x, z);
|
||||
return style.create(rng, data).fitDouble(min, max, x, z);
|
||||
}
|
||||
|
||||
public ProceduralStream<Double> stream(RNG rng) {
|
||||
return ProceduralStream.of((x, z) -> get(rng, x, z), Interpolated.DOUBLE);
|
||||
public ProceduralStream<Double> stream(RNG rng, IrisData data) {
|
||||
return ProceduralStream.of((x, z) -> get(rng, x, z, data), Interpolated.DOUBLE);
|
||||
}
|
||||
}
|
||||
|
@ -18,14 +18,15 @@
|
||||
|
||||
package com.volmit.iris.engine.object.common;
|
||||
|
||||
import com.volmit.iris.core.project.loader.IrisData;
|
||||
import com.volmit.iris.engine.object.tile.TileData;
|
||||
import org.bukkit.block.TileState;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
public interface IObjectPlacer {
|
||||
int getHighest(int x, int z);
|
||||
int getHighest(int x, int z, IrisData data);
|
||||
|
||||
int getHighest(int x, int z, boolean ignoreFluid);
|
||||
int getHighest(int x, int z, IrisData data, boolean ignoreFluid);
|
||||
|
||||
void set(int x, int y, int z, BlockData d);
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
package com.volmit.iris.engine.stream;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.project.loader.IrisData;
|
||||
import com.volmit.iris.engine.hunk.Hunk;
|
||||
import com.volmit.iris.engine.object.IrisStyledRange;
|
||||
import com.volmit.iris.engine.object.common.IRare;
|
||||
@ -383,10 +384,10 @@ public interface ProceduralStream<T> extends ProceduralLayer, Interpolated<T> {
|
||||
return new FittedStream<T>(this, min, max);
|
||||
}
|
||||
|
||||
default ProceduralStream<Double> style(RNG rng, IrisStyledRange range) {
|
||||
default ProceduralStream<Double> style(RNG rng, IrisStyledRange range, IrisData data) {
|
||||
return ProceduralStream.of((x, z) -> {
|
||||
double d = getDouble(x, z);
|
||||
return range.get(rng, d, -d);
|
||||
return range.get(rng, d, -d, data);
|
||||
}, Interpolated.DOUBLE);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user