mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-28 19:49:06 +00:00
Cleanup
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
package com.volmit.iris.engine.framework;
|
||||
|
||||
|
||||
import com.volmit.iris.engine.hunk.Hunk;
|
||||
|
||||
public abstract class EngineAssignedBiModifier<A, B> extends EngineAssignedComponent implements EngineBiModifier<A, B> {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package com.volmit.iris.engine.framework;
|
||||
|
||||
|
||||
import com.volmit.iris.engine.hunk.Hunk;
|
||||
|
||||
public interface EngineBiModifier<A, B> extends EngineComponent {
|
||||
|
||||
@@ -175,7 +175,7 @@ public class CNG {
|
||||
}
|
||||
|
||||
public CNG(RNG random, NoiseType type, double opacity, int octaves) {
|
||||
this(random, type.create(random.nextParallelRNG((long) ((1113334944L * opacity) + 12922 + octaves)).lmax()), opacity, 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) {
|
||||
|
||||
@@ -21,12 +21,11 @@ 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{
|
||||
public class ExpressionNoise implements NoiseGenerator {
|
||||
private final RNG rng;
|
||||
private final IrisExpression expression;
|
||||
|
||||
public ExpressionNoise(RNG rng, IrisExpression expression)
|
||||
{
|
||||
public ExpressionNoise(RNG rng, IrisExpression expression) {
|
||||
this.rng = rng;
|
||||
this.expression = expression;
|
||||
}
|
||||
|
||||
@@ -29,8 +29,7 @@ public interface NoiseGenerator {
|
||||
return false;
|
||||
}
|
||||
|
||||
default boolean isNoScale()
|
||||
{
|
||||
default boolean isNoScale() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,7 @@ public class WhiteNoise implements NoiseGenerator {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isNoScale()
|
||||
{
|
||||
public boolean isNoScale() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,7 @@ import com.volmit.iris.engine.stream.ProceduralStream;
|
||||
import java.util.function.Function;
|
||||
|
||||
@Desc("Represents a stream from the engine")
|
||||
public enum IrisEngineStreamType
|
||||
{
|
||||
public enum IrisEngineStreamType {
|
||||
@Desc("Represents the given slope at the x, z coordinates")
|
||||
SLOPE((f) -> f.getComplex().getSlopeStream()),
|
||||
|
||||
@@ -57,15 +56,13 @@ public enum IrisEngineStreamType
|
||||
@Desc("Represents the identity of regions. Each region has a unique number (very large numbers)")
|
||||
REGION_IDENTITY((f) -> f.getComplex().getRegionIdentityStream());
|
||||
|
||||
private Function<EngineFramework, ProceduralStream<Double>> getter;
|
||||
private final Function<EngineFramework, ProceduralStream<Double>> getter;
|
||||
|
||||
private IrisEngineStreamType(Function<EngineFramework, ProceduralStream<Double>> getter)
|
||||
{
|
||||
IrisEngineStreamType(Function<EngineFramework, ProceduralStream<Double>> getter) {
|
||||
this.getter = getter;
|
||||
}
|
||||
|
||||
public ProceduralStream<Double> get(EngineFramework engine)
|
||||
{
|
||||
public ProceduralStream<Double> get(EngineFramework engine) {
|
||||
return getter.apply(engine);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,7 @@ import com.volmit.iris.engine.object.annotations.Desc;
|
||||
import java.util.function.Function;
|
||||
|
||||
@Desc("Represents a value from the engine")
|
||||
public enum IrisEngineValueType
|
||||
{
|
||||
public enum IrisEngineValueType {
|
||||
@Desc("Represents actual height of the engine")
|
||||
ENGINE_HEIGHT((f) -> Double.valueOf(f.getEngine().getHeight())),
|
||||
|
||||
@@ -42,15 +41,13 @@ public enum IrisEngineValueType
|
||||
FLUID_HEIGHT((f) -> Double.valueOf(f.getComplex().getFluidHeight())),
|
||||
;
|
||||
|
||||
private Function<EngineFramework, Double> getter;
|
||||
private final Function<EngineFramework, Double> getter;
|
||||
|
||||
private IrisEngineValueType(Function<EngineFramework, Double> getter)
|
||||
{
|
||||
IrisEngineValueType(Function<EngineFramework, Double> getter) {
|
||||
this.getter = getter;
|
||||
}
|
||||
|
||||
public Double get(EngineFramework engine)
|
||||
{
|
||||
public Double get(EngineFramework engine) {
|
||||
return getter.apply(engine);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,13 +40,13 @@ import lombok.experimental.Accessors;
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Desc("Represents Block Data")
|
||||
@Desc("Represents an Iris Expression")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IrisExpression extends IrisRegistrant {
|
||||
private static final Parser parser = new Parser();
|
||||
|
||||
@ArrayType(type = IrisExpression.class, min = 1)
|
||||
@ArrayType(type = IrisExpressionLoad.class, min = 1)
|
||||
@Desc("Variables to use in this expression")
|
||||
private KList<IrisExpressionLoad> variables = new KList<>();
|
||||
|
||||
@@ -85,8 +85,7 @@ public class IrisExpression extends IrisRegistrant {
|
||||
});
|
||||
}
|
||||
|
||||
public ProceduralStream<Double> stream(RNG rng)
|
||||
{
|
||||
public ProceduralStream<Double> stream(RNG rng) {
|
||||
return streamCache.aquire(() -> ProceduralStream.of((x, z) -> evaluate(rng, x, z),
|
||||
(x, y, z) -> evaluate(rng, x, y, z), Interpolated.DOUBLE));
|
||||
}
|
||||
|
||||
@@ -34,12 +34,12 @@ import lombok.experimental.Accessors;
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Desc("Represents Block Data")
|
||||
@Desc("Represents a variable to use in your expression. Do not set the name to x, y, or z, also don't duplicate names.")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IrisExpressionLoad {
|
||||
@Required
|
||||
@Desc("The variable to assign this value to")
|
||||
@Desc("The variable to assign this value to. Do not set the name to x, y, or z")
|
||||
private String name = "";
|
||||
|
||||
@Desc("If the style value is not defined, this value will be used")
|
||||
@@ -58,13 +58,11 @@ public class IrisExpressionLoad {
|
||||
private transient AtomicCache<Double> valueCache = new AtomicCache<>();
|
||||
|
||||
public double getValue(RNG rng, IrisData data, double x, double z) {
|
||||
if(engineValue != null)
|
||||
{
|
||||
if (engineValue != null) {
|
||||
return valueCache.aquire(() -> engineValue.get(data.getEngine().getFramework()));
|
||||
}
|
||||
|
||||
if(engineStreamValue != null)
|
||||
{
|
||||
if (engineStreamValue != null) {
|
||||
return streamCache.aquire(() -> engineStreamValue.get(data.getEngine().getFramework())).get(x, z);
|
||||
}
|
||||
|
||||
@@ -76,13 +74,11 @@ public class IrisExpressionLoad {
|
||||
}
|
||||
|
||||
public double getValue(RNG rng, IrisData data, double x, double y, double z) {
|
||||
if(engineValue != null)
|
||||
{
|
||||
if (engineValue != null) {
|
||||
return valueCache.aquire(() -> engineValue.get(data.getEngine().getFramework()));
|
||||
}
|
||||
|
||||
if(engineStreamValue != null)
|
||||
{
|
||||
if (engineStreamValue != null) {
|
||||
return streamCache.aquire(() -> engineStreamValue.get(data.getEngine().getFramework())).get(x, z);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,10 @@ 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.noise.ExpressionNoise;
|
||||
import com.volmit.iris.engine.object.annotations.*;
|
||||
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.RegistryListResource;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -75,12 +78,10 @@ public class IrisGeneratorStyle {
|
||||
public CNG create(RNG rng, IrisData data) {
|
||||
return cng.aquire(() ->
|
||||
{
|
||||
if(getExpression() != null)
|
||||
{
|
||||
if (getExpression() != null) {
|
||||
IrisExpression e = data.getExpressionLoader().load(getExpression());
|
||||
|
||||
if(e != null)
|
||||
{
|
||||
if (e != null) {
|
||||
CNG cng = new CNG(rng, new ExpressionNoise(rng, e), 1D, 1)
|
||||
.bake().scale(1D / zoom).pow(exponent).bake();
|
||||
cng.setTrueFracturing(axialFracturing);
|
||||
|
||||
@@ -75,7 +75,6 @@ public class IrisObject extends IrisRegistrant {
|
||||
private transient AtomicCache<AxisAlignedBB> aabb = new AtomicCache<>();
|
||||
|
||||
|
||||
|
||||
public IrisObject(int w, int h, int d) {
|
||||
blocks = new KMap<>();
|
||||
states = new KMap<>();
|
||||
@@ -86,7 +85,7 @@ public class IrisObject extends IrisRegistrant {
|
||||
}
|
||||
|
||||
public IrisObject() {
|
||||
this(0,0,0);
|
||||
this(0, 0, 0);
|
||||
}
|
||||
|
||||
public AxisAlignedBB getAABB() {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package com.volmit.iris.engine.parallel;
|
||||
|
||||
|
||||
import com.volmit.iris.engine.hunk.Hunk;
|
||||
|
||||
public interface BurstedHunk<T> extends Hunk<T> {
|
||||
|
||||
Reference in New Issue
Block a user