This commit is contained in:
Daniel Mills
2021-07-17 00:36:16 -04:00
parent 595ba92f06
commit 6f4363e95b
24 changed files with 352 additions and 564 deletions

View File

@@ -65,13 +65,11 @@ public interface ProceduralStream<T> extends ProceduralLayer, Interpolated<T> {
return new FunctionStream<>(f, f2, helper);
}
default ProceduralStream<Boolean> chance(double chance)
{
default ProceduralStream<Boolean> chance(double chance) {
return of((x, z) -> getDouble(x, z) < chance, Interpolated.BOOLEAN);
}
default ProceduralStream<Boolean> seededChance(RNG brng, long rootSeed, double chance)
{
default ProceduralStream<Boolean> seededChance(RNG brng, long rootSeed, double chance) {
RNG rng = brng.nextParallelRNG(rootSeed - 3995L);
return of((x, z) -> {
double ch = getDouble(x, z);
@@ -365,11 +363,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) {
return ProceduralStream.of((x, z) -> {
double d = getDouble(x, z);
return range.get(rng,d, -d);
return range.get(rng, d, -d);
}, Interpolated.DOUBLE);
}

View File

@@ -18,8 +18,8 @@
package com.volmit.iris.engine.stream.interpolation;
import com.volmit.iris.engine.interpolation.IrisInterpolation;
import com.volmit.iris.engine.interpolation.InterpolationMethod;
import com.volmit.iris.engine.interpolation.IrisInterpolation;
import com.volmit.iris.engine.stream.BasicStream;
import com.volmit.iris.engine.stream.ProceduralStream;
import com.volmit.iris.util.function.NoiseProvider;

View File

@@ -24,8 +24,6 @@ import com.volmit.iris.engine.cache.Cache;
import com.volmit.iris.engine.stream.BasicStream;
import com.volmit.iris.engine.stream.ProceduralStream;
import java.util.concurrent.atomic.AtomicInteger;
public class CachedStream2D<T> extends BasicStream<T> implements ProceduralStream<T> {
private final ProceduralStream<T> stream;
private final ConcurrentLinkedHashMap<Long, T> cache;
@@ -52,8 +50,7 @@ public class CachedStream2D<T> extends BasicStream<T> implements ProceduralStrea
@Override
public T get(double x, double z) {
if(IrisComplex.cacheLock.get())
{
if (IrisComplex.cacheLock.get()) {
return stream.get((int) x, (int) z);
}