This commit is contained in:
Dan Macbook 2020-08-13 05:42:02 -04:00
parent b1663c040f
commit 6c014e25b5
17 changed files with 890 additions and 332 deletions

View File

@ -0,0 +1,115 @@
package com.volmit.iris;
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JFrame;
import javax.swing.JPanel;
import com.volmit.iris.noise.CNG;
import com.volmit.iris.object.NoiseStyle;
import com.volmit.iris.util.M;
import com.volmit.iris.util.PrecisionStopwatch;
import com.volmit.iris.util.RNG;
import com.volmit.iris.util.RollingSequence;
public class NoiseView extends JPanel {
private static final long serialVersionUID = 2094606939770332040L;
RollingSequence r = new RollingSequence(60);
CNG cng = NoiseStyle.CELLULAR_IRIS_DOUBLE.create(new RNG(RNG.r.nextLong())).scale(0.25);
public NoiseView() {
for (int i = 0; i < 60; i++) {
r.put(10000);
}
}
@Override
public void paint(Graphics g) {
super.paint(g);
PrecisionStopwatch p = PrecisionStopwatch.start();
int accuracy = M.clip(r.getAverage() / 32D, 1D, 128D).intValue();
int dock = 0;
if (g instanceof Graphics2D) {
Graphics2D gg = (Graphics2D) g;
int x = 0; // current position; x
int y = 0; // current position; y
int d = 0; // current direction; 0=RIGHT, 1=DOWN, 2=LEFT, 3=UP
int c = 0; // counter
int s = 1; // chain size
// starting point
x = ((int) Math.floor(getParent().getWidth() / 2.0)) - 1;
y = ((int) Math.floor(getParent().getHeight() / 2.0)) - 1;
for (int k = 1; k <= (getParent().getWidth() - 1); k++) {
for (int j = 0; j < (k < (getParent().getHeight() - 1) ? 2 : 3); j++) {
for (int i = 0; i < s; i++) {
double n = cng.noise(x, Math.sin((double) M.ms() / 10000D) * 400D, y);
if (n > 1 || n < 0) {
System.out.println("EXCEEDED " + n);
break;
}
Color color = Color.getHSBColor((float) (n), 1f - (float) (n * n * n * n * n * n),
1f - (float) n);
gg.setColor(color);
gg.fillRect(x, y, accuracy, accuracy);
c++;
switch (d) {
case 0:
y = y + 1;
break;
case 1:
x = x + 1;
break;
case 2:
y = y - 1;
break;
case 3:
x = x - 1;
break;
}
}
d = (d + 1) % 4;
}
s = s + 1;
}
}
p.end();
r.put(p.getMilliseconds());
EventQueue.invokeLater(() -> {
repaint();
});
}
private static void createAndShowGUI() {
JFrame frame = new JFrame("Iris");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(new NoiseView());
frame.setLocationByPlatform(true);
frame.pack();
frame.setSize(900, 500);
frame.setVisible(true);
}
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
}

View File

@ -0,0 +1,47 @@
package com.volmit.iris.command;
import org.bukkit.World;
import org.bukkit.entity.Player;
import com.volmit.iris.Iris;
import com.volmit.iris.gen.IrisChunkGenerator;
import com.volmit.iris.util.MortarCommand;
import com.volmit.iris.util.MortarSender;
public class CommandIrisHotload extends MortarCommand {
public CommandIrisHotload() {
super("hotload", "hot", "h", "reload");
setDescription("Force a hotload");
requiresPermission(Iris.perm.studio);
setCategory("World");
}
@Override
public boolean handle(MortarSender sender, String[] args) {
if (sender.isPlayer()) {
Player p = sender.player();
World world = p.getWorld();
if (!(world.getGenerator() instanceof IrisChunkGenerator)) {
sender.sendMessage("You must be in an iris world.");
return true;
}
IrisChunkGenerator g = (IrisChunkGenerator) world.getGenerator();
g.onHotload();
sender.sendMessage("Hotloaded!");
return true;
}
else {
sender.sendMessage("Players only.");
}
return true;
}
@Override
protected String getArgsUsage() {
return "";
}
}

View File

@ -0,0 +1,55 @@
package com.volmit.iris.command;
import org.bukkit.World;
import org.bukkit.entity.Player;
import com.volmit.iris.Iris;
import com.volmit.iris.gen.IrisChunkGenerator;
import com.volmit.iris.util.MortarCommand;
import com.volmit.iris.util.MortarSender;
public class CommandIrisRetry extends MortarCommand {
public CommandIrisRetry() {
super("retry", "again", "rt");
setDescription("Retry generating in a failed state");
requiresPermission(Iris.perm.studio);
setCategory("World");
}
@Override
public boolean handle(MortarSender sender, String[] args) {
if (sender.isPlayer()) {
Player p = sender.player();
World world = p.getWorld();
if (!(world.getGenerator() instanceof IrisChunkGenerator)) {
sender.sendMessage("You must be in an iris world.");
return true;
}
IrisChunkGenerator g = (IrisChunkGenerator) world.getGenerator();
if (g.isFailing()) {
sender.sendMessage("Retrying. If the server is unresponsive, you may need to restart the server.");
g.retry();
}
else {
sender.sendMessage("This generator is not failing.");
}
return true;
}
else {
sender.sendMessage("Players only.");
}
return true;
}
@Override
protected String getArgsUsage() {
return "";
}
}

View File

