"fast" mode

This commit is contained in:
Daniel Mills 2020-01-20 15:02:48 -05:00
parent a4b571ccbc
commit 2aef5f94c0
7 changed files with 29 additions and 12 deletions

View File

@ -32,6 +32,8 @@ public class CommandIris implements CommandExecutor
{ {
msg(sender, "/iris timings - Iris Timings"); msg(sender, "/iris timings - Iris Timings");
msg(sender, "/iris rtp [biome] - RTP to a biome"); msg(sender, "/iris rtp [biome] - RTP to a biome");
msg(sender, "/iris otp [schematic] - RTP to a specific schematic");
msg(sender, "/iris info - Chunk info");
msg(sender, "/iris reload - Reload & Recompile"); msg(sender, "/iris reload - Reload & Recompile");
msg(sender, "/iris clean - Clean Pack Install in Iris Folder"); msg(sender, "/iris clean - Clean Pack Install in Iris Folder");
msg(sender, "/ish - Iris Schematic Commands"); msg(sender, "/ish - Iris Schematic Commands");

View File

@ -10,13 +10,11 @@ public class Settings
public static class PerformanceSettings public static class PerformanceSettings
{ {
public PerformanceMode performanceMode = PerformanceMode.HALF_CPU; public PerformanceMode performanceMode = PerformanceMode.HALF_CPU;
public boolean fastDecoration = true; public boolean fastMode = true;
public int threadPriority = Thread.MAX_PRIORITY; public int threadPriority = Thread.MAX_PRIORITY;
public int threadCount = 4; public int threadCount = 4;
public boolean debugMode = true; public boolean debugMode = true;
public int decorationAccuracy = 2; public int decorationAccuracy = 2;
public boolean interpolation = true;
public boolean surfaceNoise = true;
public boolean noObjectFail = false; public boolean noObjectFail = false;
public boolean verbose = false; public boolean verbose = false;
public int placeHistoryLimit = 8192; public int placeHistoryLimit = 8192;
@ -39,7 +37,7 @@ public class Settings
public double baseHeight = 0.065; public double baseHeight = 0.065;
public int seaLevel = 63; public int seaLevel = 63;
public double caveDensity = 5; public double caveDensity = 5;
public double caveScale = 1.45; public double caveScale = 1.2;
public double biomeScale = 0.65; public double biomeScale = 0.65;
public boolean flatBedrock = true; public boolean flatBedrock = true;
public boolean genObjects = true; public boolean genObjects = true;

View File

@ -1,11 +1,14 @@
package ninja.bytecode.iris.controller; package ninja.bytecode.iris.controller;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import mortar.util.text.C;
import ninja.bytecode.iris.Iris; import ninja.bytecode.iris.Iris;
import ninja.bytecode.iris.generator.IrisGenerator; import ninja.bytecode.iris.generator.IrisGenerator;
import ninja.bytecode.iris.util.IrisController; import ninja.bytecode.iris.util.IrisController;
@ -55,6 +58,15 @@ public class DebugController implements IrisController
i.teleport(new Location(w, m.getX(), m.getY(), m.getZ(), m.getYaw(), m.getPitch())); i.teleport(new Location(w, m.getX(), m.getY(), m.getZ(), m.getYaw(), m.getPitch()));
i.setFlying(true); i.setFlying(true);
i.setGameMode(GameMode.SPECTATOR); i.setGameMode(GameMode.SPECTATOR);
if(Iris.settings.performance.fastMode)
{
msg(i, C.GOLD + "Fast Mode is ON!");
msg(i, "* Terrain is not interpolated");
msg(i, "* Schematics larger than 3 chunks may be clipped");
msg(i, "* Underground Generation is disabled");
msg(i, "* Surface Lighting is skipped");
}
} }
for(String i : ws) for(String i : ws)
@ -78,6 +90,11 @@ public class DebugController implements IrisController
}, 1); }, 1);
} }
public void msg(CommandSender s, String msg)
{
s.sendMessage(ChatColor.DARK_PURPLE + "[" + ChatColor.GRAY + "Iris" + ChatColor.DARK_PURPLE + "]" + ChatColor.GRAY + ": " + msg);
}
@Override @Override
public void onStop() public void onStop()
{ {

View File

@ -223,8 +223,8 @@ public class IrisGenerator extends ParallaxWorldGenerator
public double getANoise(int x, int z, ChunkPlan plan, IrisBiome biome) public double getANoise(int x, int z, ChunkPlan plan, IrisBiome biome)
{ {
double hv = Iris.settings.performance.interpolation ? IrisInterpolation.getNoise(x, z, Iris.settings.gen.hermiteSampleRadius, (xf, zf) -> getBiomedHeight((int) Math.round(xf), (int) Math.round(zf), plan)) : getBiomedHeight((int) Math.round(x), (int) Math.round(z), plan); double hv = !Iris.settings.performance.fastMode ? IrisInterpolation.getNoise(x, z, Iris.settings.gen.hermiteSampleRadius, (xf, zf) -> getBiomedHeight((int) Math.round(xf), (int) Math.round(zf), plan)) : getBiomedHeight((int) Math.round(x), (int) Math.round(z), plan);
hv += Iris.settings.performance.surfaceNoise ? glLNoise.generateLayer(hv * Iris.settings.gen.roughness * 215, (double) x * Iris.settings.gen.roughness * 0.82, (double) z * Iris.settings.gen.roughness * 0.82) * (1.6918 * (hv * 2.35)) : 0; hv += glLNoise.generateLayer(hv * Iris.settings.gen.roughness * 215, (double) x * Iris.settings.gen.roughness * 0.82, (double) z * Iris.settings.gen.roughness * 0.82) * (1.6918 * (hv * 2.35));
if(biome.hasCliffs()) if(biome.hasCliffs())
{ {

View File

@ -71,7 +71,7 @@ public class GenLayerCaverns extends GenLayer
public void genCaverns(double wxx, double wzx, int x, int z, int s, IrisGenerator g, IrisBiome biome, AtomicChunkData data) public void genCaverns(double wxx, double wzx, int x, int z, int s, IrisGenerator g, IrisBiome biome, AtomicChunkData data)
{ {
if(!Iris.settings.gen.genCaverns) if(!Iris.settings.gen.genCaverns || Iris.settings.performance.fastMode)
{ {
return; return;
} }

View File

@ -31,7 +31,7 @@ public class GenLayerCaves extends GenLayer
public void genCaves(double wxx, double wzx, int x, int z, int s, IrisGenerator g, AtomicChunkData data) public void genCaves(double wxx, double wzx, int x, int z, int s, IrisGenerator g, AtomicChunkData data)
{ {
if(!Iris.settings.gen.genCaves) if(!Iris.settings.gen.genCaves || Iris.settings.performance.fastMode)
{ {
return; return;
} }
@ -40,7 +40,7 @@ public class GenLayerCaves extends GenLayer
{ {
double thickness = 0.25 + itr + (0.5 * caveClamp.noise(wxx, wzx)); double thickness = 0.25 + itr + (0.5 * caveClamp.noise(wxx, wzx));
double size = (3.88D * thickness); double size = (3.88D * thickness);
double variance = 8.34D * thickness; double variance = 3.34D * thickness;
double w = size + (variance * caveGirth.noise(wxx, wzx)); double w = size + (variance * caveGirth.noise(wxx, wzx));
double h = size + (variance * caveGirth.noise(wzx, wxx)); double h = size + (variance * caveGirth.noise(wzx, wxx));
double width = 0; double width = 0;

View File

@ -48,7 +48,7 @@ public abstract class ParallaxWorldGenerator extends ParallelChunkGenerator impl
@EventHandler @EventHandler
public void on(ChunkLoadEvent e) public void on(ChunkLoadEvent e)
{ {
if(e.getWorld().equals(world)) if(!Iris.settings.performance.fastMode && e.getWorld().equals(world))
{ {
NMP.host.relight(e.getChunk()); NMP.host.relight(e.getChunk());
Bukkit.getScheduler().scheduleSyncDelayedTask(Iris.instance, () -> fix.add(e.getChunk()), 20); Bukkit.getScheduler().scheduleSyncDelayedTask(Iris.instance, () -> fix.add(e.getChunk()), 20);
@ -109,11 +109,11 @@ public abstract class ParallaxWorldGenerator extends ParallelChunkGenerator impl
TaskGroup g = startWork(); TaskGroup g = startWork();
int gg = 0; int gg = 0;
int gx = 0; int gx = 0;
for(int ii = -(getParallaxSize().getX() / 2) - 1; ii < (getParallaxSize().getX() / 2) + 1; ii++) for(int ii = Iris.settings.performance.fastMode ? -1 : -(getParallaxSize().getX() / 2) - 1; ii < (Iris.settings.performance.fastMode ? 1 : ((getParallaxSize().getX() / 2) + 1)); ii++)
{ {
int i = ii; int i = ii;
for(int jj = -(getParallaxSize().getZ() / 2) - 1; jj < (getParallaxSize().getZ() / 2) + 1; jj++) for(int jj = Iris.settings.performance.fastMode ? -1 : -(getParallaxSize().getZ() / 2) - 1; jj < (Iris.settings.performance.fastMode ? 1 : ((getParallaxSize().getZ() / 2) + 1)); jj++)
{ {
gx++; gx++;
int j = jj; int j = jj;