mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Support features with fractured radii
This commit is contained in:
parent
0d5e3a080c
commit
0b5bea9965
@ -207,7 +207,7 @@ public class IrisComplex implements DataProvider {
|
|||||||
if (engine.getDimension().hasFeatures(engine)) {
|
if (engine.getDimension().hasFeatures(engine)) {
|
||||||
AtomicDouble str = new AtomicDouble(1D);
|
AtomicDouble str = new AtomicDouble(1D);
|
||||||
engine.getFramework().getEngineParallax().forEachFeature(x, z, (i)
|
engine.getFramework().getEngineParallax().forEachFeature(x, z, (i)
|
||||||
-> str.set(Math.min(str.get(), i.getObjectChanceModifier(x, z))));
|
-> str.set(Math.min(str.get(), i.getObjectChanceModifier(x, z, rng))));
|
||||||
return str.get();
|
return str.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -386,7 +386,7 @@ public class IrisComplex implements DataProvider {
|
|||||||
|
|
||||||
AtomicDouble noise = new AtomicDouble(h + fluidHeight + overlayStream.get(x, z));
|
AtomicDouble noise = new AtomicDouble(h + fluidHeight + overlayStream.get(x, z));
|
||||||
engine.getFramework().getEngineParallax().forEachFeature(x, z, (i)
|
engine.getFramework().getEngineParallax().forEachFeature(x, z, (i)
|
||||||
-> noise.set(i.filter(x, z, noise.get())));
|
-> noise.set(i.filter(x, z, noise.get(), rng)));
|
||||||
return Math.min(engine.getHeight(), Math.max(noise.get(), 0));
|
return Math.min(engine.getHeight(), Math.max(noise.get(), 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,13 +92,26 @@ public class IrisFeature {
|
|||||||
@Required
|
@Required
|
||||||
|
|
||||||
@Desc("Add additional noise to this spot")
|
@Desc("Add additional noise to this spot")
|
||||||
private IrisGeneratorStyle addNoise = NoiseStyle.FLAT.style();
|
private IrisGeneratorStyle addNoise = null;
|
||||||
|
|
||||||
|
@Desc("Fracture the radius ring with additional noise")
|
||||||
|
private IrisGeneratorStyle fractureRadius = null;
|
||||||
|
|
||||||
private transient AtomicCache<Double> actualRadius = new AtomicCache<>();
|
private transient AtomicCache<Double> actualRadius = new AtomicCache<>();
|
||||||
|
|
||||||
public double getActualRadius() {
|
public double getActualRadius() {
|
||||||
return actualRadius.aquire(() -> IrisInterpolation.getRealRadius(getInterpolator(), getInterpolationRadius()));
|
|
||||||
|
|
||||||
|
return actualRadius.aquire(() -> {
|
||||||
|
double o = 0;
|
||||||
|
|
||||||
|
if(fractureRadius != null)
|
||||||
|
{
|
||||||
|
o+=fractureRadius.getMaxFractureDistance();
|
||||||
|
}
|
||||||
|
|
||||||
|
return o + IrisInterpolation.getRealRadius(getInterpolator(), getInterpolationRadius());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IrisFeature read(DataInputStream s) throws IOException {
|
public static IrisFeature read(DataInputStream s) throws IOException {
|
||||||
|
@ -25,6 +25,7 @@ import com.volmit.iris.engine.object.annotations.Desc;
|
|||||||
import com.volmit.iris.engine.object.annotations.Required;
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
import com.volmit.iris.util.function.NoiseProvider;
|
import com.volmit.iris.util.function.NoiseProvider;
|
||||||
import com.volmit.iris.util.math.M;
|
import com.volmit.iris.util.math.M;
|
||||||
|
import com.volmit.iris.util.math.RNG;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
@ -82,9 +83,11 @@ public class IrisFeaturePositional {
|
|||||||
return !(dist2 > Math.pow(getFeature().getBlockRadius() + actualRadius, 2));
|
return !(dist2 > Math.pow(getFeature().getBlockRadius() + actualRadius, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getStrength(double x, double z) {
|
public double getStrength(double x, double z, RNG rng) {
|
||||||
double actualRadius = getFeature().getActualRadius();
|
double actualRadius = getFeature().getActualRadius();
|
||||||
double dist2 = distance2(x, z);
|
double mul = getFeature().getFractureRadius() != null ? getFeature().getFractureRadius().getFracture().getMultiplier()/2 : 1;
|
||||||
|
double mod = getFeature().getFractureRadius() != null ? getFeature().getFractureRadius().create(rng).fitDouble(-mul, mul, x, z) : 0;
|
||||||
|
double dist2 = distance2(x, z) + mod;
|
||||||
|
|
||||||
if (getFeature().isInvertZone()) {
|
if (getFeature().isInvertZone()) {
|
||||||
if (dist2 < Math.pow(getFeature().getBlockRadius() - actualRadius, 2)) {
|
if (dist2 < Math.pow(getFeature().getBlockRadius() - actualRadius, 2)) {
|
||||||
@ -115,16 +118,16 @@ public class IrisFeaturePositional {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getObjectChanceModifier(double x, double z) {
|
public double getObjectChanceModifier(double x, double z, RNG rng) {
|
||||||
if (getFeature().getObjectChance() >= 1) {
|
if (getFeature().getObjectChance() >= 1) {
|
||||||
return getFeature().getObjectChance();
|
return getFeature().getObjectChance();
|
||||||
}
|
}
|
||||||
|
|
||||||
return M.lerp(1, getFeature().getObjectChance(), getStrength(x, z));
|
return M.lerp(1, getFeature().getObjectChance(), getStrength(x, z, rng));
|
||||||
}
|
}
|
||||||
|
|
||||||
public double filter(double x, double z, double noise) {
|
public double filter(double x, double z, double noise, RNG rng) {
|
||||||
double s = getStrength(x, z);
|
double s = getStrength(x, z, rng);
|
||||||
|
|
||||||
if (s <= 0) {
|
if (s <= 0) {
|
||||||
return noise;
|
return noise;
|
||||||
|
@ -89,4 +89,8 @@ public class IrisGeneratorStyle {
|
|||||||
public boolean isFlat() {
|
public boolean isFlat() {
|
||||||
return style.equals(NoiseStyle.FLAT);
|
return style.equals(NoiseStyle.FLAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getMaxFractureDistance() {
|
||||||
|
return multiplier;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user