@ -16,9 +16,15 @@ public class CommandIrisWorld extends MortarCommand
@Command
private CommandIrisPregen pregen;
@Command
private CommandIrisPregen world;
@Command
private CommandIrisHotload hotload;
public CommandIrisWorld()
{
super("world", "wrld");
super("world", "wrld", "w");
setDescription("Commands while in an iris world.");
requiresPermission(Iris.perm.studio);
setCategory("World");

View File

@ -33,7 +33,9 @@ import com.volmit.iris.object.IrisRegion;
import com.volmit.iris.object.IrisStructure;
import com.volmit.iris.util.B;
import com.volmit.iris.util.ChronoLatch;
import com.volmit.iris.util.IrisLock;
import com.volmit.iris.util.J;
import com.volmit.iris.util.M;
import com.volmit.iris.util.PrecisionStopwatch;
import com.volmit.iris.util.RNG;
@ -43,8 +45,7 @@ import net.md_5.bungee.api.ChatColor;
@Data
@EqualsAndHashCode(callSuper = false)
public abstract class ContextualChunkGenerator extends ChunkGenerator implements Listener
{
public abstract class ContextualChunkGenerator extends ChunkGenerator implements Listener {
private IrisDataManager data;
protected boolean failing;
protected int task;
@ -55,17 +56,20 @@ public abstract class ContextualChunkGenerator extends ChunkGenerator implements
protected ChronoLatch tickLatch;
protected ChronoLatch pushLatch;
protected IrisMetrics metrics;
protected IrisLock hlock;
protected World world;
protected int generated;
protected int ticks;
protected long hlast;
private boolean fastPregen = false;
protected boolean pregenDone;
public ContextualChunkGenerator()
{
public ContextualChunkGenerator() {
pushLatch = new ChronoLatch(3000);
tickLatch = new ChronoLatch(650);
perSecond = new ChronoLatch(1000);
hlast = M.ms();
hlock = new IrisLock("HotLock");
CNG.creates = 0;
generated = 0;
ticks = 0;
@ -94,45 +98,36 @@ public abstract class ContextualChunkGenerator extends ChunkGenerator implements
protected abstract void onPlayerLeft(Player p);
public IrisRegion loadRegion(String i)
{
public IrisRegion loadRegion(String i) {
return getData().getRegionLoader().load(i);
}
public IrisBiome loadBiome(String i)
{
public IrisBiome loadBiome(String i) {
return getData().getBiomeLoader().load(i);
}
public IrisStructure loadStructure(String i)
{
public IrisStructure loadStructure(String i) {
return getData().getStructureLoader().load(i);
}
public IrisObject loadObject(String i)
{
public IrisObject loadObject(String i) {
return getData().getObjectLoader().load(i);
}
public IrisDimension loadDimension(String i)
{
public IrisDimension loadDimension(String i) {
return (getData() == null ? Iris.globaldata : getData()).getDimensionLoader().load(i);
}
public IrisGenerator loadGenerator(String i)
{
public IrisGenerator loadGenerator(String i) {
return getData().getGeneratorLoader().load(i);
}
public IrisDataManager getData()
{
public IrisDataManager getData() {
return isDev() ? Iris.globaldata : data;
}
private void init(World world, RNG rng)
{
if(initialized)
{
private void init(World world, RNG rng) {
if (initialized) {
return;
}
@ -146,27 +141,23 @@ public abstract class ContextualChunkGenerator extends ChunkGenerator implements
onInit(world, masterRandom);
}
private void tick()
{
if(dev)
{
if(perSecond.flip())
{
if(generated > (fastPregen ? 1950 : 770))
{
private void tick() {
if (dev) {
if (perSecond.flip()) {
if (generated > (fastPregen ? 1950 : 770)) {
pregenDone = true;
}
if(pregenDone)
{
if (pregenDone) {
metrics.getPerSecond().put(generated);
generated = 0;
}
checkHotload();
}
}
else
{
else {
pregenDone = true;
fastPregen = false;
}
@ -175,100 +166,80 @@ public abstract class ContextualChunkGenerator extends ChunkGenerator implements
}
@EventHandler
public void on(PlayerTeleportEvent e)
{
if(e.getFrom().getWorld().equals(world) && !e.getTo().getWorld().equals(world))
{
public void on(PlayerTeleportEvent e) {
if (e.getFrom().getWorld().equals(world) && !e.getTo().getWorld().equals(world)) {
tick();
onPlayerLeft(e.getPlayer());
}
if(!e.getFrom().getWorld().equals(world) && e.getTo().getWorld().equals(world))
{
if (!e.getFrom().getWorld().equals(world) && e.getTo().getWorld().equals(world)) {
tick();
onPlayerJoin(e.getPlayer());
}
}
@EventHandler
public void on(PlayerQuitEvent e)
{
if(e.getPlayer().getWorld().equals(world))
{
public void on(PlayerQuitEvent e) {
if (e.getPlayer().getWorld().equals(world)) {
tick();
onPlayerLeft(e.getPlayer());
}
}
@EventHandler
public void on(PlayerJoinEvent e)
{
if(e.getPlayer().getWorld().equals(world))
{
public void on(PlayerJoinEvent e) {
if (e.getPlayer().getWorld().equals(world)) {
tick();
onPlayerJoin(e.getPlayer());
}
}
@EventHandler
public void on(ChunkLoadEvent e)
{
if(e.getWorld().equals(world))
{
public void on(ChunkLoadEvent e) {
if (e.getWorld().equals(world)) {
tick();
onChunkLoaded(e.getChunk());
}
}
@EventHandler
public void on(ChunkUnloadEvent e)
{
if(e.getWorld().equals(world))
{
public void on(ChunkUnloadEvent e) {
if (e.getWorld().equals(world)) {
tick();
onChunkUnloaded(e.getChunk());
}
}
@EventHandler
public void on(WorldUnloadEvent e)
{
if(world != null && e.getWorld().equals(world))
{
public void on(WorldUnloadEvent e) {
if (world != null && e.getWorld().equals(world)) {
close();
}
}
public void close()
{
public void close() {
HandlerList.unregisterAll(this);
Bukkit.getScheduler().cancelTask(getTask());
onClose();
}
@Override
public boolean canSpawn(World world, int x, int z)
{
public boolean canSpawn(World world, int x, int z) {
return super.canSpawn(world, x, z);
}
protected ChunkData generateChunkDataFailure(World world, Random no, int x, int z, BiomeGrid biomeGrid)
{
protected ChunkData generateChunkDataFailure(World world, Random no, int x, int z, BiomeGrid biomeGrid) {
ChunkData c = Bukkit.createChunkData(world);
for(int i = 0; i < 16; i++)
{
for(int j = 0; j < 16; j++)
{
for (int i = 0; i < 16; i++) {
for (int j = 0; j < 16; j++) {
int h = 0;
if(j == i || j + i == 16)
{
if (j == i || j + i == 16) {
c.setBlock(i, h, j, B.getBlockData("RED_TERRACOTTA"));
}
else
{
else {
c.setBlock(i, h, j, B.getBlockData("BLACK_TERRACOTTA"));
}
}
@ -277,23 +248,18 @@ public abstract class ContextualChunkGenerator extends ChunkGenerator implements
return c;
}
protected ChunkData generateChunkFastPregen(World world, Random no, int x, int z, BiomeGrid biomeGrid)
{
protected ChunkData generateChunkFastPregen(World world, Random no, int x, int z, BiomeGrid biomeGrid) {
ChunkData c = Bukkit.createChunkData(world);
for(int i = 0; i < 16; i++)
{
for(int j = 0; j < 16; j++)
{
for (int i = 0; i < 16; i++) {
for (int j = 0; j < 16; j++) {
int h = 0;
if(j == i || j + i == 16)
{
if (j == i || j + i == 16) {
c.setBlock(i, h, j, B.getBlockData("BLUE_TERRACOTTA"));
}
else
{
else {
c.setBlock(i, h, j, B.getBlockData("WHITE_TERRACOTTA"));
}
}
@ -303,51 +269,33 @@ public abstract class ContextualChunkGenerator extends ChunkGenerator implements
}
@Override
public ChunkData generateChunkData(World world, Random no, int x, int z, BiomeGrid biomeGrid)
{
if(!dev)
{
public ChunkData generateChunkData(World world, Random no, int x, int z, BiomeGrid biomeGrid) {
hlock.getLock();
if (!dev) {
pregenDone = true;
fastPregen = false;
}
PrecisionStopwatch sx = PrecisionStopwatch.start();
if(failing)
{
if (failing) {
hlock.unlock();
return generateChunkDataFailure(world, no, x, z, biomeGrid);
}
try
{
if(pushLatch.flip())
{
if(this.world == null)
{
this.world = world;
}
Iris.hotloader.check((IrisContext) this);
if(this instanceof IrisContext)
{
IrisContext.pushContext((IrisContext) this);
}
}
try {
checkHotload(world);
PrecisionStopwatch s = PrecisionStopwatch.start();
RNG random = new RNG(world.getSeed());
init(world, random.nextParallelRNG(0));
ChunkData c = Bukkit.createChunkData(world);
if(!pregenDone && fastPregen)
{
if (!pregenDone && fastPregen) {
c = generateChunkFastPregen(world, no, x, z, biomeGrid);
}
else
{
else {
onGenerate(random, x, z, c, biomeGrid);
}
@ -357,46 +305,73 @@ public abstract class ContextualChunkGenerator extends ChunkGenerator implements
CNG.hits = 0;
Iris.instance.hit(hits);
metrics.getLoss().put(sx.getMilliseconds() - s.getMilliseconds());
hlock.unlock();
return c;
}
catch(Throwable e)
{
catch (Throwable e) {
fail(e);
}
hlock.unlock();
return generateChunkDataFailure(world, no, x, z, biomeGrid);
}
public void onHotload()
{
public void checkHotload() {
if (M.ms() - hlast < 1000) {
return;
}
protected void fail(Throwable e)
{
if(failing)
{
hlock.lock();
if (world != null) {
checkHotload(world);
}
hlock.unlock();
}
private void checkHotload(World world) {
if (pushLatch.flip()) {
if (this.world == null) {
this.world = world;
}
Iris.hotloader.check((IrisContext) this);
if (this instanceof IrisContext) {
IrisContext.pushContext((IrisContext) this);
}
}
}
public void onHotload() {
hlast = M.ms();
}
protected void fail(Throwable e) {
if (failing) {
return;
}
failing = true;
e.printStackTrace();
J.a(() ->
{
J.a(() -> {
J.sleep(1000);
Iris.error("---------------------------------------------------------------------------------------------------------");
Iris.error(
"---------------------------------------------------------------------------------------------------------");
e.printStackTrace();
Iris.error("---------------------------------------------------------------------------------------------------------");
Iris.error(
"---------------------------------------------------------------------------------------------------------");
Iris.error("ERROR! Failed to generate chunk! Iris has entered a failed state!");
Iris.error("---------------------------------------------------------------------------------------------------------");
Iris.error(
"---------------------------------------------------------------------------------------------------------");
for(Player i : world.getPlayers())
{
Iris.instance.imsg(i, ChatColor.DARK_RED + "Iris Generator has entered a failed state!");
for (Player i : world.getPlayers()) {
Iris.instance.imsg(i, ChatColor.DARK_RED + "Iris Generator has crashed!");
Iris.instance.imsg(i, ChatColor.RED + "- Check the console for the error.");
Iris.instance.imsg(i, ChatColor.RED + "- Then simply run /iris dev");
Iris.instance.imsg(i, ChatColor.RED + "- To Regen, use /iris std open <dim>");
Iris.instance.imsg(i, ChatColor.RED + "- To Retry the chunk, use /iris world retry");
}
});
@ -404,20 +379,17 @@ public abstract class ContextualChunkGenerator extends ChunkGenerator implements
}
@Override
public List<BlockPopulator> getDefaultPopulators(World world)
{
public List<BlockPopulator> getDefaultPopulators(World world) {
return super.getDefaultPopulators(world);
}
@Override
public Location getFixedSpawnLocation(World world, Random random)
{
public Location getFixedSpawnLocation(World world, Random random) {
return super.getFixedSpawnLocation(world, random);
}
@Override
public boolean isParallelCapable()
{
public boolean isParallelCapable() {
return true;
}
}

View File

@ -25,98 +25,92 @@ import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = false)
public class IrisChunkGenerator extends CeilingChunkGenerator implements IrisContext
{
public class IrisChunkGenerator extends CeilingChunkGenerator implements IrisContext {
private Method initLighting;
private IrisLock lock;
private KMap<Player, IrisBiome> b = new KMap<>();
public IrisChunkGenerator(String dimensionName, int threads)
{
public IrisChunkGenerator(String dimensionName, int threads) {
super(dimensionName, threads);
lock = new IrisLock("IrisChunkGenerator");
}
public IrisChunkGenerator(String dimensionName)
{
public IrisChunkGenerator(String dimensionName) {
super(dimensionName, 16);
lock = new IrisLock("IrisChunkGenerator");
}
public IrisChunkGenerator(int tc)
{
public IrisChunkGenerator(int tc) {
super("", tc);
lock = new IrisLock("IrisChunkGenerator");
}
public void hotload() {
onHotload();
}
public void retry() {
if (failing) {
failing = false;
hotload();
}
}
@Override
protected void onGenerate(RNG random, int x, int z, ChunkData data, BiomeGrid grid)
{
protected void onGenerate(RNG random, int x, int z, ChunkData data, BiomeGrid grid) {
lock.lock();
super.onGenerate(random, x, z, data, grid);
lock.unlock();
}
public void onInit(World world, RNG rng)
{
try
{
public void onInit(World world, RNG rng) {
try {
super.onInit(world, rng);
}
catch(Throwable e)
{
catch (Throwable e) {
fail(e);
}
}
@Override
public BiomeResult getBiome(int x, int z)
{
public BiomeResult getBiome(int x, int z) {
return sampleBiome(x, z);
}
@Override
public IrisRegion getRegion(int x, int z)
{
public IrisRegion getRegion(int x, int z) {
return sampleRegion(x, z);
}
@Override
public int getHeight(int x, int z)
{
public int getHeight(int x, int z) {
return sampleHeight(x, z);
}
@Override
public void onTick(int ticks)
{
public void onTick(int ticks) {
super.onTick(ticks);
for(Player i : getWorld().getPlayers())
{
for (Player i : getWorld().getPlayers()) {
Location l = i.getLocation();
IrisRegion r = sampleRegion(l.getBlockX(), l.getBlockZ());
IrisBiome b = sampleTrueBiome(l.getBlockX(), l.getBlockY(), l.getBlockZ()).getBiome();
for(IrisEffect j : r.getEffects())
{
for (IrisEffect j : r.getEffects()) {
j.apply(i, this);
}
for(IrisEffect j : b.getEffects())
{
for (IrisEffect j : b.getEffects()) {
j.apply(i, this);
}
}
}
@Override
protected void onClose()
{
protected void onClose() {
super.onClose();
try
{
try {
parallaxMap.saveAll();
ceilingParallaxMap.saveAll();
parallaxMap.getLoadedChunks().clear();
@ -125,8 +119,7 @@ public class IrisChunkGenerator extends CeilingChunkGenerator implements IrisCon
ceilingParallaxMap.getLoadedRegions().clear();
}
catch(IOException e)
{
catch (IOException e) {
e.printStackTrace();
}
@ -141,54 +134,45 @@ public class IrisChunkGenerator extends CeilingChunkGenerator implements IrisCon
}
@Override
protected void onFailure(Throwable e)
{
protected void onFailure(Throwable e) {
}
@Override
protected void onChunkLoaded(Chunk c)
{
protected void onChunkLoaded(Chunk c) {
}
@Override
protected void onChunkUnloaded(Chunk c)
{
protected void onChunkUnloaded(Chunk c) {
}
@Override
protected void onPlayerJoin(Player p)
{
protected void onPlayerJoin(Player p) {
}
@Override
public void onPlayerLeft(Player p)
{
public void onPlayerLeft(Player p) {
super.onPlayerLeft(p);
}
@Override
public void onHotloaded()
{
public void onHotloaded() {
CNG.creates = 0;
getData().dump();
onHotload();
}
public long guessMemoryUsage()
{
public long guessMemoryUsage() {
long bytes = 1024 * 1024 * (8 + (getThreads() / 3));
for(AtomicRegionData i : parallaxMap.getLoadedRegions().values())
{
for (AtomicRegionData i : parallaxMap.getLoadedRegions().values()) {
bytes += i.guessMemoryUsage();
}
for(AtomicRegionData i : ceilingParallaxMap.getLoadedRegions().values())
{
for (AtomicRegionData i : ceilingParallaxMap.getLoadedRegions().values()) {
bytes += i.guessMemoryUsage();
}
@ -201,28 +185,23 @@ public class IrisChunkGenerator extends CeilingChunkGenerator implements IrisCon
}
@Override
public boolean shouldGenerateCaves()
{
public boolean shouldGenerateCaves() {
return false;
}
@Override
public boolean shouldGenerateDecorations()
{
public boolean shouldGenerateDecorations() {
return false;
}
@Override
public boolean shouldGenerateMobs()
{
public boolean shouldGenerateMobs() {
return true;
}
@Override
public boolean shouldGenerateStructures()
{
if(!isInitialized())
{
public boolean shouldGenerateStructures() {
if (!isInitialized()) {
return false;
}

View File

@ -34,8 +34,7 @@ public class CNG {
private double down;
private double power;
public NoiseGenerator getGen()
{
public NoiseGenerator getGen() {
return generator;
}
@ -43,13 +42,50 @@ public class CNG {
return signature(rng, NoiseType.SIMPLEX);
}
public static CNG signatureHalf(RNG rng) {
return signatureHalf(rng, NoiseType.SIMPLEX);
}
public static CNG signatureThick(RNG rng) {
return signatureThick(rng, NoiseType.SIMPLEX);
}
public static CNG signatureDouble(RNG rng) {
return signatureDouble(rng, NoiseType.SIMPLEX);
}
public static CNG signatureDouble(RNG rng, NoiseType t) {
return signatureThick(rng, t).fractureWith(signature(rng.nextParallelRNG(4956)), 93);
}
public static CNG signature(RNG rng, NoiseType t) {
// @builder
return new CNG(rng.nextParallelRNG(17), t, 1D, 1).scale(0.012)
.fractureWith(new CNG(rng.nextParallelRNG(18), 1, 2).scale(0.018)
.child(new CNG(rng.nextParallelRNG(19), 1, 1).scale(0.1))
.fractureWith(new CNG(rng.nextParallelRNG(20), 1, 1).scale(0.15), 24), 44)
.down(0.3).patch(2.5);
return new CNG(rng.nextParallelRNG(17), t, 1D, 1)
.fractureWith(
new CNG(rng.nextParallelRNG(18), 1, 1).scale(0.9)
.fractureWith(new CNG(rng.nextParallelRNG(20), 1, 1).scale(0.21)
.fractureWith(new CNG(rng.nextParallelRNG(20), 1, 1).scale(0.9), 620), 145),
44);
// @done
}
public static CNG signatureThick(RNG rng, NoiseType t) {
// @builder
return new CNG(rng.nextParallelRNG(133), t, 1D, 1)
.fractureWith(
new CNG(rng.nextParallelRNG(18), 1, 1).scale(0.5)
.fractureWith(new CNG(rng.nextParallelRNG(20), 1, 1).scale(0.11)
.fractureWith(new CNG(rng.nextParallelRNG(20), 1, 1).scale(0.4), 620), 145),
44);
// @done
}
public static CNG signatureHalf(RNG rng, NoiseType t) {
// @builder
return new CNG(rng.nextParallelRNG(127), t, 1D, 1).fractureWith(
new CNG(rng.nextParallelRNG(18), 1, 1).scale(0.9).fractureWith(new CNG(rng.nextParallelRNG(20), 1, 1)
.scale(0.21).fractureWith(new CNG(rng.nextParallelRNG(20), 1, 1).scale(0.9), 420), 99),
22);
// @done
}

View File

@ -0,0 +1,28 @@
package com.volmit.iris.noise;
public class CubicNoise implements NoiseGenerator {
private final FastNoise n;
public CubicNoise(long seed) {
this.n = new FastNoise((int) seed);
}
private double f(double n) {
return (n / 2D) + 0.5D;
}
@Override
public double noise(double x) {
return f(n.GetCubic((float) x, 0));
}
@Override
public double noise(double x, double z) {
return f(n.GetCubic((float) x, (float) z));
}
@Override
public double noise(double x, double y, double z) {
return f(n.GetCubic((float) x, (float) y, (float) z));
}
}

View File

@ -0,0 +1,38 @@
package com.volmit.iris.noise;
import com.volmit.iris.noise.FastNoise.FractalType;
import com.volmit.iris.util.RNG;
public class FractalBillowSimplexNoise implements NoiseGenerator, OctaveNoise {
private final FastNoise n;
public FractalBillowSimplexNoise(long seed) {
this.n = new FastNoise(new RNG(seed).imax());
n.SetFractalOctaves(1);
n.SetFractalType(FractalType.Billow);
}
public double f(double v) {
return (v / 2D) + 0.5D;
}
@Override
public double noise(double x) {
return f(n.GetSimplexFractal((float) x, 0f));
}
@Override
public double noise(double x, double z) {
return f(n.GetSimplexFractal((float) x, (float) z));
}
@Override
public double noise(double x, double y, double z) {
return f(n.GetSimplexFractal((float) x, (float) y, (float) z));
}
@Override
public void setOctaves(int o) {
n.SetFractalOctaves(o);
}
}

View File

@ -0,0 +1,38 @@
package com.volmit.iris.noise;
import com.volmit.iris.noise.FastNoise.FractalType;
import com.volmit.iris.util.RNG;
public class FractalFBMSimplexNoise implements NoiseGenerator, OctaveNoise {
private final FastNoise n;
public FractalFBMSimplexNoise(long seed) {
this.n = new FastNoise(new RNG(seed).imax());
n.SetFractalOctaves(1);
n.SetFractalType(FractalType.FBM);
}
public double f(double v) {
return (v / 2D) + 0.5D;
}
@Override
public double noise(double x) {
return f(n.GetSimplexFractal((float) x, 0f));
}
@Override
public double noise(double x, double z) {
return f(n.GetSimplexFractal((float) x, (float) z));
}
@Override
public double noise(double x, double y, double z) {
return f(n.GetSimplexFractal((float) x, (float) y, (float) z));
}
@Override
public void setOctaves(int o) {
n.SetFractalOctaves(o);
}
}

View File

@ -0,0 +1,38 @@
package com.volmit.iris.noise;
import com.volmit.iris.noise.FastNoise.FractalType;
import com.volmit.iris.util.RNG;
public class FractalRigidMultiSimplexNoise implements NoiseGenerator, OctaveNoise {
private final FastNoise n;
public FractalRigidMultiSimplexNoise(long seed) {
this.n = new FastNoise(new RNG(seed).imax());
n.SetFractalOctaves(1);
n.SetFractalType(FractalType.RigidMulti);
}
public double f(double v) {
return (v / 2D) + 0.5D;
}
@Override
public double noise(double x) {
return f(n.GetSimplexFractal((float) x, 0f));
}
@Override
public double noise(double x, double z) {
return f(n.GetSimplexFractal((float) x, (float) z));
}
@Override
public double noise(double x, double y, double z) {
return f(n.GetSimplexFractal((float) x, (float) y, (float) z));
}
@Override
public void setOctaves(int o) {
n.SetFractalOctaves(o);
}
}

View File

@ -0,0 +1,32 @@
package com.volmit.iris.noise;
public class GlobNoise implements NoiseGenerator {
private final FastNoise n;
public GlobNoise(long seed) {
this.n = new FastNoise((int) seed);
n.SetNoiseType(FastNoise.NoiseType.Cellular);
n.SetCellularReturnType(FastNoise.CellularReturnType.Distance2Div);
n.SetCellularDistanceFunction(FastNoise.CellularDistanceFunction.Natural);
}
private double f(double n)
{
return n+1D;
}
@Override
public double noise(double x) {
return f(n.GetCellular((float) x, 0));
}
@Override
public double noise(double x, double z) {
return f(n.GetCellular((float) x, (float) z));
}
@Override
public double noise(double x, double y, double z) {
return f(n.GetCellular((float) x, (float) y, (float) z));
}
}

View File

@ -3,7 +3,12 @@ package com.volmit.iris.noise;
public enum NoiseType {
WHITE(seed -> new WhiteNoise(seed)),
SIMPLEX(seed -> new SimplexNoise(seed)),
FRACTAL_BILLOW_SIMPLEX(seed -> new FractalBillowSimplexNoise(seed)),
FRACTAL_FBM_SIMPLEX(seed -> new FractalFBMSimplexNoise(seed)),
FRACTAL_RIGID_MULTI_SIMPLEX(seed -> new FractalRigidMultiSimplexNoise(seed)),
CELLULAR(seed -> new CellularNoise(seed)),
GLOB(seed -> new GlobNoise(seed)),
CUBIC(seed -> new CubicNoise(seed)),
CELLULAR_HEIGHT(seed -> new CellHeightNoise(seed)),
VASCULAR(seed -> new VascularNoise(seed));
@ -13,8 +18,7 @@ public enum NoiseType {
this.f = f;
}
public NoiseGenerator create(long seed)
{
public NoiseGenerator create(long seed) {
return f.create(seed);
}
}

View File

@ -1,29 +0,0 @@
package com.volmit.iris.noise;
import com.volmit.iris.object.NoiseStyle;
import com.volmit.iris.util.RNG;
public class Research {
public static void main(String[] args) {
CNG cng = NoiseStyle.VIGOCTAVE_SIMPLEX.create(new RNG(RNG.r.nextLong()));
double max = -1;
double min = 2;
for (int i = 0; i < 999999; i++) {
double n = cng.noise(i, i * 2, i * 4);
if (n < min) {
min = n;
}
if (n > max) {
max = n;
}
}
System.out.println(min + " - " + max);
}
}

View File

@ -19,8 +19,7 @@ import lombok.Data;
@Desc("A biome decorator is used for placing flowers, grass, cacti and so on")
@Data
public class IrisBiomeDecorator
{
public class IrisBiomeDecorator {
@DontObfuscate
@Desc("The varience dispersion is used when multiple blocks are put in the palette. Scatter scrambles them, Wispy shows streak-looking varience")
private NoiseStyle variance = NoiseStyle.STATIC;
@ -82,78 +81,64 @@ public class IrisBiomeDecorator
private transient AtomicCache<CNG> heightGenerator = new AtomicCache<>();
private transient AtomicCache<KList<BlockData>> blockData = new AtomicCache<>();
public int getHeight(RNG rng, double x, double z)
{
if(stackMin == stackMax)
{
public int getHeight(RNG rng, double x, double z) {
if (stackMin == stackMax) {
return stackMin;
}
return getHeightGenerator(rng).fit(stackMin, stackMax, x ,z);
return getHeightGenerator(rng).fit(stackMin, stackMax, x / verticalZoom, z / verticalZoom);
}
public CNG getHeightGenerator(RNG rng)
{
return heightGenerator.aquire(() ->
{
return heightVariance.create(rng.nextParallelRNG(getBlockData().size() + stackMax + stackMin)).scale(1D / verticalZoom);
public CNG getHeightGenerator(RNG rng) {
return heightGenerator.aquire(() -> {
return heightVariance.create(rng.nextParallelRNG(getBlockData().size() + stackMax + stackMin));
});
}
public CNG getGenerator(RNG rng)
{
public CNG getGenerator(RNG rng) {
long key = rng.nextParallelRNG(1).nextLong();
if(layerGenerators == null)
{
if (layerGenerators == null) {
layerGenerators = new KMap<>();
}
if(!layerGenerators.containsKey(key))
{
layerGenerators.put(key, dispersion.create(rng.nextParallelRNG((int) (getBlockData().size() + key))).scale(1D / zoom));
if (!layerGenerators.containsKey(key)) {
layerGenerators.put(key, dispersion.create(rng.nextParallelRNG((int) (getBlockData().size() + key))));
}
return layerGenerators.get(key);
}
public CNG getVarianceGenerator(RNG rng)
{
public CNG getVarianceGenerator(RNG rng) {
long key = rng.nextParallelRNG(4).nextLong();
if(layerVarianceGenerators == null)
{
if (layerVarianceGenerators == null) {
layerVarianceGenerators = new KMap<>();
}
if(!layerVarianceGenerators.containsKey(key))
{
layerVarianceGenerators.put(key, variance.create(rng.nextParallelRNG((int) (getBlockData().size() + key))).scale(1D / varianceZoom));
if (!layerVarianceGenerators.containsKey(key)) {
layerVarianceGenerators.put(key,
variance.create(rng.nextParallelRNG((int) (getBlockData().size() + key))).scale(1D / varianceZoom));
}
return layerVarianceGenerators.get(key);
}
public KList<String> add(String b)
{
public KList<String> add(String b) {
palette.add(b);
return palette;
}
public BlockData getBlockData(RNG rng, double x, double z)
{
if(getGenerator(rng) == null)
{
public BlockData getBlockData(RNG rng, double x, double z) {
if (getGenerator(rng) == null) {
return null;
}
if(getBlockData() == null)
{
if (getBlockData() == null) {
return null;
}
if(getBlockData().isEmpty())
{
if (getBlockData().isEmpty()) {
return null;
}
@ -162,10 +147,8 @@ public class IrisBiomeDecorator
xx /= getZoom();
zz /= getZoom();
if(getGenerator(rng).fitDoubleD(0D, 1D, xx, zz) <= chance)
{
if(getBlockData().size() == 1)
{
if (getGenerator(rng).fitDoubleD(0D, 1D, xx, zz) <= chance) {
if (getBlockData().size() == 1) {
return getBlockData().get(0);
}
@ -175,16 +158,12 @@ public class IrisBiomeDecorator
return null;
}
public KList<BlockData> getBlockData()
{
return blockData.aquire(() ->
{
public KList<BlockData> getBlockData() {
return blockData.aquire(() -> {
KList<BlockData> blockData = new KList<>();
for(String i : palette)
{
for (String i : palette) {
BlockData bx = B.getBlockData(i);
if(bx != null)
{
if (bx != null) {
blockData.add(bx);
}
}

View File

@ -18,8 +18,7 @@ import lombok.Data;
@Desc("A layer of surface / subsurface material in biomes")
@Data
public class IrisBiomePaletteLayer
{
public class IrisBiomePaletteLayer {
@DontObfuscate
@Desc("The style of noise")
private NoiseStyle style = NoiseStyle.STATIC;
@ -51,52 +50,42 @@ public class IrisBiomePaletteLayer
private transient AtomicCache<CNG> layerGenerator = new AtomicCache<>();
private transient AtomicCache<CNG> heightGenerator = new AtomicCache<>();
public CNG getHeightGenerator(RNG rng)
{
return heightGenerator.aquire(() -> CNG.signature(rng.nextParallelRNG(minHeight * maxHeight + getBlockData().size())));
public CNG getHeightGenerator(RNG rng) {
return heightGenerator
.aquire(() -> CNG.signature(rng.nextParallelRNG(minHeight * maxHeight + getBlockData().size())));
}
public BlockData get(RNG rng, double x, double y, double z)
{
if(getBlockData().isEmpty())
{
public BlockData get(RNG rng, double x, double y, double z) {
if (getBlockData().isEmpty()) {
return null;
}
if(getBlockData().size() == 1)
{
if (getBlockData().size() == 1) {
return getBlockData().get(0);
}
return getLayerGenerator(rng).fit(getBlockData(), x, y, z);
return getLayerGenerator(rng).fit(getBlockData(), x / zoom, y / zoom, z / zoom);
}
public CNG getLayerGenerator(RNG rng)
{
return layerGenerator.aquire(() ->
{
public CNG getLayerGenerator(RNG rng) {
return layerGenerator.aquire(() -> {
RNG rngx = rng.nextParallelRNG(minHeight + maxHeight + getBlockData().size());
return style.create(rngx);
});
}
public KList<String> add(String b)
{
public KList<String> add(String b) {
palette.add(b);
return palette;
}
public KList<BlockData> getBlockData()
{
return blockData.aquire(() ->
{
public KList<BlockData> getBlockData() {
return blockData.aquire(() -> {
KList<BlockData> blockData = new KList<>();
for(String ix : palette)
{
for (String ix : palette) {
BlockData bx = B.getBlockData(ix);
if(bx != null)
{
if (bx != null) {
blockData.add(bx);
}
}
@ -105,8 +94,7 @@ public class IrisBiomePaletteLayer
});
}
public IrisBiomePaletteLayer zero()
{
public IrisBiomePaletteLayer zero() {
palette.clear();
return this;
}

View File

@ -24,47 +24,243 @@ public enum NoiseStyle {
@Desc("Wispy Perlin-looking simplex noise. The 'iris' style noise.")
@DontObfuscate
IRIS(rng -> CNG.signature(rng)),
IRIS(rng -> CNG.signature(rng).scale(1)),
@Desc("Wispy Perlin-looking simplex noise. The 'iris' style noise.")
@DontObfuscate
IRIS_DOUBLE(rng -> CNG.signatureDouble(rng).scale(1)),
@Desc("Wispy Perlin-looking simplex noise. The 'iris' style noise.")
@DontObfuscate
IRIS_THICK(rng -> CNG.signatureThick(rng).scale(1)),
@Desc("Wispy Perlin-looking simplex noise. The 'iris' style noise.")
@DontObfuscate
IRIS_HALF(rng -> CNG.signatureHalf(rng).scale(1)),
@Desc("Basic, Smooth & Fast Simplex noise.")
@DontObfuscate
SIMPLEX(rng -> new CNG(rng, 1D, 1).scale(0.04)),
SIMPLEX(rng -> new CNG(rng, 1D, 1).scale(1)),
@Desc("Billow Fractal Simplex Noise. Single octave.")
@DontObfuscate
FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 1)),
@Desc("FBM Fractal Simplex Noise. Single octave.")
@DontObfuscate
FRACTAL_FBM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 1)),
@Desc("Billow Fractal Iris Noise. Single octave.")
@DontObfuscate
FRACTAL_BILLOW_IRIS(rng -> CNG.signature(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX)),
@Desc("FBM Fractal Iris Noise. Single octave.")
@DontObfuscate
FRACTAL_FBM_IRIS(rng -> CNG.signature(rng, NoiseType.FRACTAL_FBM_SIMPLEX)),
@Desc("Billow Fractal Iris Noise. Single octave.")
@DontObfuscate
FRACTAL_BILLOW_IRIS_HALF(rng -> CNG.signatureHalf(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX)),
@Desc("FBM Fractal Iris Noise. Single octave.")
@DontObfuscate
FRACTAL_FBM_IRIS_HALF(rng -> CNG.signatureHalf(rng, NoiseType.FRACTAL_FBM_SIMPLEX)),
@Desc("Billow Fractal Iris Noise. Single octave.")
@DontObfuscate
FRACTAL_BILLOW_IRIS_THICK(rng -> CNG.signatureThick(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX)),
@Desc("FBM Fractal Iris Noise. Single octave.")
@DontObfuscate
FRACTAL_FBM_IRIS_THICK(rng -> CNG.signatureThick(rng, NoiseType.FRACTAL_FBM_SIMPLEX)),
@Desc("Rigid Multi Fractal Simplex Noise. Single octave.")
@DontObfuscate
FRACTAL_RM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX, 1D, 1)),
@Desc("Billow Fractal Simplex Noise. 2 octaves.")
@DontObfuscate
BIOCTAVE_FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 2)),
@Desc("FBM Fractal Simplex Noise. 2 octaves.")
@DontObfuscate
BIOCTAVE_FRACTAL_FBM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 2)),
@Desc("Rigid Multi Fractal Simplex Noise. 2 octaves.")
@DontObfuscate
BIOCTAVE_FRACTAL_RM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX, 1D, 2)),
@Desc("Rigid Multi Fractal Simplex Noise. 3 octaves.")
@DontObfuscate
TRIOCTAVE_FRACTAL_RM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX, 1D, 3)),
@Desc("Billow Fractal Simplex Noise. 3 octaves.")
@DontObfuscate
TRIOCTAVE_FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 3)),
@Desc("FBM Fractal Simplex Noise. 3 octaves.")
@DontObfuscate
TRIOCTAVE_FRACTAL_FBM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 3)),
@Desc("Rigid Multi Fractal Simplex Noise. 4 octaves.")
@DontObfuscate
QUADOCTAVE_FRACTAL_RM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX, 1D, 4)),
@Desc("Billow Fractal Simplex Noise. 4 octaves.")
@DontObfuscate
QUADOCTAVE_FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 4)),
@Desc("FBM Fractal Simplex Noise. 4 octaves.")
@DontObfuscate
QUADOCTAVE_FRACTAL_FBM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 4)),
@Desc("Rigid Multi Fractal Simplex Noise. 5 octaves.")
@DontObfuscate
QUINTOCTAVE_FRACTAL_RM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX, 1D, 5)),
@Desc("Billow Fractal Simplex Noise. 5 octaves.")
@DontObfuscate
QUINTOCTAVE_FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 5)),
@Desc("FBM Fractal Simplex Noise. 5 octaves.")
@DontObfuscate
QUINTOCTAVE_FRACTAL_FBM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 5)),
@Desc("Rigid Multi Fractal Simplex Noise. 6 octaves.")
@DontObfuscate
SEXOCTAVE_FRACTAL_RM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX, 1D, 6)),
@Desc("Billow Fractal Simplex Noise. 6 octaves.")
@DontObfuscate
SEXOCTAVE_FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 6)),
@Desc("FBM Fractal Simplex Noise. 6 octaves.")
@DontObfuscate
SEXOCTAVE_FRACTAL_FBM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 6)),
@Desc("Rigid Multi Fractal Simplex Noise. 7 octaves.")
@DontObfuscate
SEPTOCTAVE_FRACTAL_RM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX, 1D, 7)),
@Desc("Billow Fractal Simplex Noise. 7 octaves.")
@DontObfuscate
SEPTOCTAVE_FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 7)),
@Desc("FBM Fractal Simplex Noise. 7 octaves.")
@DontObfuscate
SEPTOCTAVE_FRACTAL_FBM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 7)),
@Desc("Rigid Multi Fractal Simplex Noise. 8 octaves.")
@DontObfuscate
OCTOCTAVE_FRACTAL_RM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX, 1D, 8)),
@Desc("Billow Fractal Simplex Noise. 8 octaves.")
@DontObfuscate
OCTOCTAVE_FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 8)),
@Desc("FBM Fractal Simplex Noise. 8 octaves.")
@DontObfuscate
OCTOCTAVE_FRACTAL_FBM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 8)),
@Desc("Rigid Multi Fractal Simplex Noise. 9 octaves.")
@DontObfuscate
NONOCTAVE_FRACTAL_RM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX, 1D, 9)),
@Desc("Billow Fractal Simplex Noise. 9 octaves.")
@DontObfuscate
NONOCTAVE_FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 9)),
@Desc("FBM Fractal Simplex Noise. 9 octaves.")
@DontObfuscate
NONOCTAVE_FRACTAL_FBM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 9)),
@Desc("Rigid Multi Fractal Simplex Noise. 10 octaves.")
@DontObfuscate
VIGOCTAVE_FRACTAL_RM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX, 1D, 10)),
@Desc("Billow Fractal Simplex Noise. 10 octaves.")
@DontObfuscate
VIGOCTAVE_FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 10)),
@Desc("FBM Fractal Simplex Noise. 10 octaves.")
@DontObfuscate
VIGOCTAVE_FRACTAL_FBM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 10)),
@Desc("Basic, Smooth & Fast Simplex noise. Uses 2 octaves")
@DontObfuscate
BIOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 2).scale(0.04)),
BIOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 2).scale(1D / 2D)),
@Desc("Basic, Smooth & Fast Simplex noise. Uses 3 octaves")
@DontObfuscate
TRIOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 3).scale(0.04)),
TRIOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 3).scale(1D / 3D)),
@Desc("Basic, Smooth & Fast Simplex noise. Uses 4 octaves")
@DontObfuscate
QUADOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 4).scale(0.04)),
QUADOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 4).scale(1D / 4D)),
@Desc("Basic, Smooth & Fast Simplex noise. Uses 5 octaves")
@DontObfuscate
QUINTOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 5).scale(0.04)),
QUINTOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 5).scale(1D / 5D)),
@Desc("Basic, Smooth & Fast Simplex noise. Uses 6 octaves")
@DontObfuscate
SEXOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 6).scale(0.04)),
SEXOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 6).scale(1D / 6D)),
@Desc("Basic, Smooth & Fast Simplex noise. Uses 7 octaves")
@DontObfuscate
SEPTOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 7).scale(0.04)),
SEPTOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 7).scale(1D / 12D)),
@Desc("Basic, Smooth & Fast Simplex noise. Uses 8 octaves")
@DontObfuscate
OCTOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 8).scale(0.04)),
OCTOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 8).scale(1D / 25D)),
@Desc("Basic, Smooth & Fast Simplex noise. Uses 9 octaves")
@DontObfuscate
NONOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 9).scale(0.04)),
NONOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 9).scale(1D / 50D)),
@Desc("Basic, Smooth & Fast Simplex noise. Uses 10 octaves")
@DontObfuscate
VIGOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 10).scale(0.04)),
VIGOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 10).scale(1D / 100D)),
@Desc("Glob noise is like cellular, but with globs...")
@DontObfuscate
GLOB(rng -> new CNG(rng, NoiseType.GLOB, 1D, 1)),
@Desc("Glob noise is like cellular, but with globs...")
@DontObfuscate
GLOB_IRIS(rng -> CNG.signature(rng, NoiseType.GLOB)),
@Desc("Glob noise is like cellular, but with globs...")
@DontObfuscate
GLOB_IRIS_HALF(rng -> CNG.signatureHalf(rng, NoiseType.GLOB)),
@Desc("Glob noise is like cellular, but with globs...")
@DontObfuscate
GLOB_IRIS_DOUBLE(rng -> CNG.signatureDouble(rng, NoiseType.GLOB)),
@Desc("Glob noise is like cellular, but with globs...")
@DontObfuscate
GLOB_IRIS_THICK(rng -> CNG.signatureThick(rng, NoiseType.GLOB)),
@Desc("Cubic Noise")
@DontObfuscate
LAVALAMP(rng -> new CNG(rng, NoiseType.CUBIC, 1D, 1).scale(256)),
@Desc("Cubic Noise")
@DontObfuscate
LAVALAMP_IRIS(rng -> CNG.signature(rng, NoiseType.CUBIC).scale(256)),
@Desc("Cubic Noise")
@DontObfuscate
LAVALAMP_IRIS_HALF(rng -> CNG.signatureHalf(rng, NoiseType.CUBIC).scale(256)),
@Desc("Cubic Noise")
@DontObfuscate
LAVALAMP_IRIS_DOUBLE(rng -> CNG.signatureDouble(rng, NoiseType.CUBIC).scale(256)),
@Desc("Cubic Noise")
@DontObfuscate
LAVALAMP_IRIS_THICK(rng -> CNG.signatureThick(rng, NoiseType.CUBIC).scale(256)),
@Desc("Cellular noise creates the same noise level for cells, changes noise level on cell borders.")
@DontObfuscate
@ -74,13 +270,37 @@ public enum NoiseStyle {
@DontObfuscate
CELLULAR_IRIS(rng -> CNG.signature(rng, NoiseType.CELLULAR)),
@Desc("Cellular noise creates the same noise level for cells, changes noise level on cell borders. Cells are distorted using Iris styled wispy noise.")
@DontObfuscate
CELLULAR_IRIS_THICK(rng -> CNG.signatureThick(rng, NoiseType.CELLULAR)),
@Desc("Cellular noise creates the same noise level for cells, changes noise level on cell borders. Cells are distorted using Iris styled wispy noise.")
@DontObfuscate
CELLULAR_IRIS_DOUBLE(rng -> CNG.signatureDouble(rng, NoiseType.CELLULAR)),
@Desc("Cellular noise creates the same noise level for cells, changes noise level on cell borders. Cells are distorted using Iris styled wispy noise.")
@DontObfuscate
CELLULAR_IRIS_HALF(rng -> CNG.signatureHalf(rng, NoiseType.CELLULAR)),
@Desc("Inverse of vascular, height gets to 1.0 as it approaches the center of a cell")
@DontObfuscate
PERTERB(rng -> new CNG(rng, NoiseType.CELLULAR_HEIGHT, 1D, 1)),
CELLULAR_HEIGHT(rng -> new CNG(rng, NoiseType.CELLULAR_HEIGHT, 1D, 1)),
@Desc("Inverse of vascular, height gets to 1.0 as it approaches the center of a cell, using the iris style.")
@DontObfuscate
PERTERB_IRIS(rng -> CNG.signature(rng, NoiseType.CELLULAR_HEIGHT)),
CELLULAR_HEIGHT_IRIS(rng -> CNG.signature(rng, NoiseType.CELLULAR_HEIGHT)),
@Desc("Inverse of vascular, height gets to 1.0 as it approaches the center of a cell, using the iris style.")
@DontObfuscate
CELLULAR_HEIGHT_IRIS_DOUBLE(rng -> CNG.signatureDouble(rng, NoiseType.CELLULAR_HEIGHT)),
@Desc("Inverse of vascular, height gets to 1.0 as it approaches the center of a cell, using the iris style.")
@DontObfuscate
CELLULAR_HEIGHT_IRIS_THICK(rng -> CNG.signatureThick(rng, NoiseType.CELLULAR_HEIGHT)),
@Desc("Inverse of vascular, height gets to 1.0 as it approaches the center of a cell, using the iris style.")
@DontObfuscate
CELLULAR_HEIGHT_IRIS_HALF(rng -> CNG.signatureHalf(rng, NoiseType.CELLULAR_HEIGHT)),
@Desc("Vascular noise gets higher as the position nears a cell border.")
@DontObfuscate
@ -90,6 +310,18 @@ public enum NoiseStyle {
@DontObfuscate
VASCULAR_IRIS(rng -> CNG.signature(rng, NoiseType.VASCULAR)),
@Desc("Vascular noise gets higher as the position nears a cell border. Cells are distorted using Iris styled wispy noise.")
@DontObfuscate
VASCULAR_IRIS_DOUBLE(rng -> CNG.signatureDouble(rng, NoiseType.VASCULAR)),
@Desc("Vascular noise gets higher as the position nears a cell border. Cells are distorted using Iris styled wispy noise.")
@DontObfuscate
VASCULAR_IRIS_THICK(rng -> CNG.signatureThick(rng, NoiseType.VASCULAR)),
@Desc("Vascular noise gets higher as the position nears a cell border. Cells are distorted using Iris styled wispy noise.")
@DontObfuscate
VASCULAR_IRIS_HALF(rng -> CNG.signatureHalf(rng, NoiseType.VASCULAR)),
;
private CNGFactory f;